cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

saad_bukhari66
Journeyman III

Compiling Simple Program on Opencl

Well I am trying to compile a simple program in OpenCl ( i am new to OpenCl)using visual studio 2013, it breaks immediately at clCreateContext command  and error is "Unhandled exception at 0x524E132F (OpenCL.dll) in OpencL Program.exe: 0xC0000005: Access violation reading location 0xCCCCCCCC.' I have configured it again and again , if someone has faced this similar problem please do help me under this thread.

Thanks !

0 Likes
3 Replies
nou
Exemplar

can you compile and run examples from SDK?

0 Likes

I can just run them , they are already compiled so I usually debug them to know whats happening in the back ground, I just wanna know after configuring visual studio for opencl and amd gpu , why it does not work ?

In a separate Project! Below is the code !

int main(int argc, char **argv){

cl_platform_id platform;

cl_device_id device;

cl_context context;

cl_program program;

cl_kernel kernel;

cl_command_queue queue;

cl_mem kernelBuffer;

FILE* programHandle;

char *programBuffer;

char *programLog;

size_t programSize;

char hostBuffer[32];

clGetPlatformIDs(1, &platform, NULL);

clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);

context= clCreateContext(NULL, 1, &device, NULL, NULL, NULL); // This bold line throws unhandled exception saying that memory access violation , as mention in the Question and the program breaks!

Well by the way i m running this code in Visual Studio 2013, Windows 8, 64 bit , Amd Raedon 6770,

And i configured the visual sudio project settings following some tutorial on a website ! Thanks for the response !

0 Likes

first check if clGetPlatformIDs() return that one platform and also that clGetDeviceIDs() return some device. then you should provide cl_context_properties to clCreateContext() with that pltform in it.

0 Likes