PDA

View Full Version : clGetDeviceIDs() failing



clunis_immensus
09-22-2009, 11:33 PM
I am trying to run the NVIDIA OpenCL SDK samples.

In the oclDeviceQuery sample, ciDeviceCount is never set to any value regardless of the device_type used in this function call:
clGetDeviceIDs ((cl_platform_id)CL_PLATFORM_NVIDIA, CL_DEVICE_TYPE_GPU, 0, NULL, &ciDeviceCount);

I have a GTX280 card, and am running 64-bit Vista.
OpenCL SDK Version: 1.00.00.07

any pointers?

MarcusMiss
09-23-2009, 07:04 AM
Hi,
you should give OpenCL the change to delivers at least one id:
Example:


cl_device_id device_id;
err = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 1, &device_id, NULL);

Regards,
Marcus

dbs2
09-23-2009, 09:35 AM
What error are you getting back? If you are not getting an error then I would guess your drivers are not working correctly or there is a bug in the vendor implementation. Have you tried posting on their forum?

vlevenf
01-04-2012, 03:25 AM
I am getting back the error
undefined reference to 'clGetDeviceIDs@24'

this is the code I am using


#include <iostream>
#include <CL\opencl.h>

using namespace std;


int main()
{
cl_int error;
cl_device_id deviceID;

error = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 1, &deviceID, NULL);


}

I am probably overlooking something obvious but I haven't been able to figure it out.

vlevenf
01-04-2012, 07:00 PM
Ok I've gone back and updated every possible thing I could think of (latest drivers, SDK, MinGW) and I'm still getting these undefined reference errors in Code::Blocks.

I've tried adding the OpenCL libraries in C::B linker settings
"C:\Program Files (x86)\AMD APP\lib\x86_64\OpenCL.lib"

and it doesn't help.

I've tried running reimp on OpenCL.lib and it tells me its an invalid or corrupt import library. I can't seem to get the library to work, so declaring OpenCL variable types like cl_int seems to work fine (at least, the compiler doesn't give an error) but every attempted OpenCL-specific function call I make gives me this "undefined reference" error.

EDIT: Linking the library in the linker settings AND its directory under Linker Search Directories has stopped the undefined reference errors but now I am getting the following:

mingw32-g++.exe: (x86)\AMD: No such file or directory
mingw32-g++.exe: APP\lib\x86_64\OpenCL.lib: No such file or directory
mingw32-g++.exe: no input files
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

So, it looks like its reading filepaths with spaces in them as separate filepaths. I tried going back and putting all paths in quotes but that didn't solve the issue. I can't very well rename my Program Files (x86) folder, can I? How can I get around this problem?

vlevenf
01-04-2012, 07:41 PM
Ok so I tried copying the folder "AMD APP" which was in "Program Files (x86)" to a new folder c:\vAMD\ so that I could avoid spaces and, after pointing C::B to the new library and header file locations I am back to undefined references. Obviously I am missing a big piece of the picture. I think I now qualify as completely lost. Can anyone at least give me a lead?