0
votes

I'm using the Nvidia implementation of openCL.

cl_uint devicecount=NULL;
cl_uint NumPlatforms;
clGetPlatformIDs (0, NULL, &NumPlatforms);

cl_platform_id* PlatformIDs;
PlatformIDs = new cl_platform_id[NumPlatforms];
clGetPlatformIDs(NumPlatforms, PlatformIDs, NULL);

cl_device_id cdDevice;
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_CPU, 1, &cdDevice, &devicecount);

cout << NumPlatforms << endl;
cout << PlatformIDs << endl;
cout << cdDevice << endl;
cout << devicecount << endl;

I actually probably don't have a compatible GPU at the moment, but I have a compatible CPU. The query tells me that I have 0 platforms, and 0 devices. Am I doing this correctly? I don't exactly understand what a platform is, and why I don't have one. What exactly does it take for openCL to find and use a platform?

EDIT:

I got my new card in the mail today, installed amd sdk, and reinstalled nvidia sdk, and I am now seeing all my platforms and devices!

The next step is to create contexts. Can I put devices from different platforms on the same context? Is it very difficult, given you need separate command queues for each device etc, to write a program to use all devices on a system even if the number is a hundred thousand?

2

2 Answers

2
votes

Platform is, basically, an installed OpenCL implementation. Physically, it is an ICD record (file in /etc/OpenCL/vendors/ on *nix, registry record in Windows) which helps OpenCL.dll/libOpenCL.so find actual vendor-specific implementation(s).

In your case it looks like since you GPU does not support OpenCL, driver has not added nVidia's library to the list of the platforms. [offtop] I wonder whether it would be required to reinstall driver after upgrading you hardware to CUDA/OpenCL compatible...

In order to use your CPU as OpenCL device, you must install either AMD APP SDK or Intel OpenCL SDK, since nVidia's implementation does not support CPU in any way

0
votes

I installed the intel, and amd SDK, and get interesting results when I get information for the cpu device on the intel platform vs the amd platform.

My intel I5 device, on the intel platform has 128 samplers and 128 execution capabilities, while on the amd platform it has 16 samplers and execution capabilities. Also on the amd platform, the cpu has a max clock frequency of 3310, while on intel's platform 3300.

I wonder if this difference is in name only, or if there is a difference in performance between choosing an intel device off of an intel platform?