Hey guys, just starting with openCL, I am following a book called "OpenCL Parallel Programming Development Cookbook" to get started with OpenCL.
I am using Visual C++ (because thats all I have on me, I might try spin up a linux box later when I have some more time) on Visual Studio 2015, windows 10 64bit.
I just installed the latest drivers for both the intel and amd gpus and installed the latest intel openCL sdk.
so I get this error:
Unhandled exception at 0x5A423656 (OpenCL.dll) in TestOpenCLProject"T.exe: 0xC0000005: Access violation reading location 0xCCCCCCCC.
at this line:
error = clGetPlatformInfo(id, param_name, 0, NULL, ¶mSize);
When I Run this code
... void displayPlatformInfo(cl_platform_id id, cl_platform_info param_name, const char* paramNameAsStr) { cl_int error = 0; size_t paramSize = 0; error = clGetPlatformInfo(id, param_name, 0, NULL, ¶mSize); char* moreInfo = (char*)alloca(sizeof(char) * paramSize); error = clGetPlatformInfo(id, param_name, paramSize, moreInfo, NULL); if (error != CL_SUCCESS) { perror("Unable to find any OpenCl platform information"); return; } printf("%s: %s\n", paramNameAsStr, moreInfo); } int main(void) { /* OpenCL 1.2 data structures */ cl_platform_id* platforms; /* OpenCl 1.1 scalar data types */ cl_uint numOfPlatforms; cl_int error; ... error = clGetPlatformIDs(0, NULL, &numOfPlatforms); if (error < 0) { perror("Unable to find any OpenCl platofrms"); exit(1); } ... platforms = (cl_platform_id*)alloca(sizeof(cl_platform_id) * numOfPlatforms); printf("Number of OpenCL platforms found: %d\n", numOfPlatforms); ... for (cl_uint i = 0; i < numOfPlatforms; ++i) { displayPlatformInfo(platforms[i], CL_PLATFORM_PROFILE, "CL_PLATFORM_PROFILE"); displayPlatformInfo(platforms[i], CL_PLATFORM_VERSION, "CL_PLATFORM_VERSION"); displayPlatformInfo(platforms[i], CL_PLATFORM_NAME, "CL_PLATFORM_NAME"); displayPlatformInfo(platforms[i], CL_PLATFORM_VENDOR, "CL_PLATFORM_VENDOR"); displayPlatformInfo(platforms[i], CL_PLATFORM_EXTENSIONS, "CL_PLATFORM_EXTENSIONS"); } std::cout << "\nPress Enter to Continue"; std::cin.ignore(); return 0; }
Im not particularly adept with c++ and the book seems to be writing for C so that may be where the error lies but if anyone can help me that would be great