GPU对我来说是新的。这个 OpenCL 片段说它在 7ms 内将 7mb 传输到 GPU。这听起来是对的还是我错过了什么?
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 to 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 to transfer";