PyOpenCL FAQ
[[!toc ]]
General Questions
Which implementations was PyOpenCL tested against?
So far, the following:
Should I use PyOpenCL or PyCUDA?
Good question. I put together a page that presents arguments that help you decide. The answer will likely depend on your particular situation. In most cases, "it doesn't matter" is probably the correct answer.
Build Questions
I get a compilation error with CUDA 3.2
Does your error look like this?
In file included from src/wrapper/wrap_cl.hpp:23,
from src/wrapper/wrap_cl.cpp:1:
/home/andreas/pool/cuda-3.2/include/CL/cl_ext.h:166: error: expected constructor, destructor, or type conversion before ‘!’ token
In file included from src/wrapper/wrap_cl.cpp:1:
src/wrapper/wrap_cl.hpp: In member function ‘boost::python::list pyopencl::device::create_sub_devices(boost::python::api::object)’:
src/wrapper/wrap_cl.hpp:549: error: ‘clCreateSubDevicesEXT_fn’ was not declared in this scope
src/wrapper/wrap_cl.hpp:549: error: expected ‘;’ before ‘cl_create_sub_devices’
src/wrapper/wrap_cl.hpp:553: error: ‘cl_create_sub_devices’ was not declared in this scope
src/wrapper/wrap_cl.hpp:564: error: ‘cl_create_sub_devices’ was not declared in this scope
src/wrapper/wrap_cl.hpp:570: error: ‘cl_create_sub_devices’ was not declared in this scope
If so, the problem is that Nvidia shipped a broken cl_ext.h
header with CUDA 3.2. Upgrade to CUDA 4.0, or use the patch below to set things straight. If neither of these is an option, configure PyOpenCL with CL_ENABLE_DEVICE_FISSION = False
.
--- CL/cl_ext.h 2011-04-24 00:17:26.479673000 -0400
+++ CL/cl_ext.h 2011-04-17 14:53:45.814178002 -0400
@@ -21,7 +21,7 @@
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
******************************************************************************/
-/* $Revision: 11687 $ on $Date: 2010-06-12 03:47:22 +0530 (Sat, 12 Jun 2010) $ */
+/* $Revision: 11928 $ on $Date: 2010-07-13 21:34:56 +0530 (Tue, 13 Jul 2010) $ */
/* cl_ext.h contains OpenCL extensions which don't have external */
/* (OpenGL, D3D) dependencies. */
@@ -163,7 +163,7 @@
cl_device_id * /*out_devices*/,
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
- extern CL_API_ENTRY cl_int
+ typedef CL_API_ENTRY cl_int
( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,
const cl_device_partition_property_ext * /* properties */,
cl_uint /*num_entries*/,
Unfortunately, there isn't enough version information available in these headers to catch the problem ahead of time.
I have with gcc 4.1 or older. Help!
Try adding:
CXXFLAGS = ['-DBOOST_PYTHON_NO_PY_SIGNATURES', '-DBOOST_NO_INCLASS_MEMBER_INITIALIZATION']
to your pyopencl/siteconf.py
or $HOME/.aksetup-defaults.py
.
Usage Questions
Can I get syntax highlighting for CL code included in Python?
Yes. In Vim, use the file contrib/pyopencl.vim
and see the comments therein. (This file will be added in version 2011.1. You can alternatively get it from git)
Packing up parameters is getting tedious. Help?
Check out Yapocis, by Sean True.