3 Replies Latest reply on Feb 4, 2010 4:42 AM by genaganna

    Profiling of the Code in OpenCL

    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 <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

        • Profiling of the Code in OpenCL
          nou

          did you enable profiling when you create command queue?

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

          • Profiling of the Code in OpenCL
            Fr4nz

             

            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.

            • Profiling of the Code in OpenCL
              genaganna

               

              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.