Hello, i have some problems with calling the OpenCL functions from windows service environment. I made a small test application which just do
cl_uint numPlatforms = 0;
cl_platform_id *the_platforms;
cl_uint nDevices =0;
char Version[256];
cl_int tN = clGetPlatformIDs(0,NULL,&numPlatforms);
platforms = (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id));
tN = clGetPlatformIDs(numPlatforms, platforms, NULL);
int i =0;
for (i = 0; i < numPlatforms; i++)
{
cl_int status = clGetPlatformInfo(platform[i], CL_PLATFORM_VERSION, sizeof(Version), Version, NULL);
if (status != CL_SUCCESS)
strcpy(pVersion,"failed");
logTo(Version);
tN = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &nDevices);
}
The problem is, if i call this code from a service, on my and other laptops it seems to return only the integrated Intel HD Graphics platform, and the
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &nDevices);
fails for this platform. On my laptop i have also the NVIDIA 610M. If i run the code that i posted from the regular application the
clGetPlatformIDs(0,NULL,&numPlatforms);
returns the correct number of platforms which is two. So my question is, does the OpenCL work from a service environment? If it does, whats the problem with the platform detection and how i can fix it?
P.S I’m using the MinGW environment for windows with the AMD APP SDK 2.9 x64, and the library i’m linking against is ‘x86/libOpenCL.a’ which should link against khronos OpenCL.dll