Help setting up OpenCL

Hi,

I’m starting to develop in OpenCL, and I want to know how to setup and install OpenCL to use with Code::Blocks. I’m using the .h files that are here http://www.khronos.org/registry/cl/, but I think that I need to install something.

Thanks for the help and sorry for my english :stuck_out_tongue:

New info: after I installed GPU Caps (http://www.geeks3d.com/20091218/gpu-cap … and-demos/), it said that I have OpenCL in my system. When I tried to use one of the examples on GPU Caps, it said that it didn’t found an OpenCL GPU Device, but I have a GeForce 9x.

How can I setup OpenCL in Windows Vista to use with Code::Blocks?

Don’t know anything about GPU Caps or Code Blocks, but you probably need NVIDIAS GPU Computing SDK. Have a look at this page: http://developer.nvidia.com/object/cuda_3_0_downloads.html.

Thanks for the reply :smiley:

Actually, I managed to “install” OpenCL in my system. But I can’t configure it to Code::Blocks.
Can someone help me?

Are you on a Windows-Like (actually Windows) or a Linux-Like plateform?

For both you need to have CUDA installed (and perhaps CUDA SDK) (download them from here) and make sure you have the latest drivers available for your GPU.

For a Linux like you just have to add the header and specify the library to link (you can find it in the CUDA directory…) and that’s all.

For Windows, it’s not very difficult (and worked for me - 7 x64) if you are using the MingW compiler. Go into the installation directory of C::B. Then, from there, go in MingW/bin. You’ll find some exe and, among them, one named reimp.exe. Use it in the cmd prompt like this :

reimp.exe C:\CUDA\lib\OpenCL.lib

(According to your CUDA installation directory of course…)
You’ll get two files named “OpenCL.def” & “libopencl.a”. Copy them back to C:\CUDA\lib\ (or equivalent). Finally, in C::B, you can use

#include <CL/cl.h>

And link the library via the project options… (I had some trouble if I let the relative path, so you’ll probably have to test this too)…

Hope this can help…

Hi,
I have the same problem but i am using Microsoft Visual Studio C++ 2008.
The example of the GPU computing sdk work fine, but when i try to build my own project, i have no errors but the debugger starts!
Do u have any idea what the problem may be?
Thank you

The code I use is here:
https://www.wiki.ed.ac.uk/display/ecdfw … uick+start

I do C++ with OpenCL on VS 2008 also. I have not had problems running OpenCL, provided everything is set up properly. I have it working on Windows 7 x64 and Windows XP SP2 32-bit.

How you set it up depends on where your project is located. Did you follow the nVIDIA guide and copy an existing project in the GPU Computing SDK, or did you create a new project in VS2008?

Here’s some notes from my experiences:

  1. Make sure your drivers installed come with the OpenCL driver. Most of nvidia’s do; ATI currently requires you to get it through the Stream SDK.
  2. The IDK used by OpenCL looks for the OpenCL drivers in the registry. You can check to make sure this is set up correctly by going to “Run” -> “regedit”. Be careful when you’re in here. You can seriously screw a computer up. Look for “HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors”. You should have some .dll files there (notably nvcuda.dll)
  3. Check your project settings within VS2008. Notably, make sure you have the correct include directories to the OpenCL header (under C/C++, General). Also, make sure you have your Additional Library Directoreis set to your OpenCL.lib containing folder (Linker,General). Also, under "Additional Dependencies (Linker, Input) that you have “OpenCL.lib” listed.

My biggest problem was breaking away from the nVIDIA SDK samples, and figuring out the paths and making more ‘independent’ setups in my own locations.

The reason the debugger starts is that your code is error free, but if it doesn’t find the OpenCL driver, then there’s no chance that it’s going to be able to do anything with OpenCL.