Results 1 to 8 of 8

Thread: how to calculate execution time of program on GPU and CPU?

  1. #1

    how to calculate execution time of program on GPU and CPU?

    what to write and where to write, to calculate execution time of the program in openCL
    thanks

  2. #2

    Re: how to calculate execution time of program on GPU and CP

    Two options: you can measure the date and time at the start and end of your algorithm using an OS and language dependent function, or you can use cl_event objects to measure the time taken for each OpenCL function call. If you want to do the latter, have a look at section 5.9 "Profiling Operations on Memory Objects and Kernels" in the OpenCL specifications. Remember that the command queues you use must have profiling enabled if using this approach.

  3. #3

    Re: how to calculate execution time of program on GPU and CP

    ok thanks
    but i am new to openCL ,pls give information via which functions or any example regarding this can help much.

  4. #4

    Re: how to calculate execution time of program on GPU and CP

    Since I have not idea what operating system or programming language you are using, I cannot tell you what functions to use to measure wall time.

    For the OpenCL functions, I'll stick to C and hope that helps you. First, you need to enable profiling on which ever command queue you are going to use. You can do this when creating the command queue by including the command queue property CL_QUEUE_PROFILING_ENABLE in your call to clCreateCommandQueue.

    After enqueueing an operation that generates an event, which I'll call EV, you can use clGetEventProfilingInfo to obtain the following times: time when the command was enqueued, when it was submitted to the device, when it started executing on the device and finally, when it finished executing.

    Note that this function will return the constant CL_SUCCESS if it could retrieve the requested counter, or CL_PROFILING_INFO_NOT_AVAILABLE if the counter isn't available yet. This would happen if, for example, you requested the finishing time but the operation is still executing.

  5. #5

    Re: how to calculate execution time of program on GPU and CP

    i am using opencl c and os windows 7

  6. #6

    Re: how to calculate execution time of program on GPU and CP

    If you are using Visual Studio (Visual C++) then you can use the functions QueryPerformanceCounter and QueryPerformanceFrequency to get accurate measurements. If you are using another compiler, then you should look at the header file time.h (http://www.cplusplus.com/reference/clibrary/ctime/). There are two functions there that can help you: clock and time. time() is only accurate to seconds, while clock() is accurate to several milliseconds.

  7. #7

    Re: how to calculate execution time of program on GPU and CP

    ok thanks but if i have to compare between CPU and GPU time.what time should i consider means time from "sending the command form CPU to GPU -to- read the result from CPU in its memory.or the execution time of running time at cores on GPU and CPU.

  8. #8
    Senior Member
    Join Date
    Aug 2011
    Posts
    271

    Re: how to calculate execution time of program on GPU and CP

    Quote Originally Posted by jai
    ok thanks but if i have to compare between CPU and GPU time.what time should i consider means time from "sending the command form CPU to GPU -to- read the result from CPU in its memory.or the execution time of running time at cores on GPU and CPU.
    Err, choose whichever you want. It's up to you!

Similar Threads

  1. Replies: 2
    Last Post: 10-14-2012, 08:41 AM
  2. The execution in GPU is not the same that CPU
    By luizdrumond in forum OpenCL
    Replies: 3
    Last Post: 09-02-2011, 03:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •