I am developing the OpenCL app on Windows 10 basing on Eclipse CDT (Mars) and intel_sdk_for_opencl_setup_6.1.0.1600. The devices of my computer is as follow:
OS: Windows 10 pro CPU: I7-5500U Driver:win64_15407.4279.exe
Problem: Although the code is built successfully in Eclipse CDT, it is crashing and hanging when it is running as-->local C/C++ Application in Eclipse CDT. In fact, it can be built and ran successfully in the same IDE and OS by replacing 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 ) with 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[i], CL_PLATFORM_NAME, 0, NULL, &size);
char *PName = (char *) malloc(size);
err = clGetPlatformInfo(platform[i], CL_PLATFORM_NAME, size, PName,NULL);
printf("PName:%s\n", PName);
err = clGetPlatformInfo(platform[i], CL_PLATFORM_VENDOR, 0, NULL,&size);
char *PVendor = (char *) malloc(size);
err = clGetPlatformInfo(platform[i], CL_PLATFORM_VENDOR, size, PVendor,NULL);
printf("PVendor:%s\n", PVendor);
err = clGetPlatformInfo(platform[i], CL_PLATFORM_VERSION, 0, NULL,&size);
char *PVersion = (char *) malloc(size);
err = clGetPlatformInfo(platform[i], CL_PLATFORM_VERSION, size,PVersion, NULL);
printf("PVersion:%s\n", PVersion);
printf("i=%d err=%d\n\n", i, err);
}
return 0;
}