cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

pavandsp
Adept I

Profiling of the Code in OpenCL

Hi

I am trying to profile a simple (for loop)code in OpenCL.

I used clGetEventProfilingInfo to get the start and end time.But i am getting weired values start time=-1775338701 ,end time=19927,and the diff=start-end=1046102520 and the  param_value_size_ret=19939.

I called the api clGetEventProfilingInfo after clEnqueueNDRangekernel and clwaitForevents apis.

My Config=Linux Ubuntu 9.04,Intel CPU.

My Question is :1.How come start time is -ve

2.end time <start time.

psuedo profile code:

clGetEventProfilingInfo (events[0],CL_PROFILING_COMMAND_START,sizeof(cl_ulong,&starttime,&length));

clGetEventProfilingInfo (events[0],CL_PROFILING_COMMAND_END,sizeof(cl_ulong,&end time,&length));

cl_ulong diff=endtime-start time;

printf("start time=%d end =%d diff=%d length=%d",start,end ,diff,length);

do i need to do something in kernel file?

Thanks

Pavan

0 Likes
3 Replies
nou
Exemplar

did you enable profiling when you create command queue?

%d in printf expect 32 bit int. use %llu instead.

0 Likes
Fr4nz
Journeyman III

Originally posted by: pavandsp

[cut]

 

do i need to do something in kernel file?

 

Thanks

 

Pavan

 



 

Times returned by profiler are expressed in nanoseconds (10^-9 sec.), that's why you see those values. After you do endtime-starttime you have to scale the result in seconds.

0 Likes
genaganna
Journeyman III

Originally posted by: pavandsp Hi

I am trying to profile a simple (for loop)code in OpenCL.

I used clGetEventProfilingInfo to get the start and end time.But i am getting weired values start time=-1775338701 ,end time=19927,and the diff=start-end=1046102520 and the  param_value_size_ret=19939.

I called the api clGetEventProfilingInfo after clEnqueueNDRangekernel and clwaitForevents apis.

My Config=Linux Ubuntu 9.04,Intel CPU.

My Question is :1.How come start time is -ve

2.end time

psuedo profile code:

clGetEventProfilingInfo (events[0],CL_PROFILING_COMMAND_START,sizeof(cl_ulong,&starttime,&length));

clGetEventProfilingInfo (events[0],CL_PROFILING_COMMAND_END,sizeof(cl_ulong,&end time,&length));

cl_ulong diff=endtime-start time;

printf("start time=%d end =%d diff=%d length=%d",start,end ,diff,length);

 

               Could you please post test case which shows the problem? 

     Do i need to do something in kernel file?

     Nothing is required in kernel file.

 

 

0 Likes