Hi, I have a kernel implemented by CUDA and OpenCL, respectively.
I can make sure the kernel code are the same in application level, with same configuration for the grid and thread block, same algorithm.
However, I observe that the kernel execution time are quite different, OpenCL spend half time against CUDA.
My environment is cuda 4.1 toolkit and gcc 4.4, with nvidia driver 304.88, kubuntu 12.10.
GPU, GT430, compute capability 2.1.
I profiled both kernels with compute visual profiler, and found the global memory throughput differ a lot, But I am stucked as the applications are the same.
So I trick a little bit the option of the compiler nvcc, my first try is
nvcc -keep -I/someincludepaths -gencode=arch=compute_20,code=sm_20
and then nvcc -keep -I/someincludepaths -gencode=arch=compute_20,code=sm_21
But I can’t see any performance improvement for the change of “code” options.
As a common concept that CUDA is faster than OpenCL, I get the contradictive results.
My profile strategy are:
for OpenCL is that bind a event for kernel call, get the start and end time, and then get the difference between the two.
for CUDA also using event, following is a piece of my profiling code:
cudaEventRecord(p->idct_event[0],p->idct_streams[0]);
idct_asyn_4x4_baseline_TB2<<<grid,threads,0,p->idct_streams[0]>>>(p->idct_dev_mem[0]);
cudaEventRecord(p->idct_event[1],p->idct_streams[0]);
cudaEventSynchronize(p->idct_event[1]);
cudaEventElapsedTime(&idct_kernel_time,p->idct_event[0],p->idct_event[1]);
Anyone who can give some clue why it happens, or some strategy to trace what happens?
Best