0

I want to compare the performance of single-core CPU and multi-core CPU. I wrote a program and let it iterate 1000 times on a single-core CPU to see the running time. In the multi-core case, I used OpenCL to launch a kernel that where the code is same as that inside the iteration in the first case.

Considered multi-core could run 8 concurrent threads, theoretically, the running time of multi-core case should be above T(single-core)/8. But the results is that the T(multi-core) is almost 1/20 of T(single-core).

I wonder why this happen? Did OpenCL compiler do some optimization for multi-core CPU ?

2
  • What kind of code was this? How was the program compiled (e.g. optimisation flags)? Commented Jul 8, 2015 at 21:50
  • You'd better use OpenMP to compare single/multi core performance. It is very easy to use, and it runs exactly the same assembly code. Commented Jul 17, 2015 at 10:08

1 Answer 1

2

If your single core code was scalar, chances are the opencl runtime used sse or avx and get an extra multiplier.

Sign up to request clarification or add additional context in comments.

4 Comments

The single core code is scalar, but does the opencl runtime would use the SSE or AVX automatically ?
Maybe the single core version is more unoptimized and has more overload at runtime than the multicore compilation. It is hard to judge. Try to find out the behaviour on different CPUs with less cores.
@buttifulbuttefly I used AMD OpenCL, but I didn't use any vector representation in my code, in that case would AMD do the SSE/AVX automatically ?
SSE and AVX can be used just like on gpus. Different work items on each lane of the xmm/ymm registers. So if you have a work group of 256, you could imagine that it would run as 8 threads running each 8 lanes each unrolling 4 times. Our any other combination...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.