-3

I've encountered this problem. I need to compare CPU and GPU performance when calculating fractal using WebCL, CUDA or OpenCL. How can I do this?

Thank you.

elvinas
  • 554
  • 6
  • 19
  • 2
    Write 6 programs, one for each language, one for each device. Run them each a few times, record the run-times. Think about why they are different, or not. – High Performance Mark Jun 30 '14 at 16:09
  • 3
    I do not understand your question for two reasons. First, how do you expect that dealing with "fractals" will change the answer as compared to other topics. Second, how do you define the performance? If performance means just time, then the answer is definitely trivial and your question is a duplicate of many other questions that have appeared so far on SO. If performance means something else, then the answers than has been given below and above in the comments are wrong. – Vitality Jun 30 '14 at 16:34

1 Answers1

1

You can either time how long it takes to run a fixed number of iterations, or measure how many iterations are completed in a fixed time.

Or you can do something fancier such as doing a fixed amount of work, but if it completes too quickly such that timing imprecision is too large relatively, increase the work by a factor and repeat.

In any case, you can then calculate throughput as:

work_done / time_needed
Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • How can I measure the time needed to run some iterations? – elvinas Jun 30 '14 at 16:12
  • @citni: Capture a high performance timer right before you begin your processing, and again as soon as processing completes, subtract the two to get elapsed time. Don't forget to adjust by the time units used by the high performance timer. – Ben Voigt Jun 30 '14 at 16:13