开发者

PyOpenCL can't find include files when installed via "easy_install."

so I've downloaded the nVidia CUDA libraries and put them in the default location:

/usr/local/cuda

When I go to run this:

sudo easy_install pyopencl

It gives me this error:

In file included from src/wrapper/wrap_cl.cpp:1:0:
src/wrapper/wrap_cl.hpp:20:19: fatal error: CL/cl.h: No such file or directory

I can, however, verify that the above file does exist along with several other header files:

/usr/local/cuda/include/CL/cl.h

I've even tried setting the LD_LIBRATH_PATH:

export LD_LIBRARY_PATH=/usr/lo开发者_运维百科cal/cuda/lib

But it doesn't seem to have any effect.

Any help is appreciated!


Your compiler's include path probably doesn't include /usr/local/cuda/include/. The environment variable LD_LIBRARY_PATH is actually there to tell the compiler/runtime environment where to find shared object files. There are two ways (that know of) to fix this:

1) Most compilers accept a flag that specifies an addition to the include path; for gcc, it's -I, so

gcc -I /usr/local/cuda/include [code files, more options, etc]

will tell gcc to look for includes in /usr/local/cuda/include, in addition to the system include path

2) Link the OpenCL header files into your system include path (usually /usr/include/). Something like:

# ln -s /usr/local/cuda/include/CL CL

executed from within the directory /usr/include should work.

If after fixing this problem, you have a problem like the following:

/usr/bin/ld: cannot find -lOpenCL

then you might want to look at this question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜