opencl - How long does it take to transfer data between the main memory and GPU memory? -


gpu's new me. opencl snippet says transferred 7mb gpu in 7ms. sound right or missing something?

const int dim1size = 960000; int* dim1 = new int[dim1size]; int* dim2 = new int[dim1size]; long size = sizeof(int)*dim1size*2; size = size / 1024 / 1024; cout << size << "mb transfer" << endl;  cl_mem mem_d1 = clcreatebuffer(*context, 0, sizeof(int)*dim1size, null, null); cl_mem mem_d2 = clcreatebuffer(*context, 0, sizeof(int)*dim1size, null, null);  getsystemtime(&time); word start = (time.wsecond * 1000) + time.wmilliseconds; clenqueuewritebuffer(*queue, mem_d1, cl_true, 0, sizeof(int)*dim1size, dim1, 0, null, null); clenqueuewritebuffer(*queue, mem_d2, cl_true, 0, sizeof(int)*dim1size, dim2, 0, null, null); getsystemtime(&time); word end = (time.wsecond * 1000) + time.wmilliseconds; cout << (end - start) << "ms transfer"; 

1mbps slow gpu can run opencl. however, if @ numbers bit closer, might bit different results.

first off, sample not pushing 7mb, it's pushing 2 buffers 3.66mb each. 7.32mb, not big difference, nevertheless difference.

however there bigger uncertainty in code. you're using getsystemtime(). reports time millisecond precision, granularity not guaranteed. in fact, if there no processes requested higher granularity, 55ms accuracy. what's happening code. here quick sample allows figure out current getsystemtime() granularity:

systemtime t1, t2; getsystemtime(&t1); {     getsystemtime(&t2); } while (0 == memcmp(&t1, &t2, sizeof(systemtime))); std::cout << "timer granularity " << t2.wmilliseconds - t1.wmilliseconds << " milliseconds" << std::endl; 

answering original question, should see @ least ~700mbps system->video memory transfer, on slow kinds of old pcie v.1.0 cards.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -