cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

shankha
Journeyman III

OpenCL code hangs with code for calcuating timing information

Hi,

Platform : Windows 7 : 64 bit

Compiler : MSVC, AMD OpenCL

I have the following piece of code which I am compiling with MSVC and AMD OpenCL compiler.
I have pasted my code here : http://pastebin.com/M1A5kzd8.If I remove my timing code (comment out line no 😎 the code runs fine.If I add my timing code the program hangs at line no : 61. in function clCreateCommandQueue.
Could you please let me know what could be the possible reason.

I have tested my timing code with a hello world (without OpenCL) and it works fine.

Thanks
Shankha

0 Likes
5 Replies
richeek_arya
Journeyman III

I think when you create command queue you should add CL_QUEUE_PROFILING_ENABLE flag to get timing info out of kernel. I did it like this:

 commandQueue = clCreateCommandQueue(context, devices[0], CL_QUEUE_PROFILING_ENABLE, &status);

 

Hope it works for you too!

Richeek

0 Likes

Hi,
Thanks for your help. This was not what I was looking for. I am not looking to time the amout of time the kernel tool to execute. I am trying to figure out the amount of time it took to build (compiling) the kernel.

thanks.

0 Likes

I guess you should use some timer across the clCreateProgram + clBuildProgram for that. But this is purely implementation behind and I am not aware of AMD's implementation details, so it is just a guess.

 

0 Likes

The above code is doing exactly that. For some strange reason it hangs inside clCreateCommandQueue

0 Likes

I am able to run your code. MY system is Vista64 HD 5770 .

Value of Clocks_per_sec : 0.000000 ticks/sec
        freq test:   25000000 ticks/sec
QueryPerformanceCounter testpoint :     300455847858  ticks
clCreateContext start
clCreateContext done
        Elapsed CPU time test:   0.130063040    sec  ticks 3251576
Done...
Press any key to continue . . .

0 Likes