Problem with OpenCL routines

I’m fairly new to GPU programming and I’ve just set up CUDA 5.0 SDK on my CentOS 6.2 machine. All of the code samples compile and run without issue. However, I’m trying to compile some code from another scientist written under CUDA 3.x and I’m getting the following error:

g++ -I/usr/local/cuda-5.0/include -I/usr/local/cuda-5.0/include/CL -I/usr/lib64 -I/usr/lib -lOpenCL -c genome_ocl.cpp -o genome_ocl.o
genome_ocl.cpp:11:22: error: shrUtils.h: No such file or directory
genome_ocl.cpp:12:22: error: oclUtils.h: No such file or directory
genome_ocl.cpp: In function ‘void displayGenomeWideInfo_host(bool*, bool*, PlinkGPU_Locus*, PlinkGPU_Params*, int, int, int)’:
genome_ocl.cpp:47: error: ‘oclGetPlatformID’ was not declared in this scope
genome_ocl.cpp:48: error: ‘oclCheckError’ was not declared in this scope
genome_ocl.cpp:59: error: ‘shrLog’ was not declared in this scope
genome_ocl.cpp:96: error: ‘string’ was not declared in this scope
genome_ocl.cpp:96: error: expected ‘;’ before ‘header_path’
genome_ocl.cpp:97: error: ‘header_path’ was not declared in this scope
genome_ocl.cpp:99: error: ‘oclLoadProgSource’ was not declared in this scope
genome_ocl.cpp:104: error: expected ‘;’ before ‘source_path’
genome_ocl.cpp:105: error: ‘source_path’ was not declared in this scope
genome_ocl.cpp:133: error: ‘LOGBOTH’ was not declared in this scope
genome_ocl.cpp:133: error: ‘ERRORMSG’ was not declared in this scope
genome_ocl.cpp:133: error: ‘STDERROR’ was not declared in this scope
genome_ocl.cpp:133: error: ‘shrLogEx’ was not declared in this scope
genome_ocl.cpp:134: error: ‘oclGetFirstDev’ was not declared in this scope
genome_ocl.cpp:134: error: ‘oclLogBuildInfo’ was not declared in this scope
genome_ocl.cpp:135: error: ‘oclLogPtx’ was not declared in this scope
genome_ocl.cpp:142: error: ‘oclCheckErrorEX’ was not declared in this scope
genome_ocl.cpp:168: error: ‘shrRoundUp’ was not declared in this scope
genome_ocl.cpp: In function ‘char* cl_errstring(cl_int)’:
genome_ocl.cpp:250: error: ‘strdup’ was not declared in this scope
make: *** [genome_ocl.o] Error 1

A “locate” command for shrUtils and oclUtils turns up nothing. The NVIDIA pages for OpenCL (https://developer.nvidia.com/opencl) suggest that everything is in the current drivers. I have the 310.32 driver installed and I’m using card 0 for my GPU work.

[tony@Bach GPGPU]$ nvidia-smi
Thu May 2 13:34:03 2013
±-----------------------------------------------------+
| NVIDIA-SMI 4.310.32 Driver Version: 310.32 |
|-------------------------------±---------------------±---------------------+
| GPU Name | Bus-Id Disp. | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Quadro 600 | 0000:05:00.0 Off | N/A |
| 30% 49C P0 N/A / N/A | 0% 3MB / 1023MB | 0% Default |
±------------------------------±---------------------±---------------------+
| 1 Quadro FX 580 | 0000:04:00.0 N/A | N/A |
| 40% 42C N/A N/A / N/A | 7% 34MB / 511MB | N/A Default |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Compute processes: GPU Memory |
| GPU PID Process name Usage |
|=============================================================================|
| 1 Not Supported |
±----------------------------------------------------------------------------+

I know this isn’t the latest driver, but it’s not that far out-of-date. What am I missing? It must be something simple.

If I am not mistaken, the OpenCL libraries are not shipped with the CUDA 5.0 SDK. They are, however shipped with the CUDA 4.2 SDK (the previous version) – it seems they are going away from OpenCL support and focusing on CUDA alone.

You have 2 options, try it with CUDA 4.2 and compile ‘make’ the examples that come with it, or…

You can probably just download/unzip all the OpenCL samples from what NVIDIA has on the OpenCL website you mentioned – https://developer.nvidia.com/opencl into a folder and compile (make) the libraries that are included with the samples and them point the program you’re trying to compile to their locations.

The compile worked with the CUDA 4.2 libraries. The samples from the NVIDIA OpenCL URL contain the missing headers in the individual downloads. It looks like your assumption about moving away from OpenCL may be correct. Regardless, I’m up and running now. Many thanks!