-
Notifications
You must be signed in to change notification settings - Fork 62
Troubleshooting
Some of the potential issues that you may encounter while using Oclgrind are detailed below. If you can't find the resolution to your problem here, please file a new issue on the GitHub issue tracker to receive assistance.
Precompiled header issues
Oclgrind uses precompiled header files to improve the performance of kernel compilation. These are Clang precompiled headers, which are quite fragile. Below are some of the common issues that occur with their respective resolutions. Alternatively, precompiled headers can be disabled completely by passing --disable-pch
, or exporting OCLGRIND_DISABLE_PCH=1
.
fatal error: file '/usr/local/lib/../include/oclgrind/clc.h' has been modified since the precompiled header was built
This means that the modification time on the original header has changed, and Clang will subsequently refuse to use the precompiled header. This can happen if the Oclgrind include files were copied to a new location. On Unix systems, use cp -p
to preserve file modification times (mv
should also work).
WARNING: Unable to find precompiled header:
/usr/local/include/lib/../include/oclgrind//clc64.pch
The precompiled headers are assumed to be in a directory relative to the Oclgrind libraries: ../include/oclgrind/
. If you have placed the headers somewhere else, you can tell Oclgrind where to look with the --pch-dir
flag, or by exporting OCLGRIND_PCH_DIR
.
Inline Functions
During kernel creation, you may receive an error such as this:
OCLGRIND FATAL ERROR (../src/core/WorkItem.cpp:1493)
Undefined external function: user_function
This is potentially caused by misuse of the inline
keyword, which in C99 (from which OpenCL C is derived) behaves differently than in C++ or in GCC's C89 mode. In short, inline
is not simply a function attribute that can be added to give a hint to the compiler, and using it like this will cause the above error. See more here.
To resolve this, remove the inline
keyword from any user-defined function, declare them as static inline
, or provide a second, external, non-inline definition of your function.
(source not available) when using PyOpenCL
PyOpenCL caches compiled OpenCL programs for future runs of the same application. Oclgrind needs the program source in order to show source info when producing error messages and interactive debugging. Therefore, you should disable the compiler cache when running PyOpenCL applications with Oclgrind, by setting the PYOPENCL_NO_CACHE
environment variable:
PYOPENCL_NO_CACHE=1 oclgrind python application.py
CL_MEM_OBJECT_ALLOCATION_FAILURE when running in 32-bit mode
When compiled for 32-bit machines, Oclgrind currently has a limit on global memory allocations of 16MB. It can support up to 256 buffers at this size. If larger memory buffers are required, please use the 64-bit version of Oclgrind.