CL_DEVICE_TYPE_CPU not working in Windows 8.1

CL_DEVICE_TYPE_CPU not working in Windows 8.1

Hi, I recently tried to run my OpenCL program on a new windows 8.1 computer but the program returns an error when the device type is CL_DEVICE_TYPE_CPU. When I change the device type to a CL_DEVICE_TYPE_GPU or CL_DEVICE_TYPE_ ALL it ran the program on the GPU. Here is the system specification of the new computer: OS: Windows 8.1 Processor: Intel Core i7 - 4700MQ clocked at 2.40GHz Display Adapter: Intel HD Graphic 4600 and NVIDIA GeForce GT 740M How can I resolve this problem and is OpenCL having issues with windows 8.1? Please help! Yaknan

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

Hi Yaknan,

If you have not already done so, please download and install Intel HD Graphics driver from https://downloadcenter.intel.com/SearchResult.aspx?lang=eng&ProdId=3720. It contains OpenCL runtime both for Intel CPU and GPU.

In your application make sure that you choose Intel OpenCL platform (by CL_PLATFORM_NAME or CL_PLATFORM_VENDOR). This is necessary since you have also NVidia Graphics card and it's quite possible that it shows up as another OpenCL platform with the GPU device only.

Thanks,
Yuri

Hi Yuri,

Thank you for your prompt response. I visited the link you provided and searched for the latest driver and tried to install but it won't install. It prompted "The Driver being installed is not validated for this computer. Please obtain the appropriate driver from your computer manufacturer." Also how do you suggest I choose Intel openCl Platform by CL_PLATFORM_NAME or CL_PLATFORM_VENDOR from the code excerpt below:

	// Init CPU device
	m_DeviceCPU= NULL;
	 m_DeviceGPU= NULL;
	 kernel=NULL;
	 cl_platform_id platform_id= NULL;
	m_raytraceKernelWorkGroupSize= NULL;
	cl_uint ret_num_devices=0;
	cl_uint ret_num_platforms=0;
	cl_int err = 0;

	
	/* Get Platform and Device Info */
	err = clGetPlatformIDs(1, &platform_id, &ret_num_platforms);

	
	// Find the CPU CL device, as a fallback
	err = clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_ALL, 1, &m_DeviceCPU, &ret_num_devices);
	assert(err == CL_SUCCESS);
	if(err==CL_SUCCESS){
		device_stats(m_DeviceCPU);
	}
	

As the program does not see CL_DEVICE_TYPE_CPU. It returns only for GPU. 

Thanks

 

Yaknan

In your code you take the 1st available OpenCL platform by the call to:

err = clGetPlatformIDs(1, &platform_id, &ret_num_platforms);

In a general case (when multiple OpenCL platforms might be installed from different vendors) you should first query the number of available platforms and get all of them:

    cl_uint num_of_platforms = 0;
    // get total number of available platforms:
    cl_int err = clGetPlatformIDs(0, 0, &num_of_platforms);
    SAMPLE_CHECK_ERRORS(err);

    // use vector for automatic memory management
    vector platforms(num_of_platforms);
    // get IDs for all platforms:
    err = clGetPlatformIDs(num_of_platforms, &platforms[0], 0);
    SAMPLE_CHECK_ERRORS(err);

And then select the required one. You may also find this code in samples at https://software.intel.com/en-us/vcsource/tools/opencl-sdk. Look at common\oclobject.cpp, selectPlatform function.

What is the number of platforms on your system? What are the name/vendor of the platforms? I.e. what are return values of clGetPlatformInfo with CL_PLATFORM_NAME and CL_PLATFORM_VENDOR queries?

Hi Yuri,

I got around your suggestions and queried all the available platforms using the code below but the Platform for the CPU does not show:

	err = clGetPlatformIDs(0, 0, &ret_num_platforms);

	 cl_platform_id* platforms = new cl_platform_id[ret_num_platforms];

	 err = clGetPlatformIDs(ret_num_platforms, platforms, NULL);

				for (cl_uint ui=0; ui< ret_num_platforms; ++ui)
				{
						err = clGetPlatformInfo(platforms[ui], CL_PLATFORM_NAME, 128 * sizeof(char), platform_name, NULL);
						err = clGetPlatformInfo(platforms[ui], CL_PLATFORM_VENDOR, 128 * sizeof(char), vendor_names, NULL);
						err = clGetPlatformInfo(platforms[ui], CL_PLATFORM_PROFILE, 128 * sizeof(char), platform_profile, NULL);
						err = clGetPlatformInfo(platforms[ui], CL_PLATFORM_VERSION, 128 * sizeof(char), platform_version, NULL);
						
						if (CL_SUCCESS == err) 
						{
								// handle error
								//Printing available platforms and ids to a file
										FILE *outFile;
										outFile = fopen("Platforms.out", "a+");
											if (!outFile){
											printf("Cannot open output file.\n");
											exit(2); 
											}

									   fprintf(outFile,"Platform_ID = %d\n",ui);
									   fprintf(outFile,"Platform_Name:%s\n",platform_name);
									   fprintf(outFile,"Platform_Vendor_Name:%s\n",vendor_names);
									    fprintf(outFile,"Platform_Profile:%s\n",platform_profile);
									   fprintf(outFile,"Platform_Version:%s\n",platform_version);
									  
									 //  return;
						}

				}

   	
	// Find the CPU CL device, as a fallback
	err = clGetDeviceIDs(platforms[2], CL_DEVICE_TYPE_CPU, 1, &m_DeviceCPU, &ret_num_devices);

So, after much reading I released that the issue is from the OpenCL version. I downloaded the latest version OpenCL 2.0  2014 release from Intel (Test only release) from the link here and the Platform with the CPU comes up and the CL_DEVICE_TYPE_CPU ran smoothly.

Thanks

Yaknan

Login to leave a comment.