OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1719 Discussions

OpenCL code is crashing with intel OpenCL.lib

chengzi
Beginner
567 Views

I am developing the OpenCL app on Windows with Eclipse CDT (Mars)  and  intel_sdk_for_opencl_setup_6.1.0.1600, the devices of computer is as follow:

OS: Windows 10 pro

CPU: I7-5500U

Driver:win64_15407.4279.exe()

Problem: Although the code is build successfully, it is crashing and generate the tips window as follow when it is running in Eclipse CDT. In fact, it  can be built and ran in the same IDE and OS by insteading the file OpenCL.lib(which is come from intel OpenCL SDK and locates in C:\Program Files (x86)\Intel\OpenCL SDK\6.1\lib\x64\OpenCL.lib ) by the counterpoint of AMD OpenCL SDK(***\AMD APP\lib\x64\OpenCL.lib).

Besides replacing the file (C:\Program Files (x86)\Intel\OpenCL SDK\6.1\lib\x64\OpenCL.lib) with (***\AMD APP\lib\x64\OpenCL.lib), how can I run the code as follow successfully with native intel_sdk_for_opencl_setup_6.1.0.1600 and Eclipse CDT ?

#include <stdio.h>
#include <stdlib.h>
#include<CL/cl.h>

int main(int argc, char *argv[]) {
	cl_uint err;
	cl_uint num_platform;
	cl_platform_id *platform;
	
	err = clGetPlatformIDs(0, NULL, &num_platform);
	if (CL_SUCCESS == err)
		printf("Number of Detected OpenCL platforms: %d\n\n", num_platform);
	else
		printf("Error calling clGetPlatformIDs. Error code: %d \n", err);

	platform = (cl_platform_id *) malloc(sizeof(cl_platform_id) * num_platform);
	
	err = clGetPlatformIDs(num_platform, platform, NULL);
	size_t size;

	for (cl_uint i = 0; i < num_platform; i++) {
		
		err = clGetPlatformInfo(platform, CL_PLATFORM_NAME, 0, NULL, &size);
		char *PName = (char *) malloc(size);
		err = clGetPlatformInfo(platform, CL_PLATFORM_NAME, size, PName,NULL);
		printf("PName:%s\n", PName);
		
		err = clGetPlatformInfo(platform, CL_PLATFORM_VENDOR, 0, NULL,&size);
		char *PVendor = (char *) malloc(size);
		err = clGetPlatformInfo(platform, CL_PLATFORM_VENDOR, size, PVendor,NULL);
		printf("PVendor:%s\n", PVendor);
	
		err = clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL,&size);
		char *PVersion = (char *) malloc(size);
		err = clGetPlatformInfo(platform, CL_PLATFORM_VERSION, size,PVersion, NULL);
		printf("PVersion:%s\n", PVersion);
		printf("i=%d err=%d\n\n", i, err);
	}
	return 0;
}

 

0 Kudos
1 Reply
Jeffrey_M_Intel1
Employee
567 Views

Sorry for the delayed reply.  I verified that your code is fine in Visual Studio.   

Do you have an AMD GPU on your system too, or just the i7-5500U processor?

You have probably already tried this, but the first step is probably to reinstall OpenCL then follow the install steps here again: https://software.intel.com/en-us/node/671831

I'm gathering more info on the Eclipse install + troubleshooting.  Hope to get back to you with more info soon.

0 Kudos
Reply