我的显卡为GTX570。传输总线为 PCI-E x16.使用下面的方法传输40M整形数据消耗的时间为35ms.不知道有没有什么方法可以优化?
代码如下:
#define TOTAL_NUM 4010241024
int keys;
cudaMallocHost((void*)&keys,sizeof(int)TOTAL_NUM);//分配 pinned-memory
generateNumbers(keys,TOTAL_NUM);//生成随机整数
int dev_keys;
cudaMalloc((void)&dev_keys,sizeof(int)*TOTAL_NUM);//在global memory中分配存储空间
unsigned int copy_timer;
cudaFree(0);
cutCreateTimer(©_timer);
cutStartTimer(copy_timer);
cudaMemcpy(dev_keys,keys,sizeof(int)*TOTAL_NUM,cudaMemcpyHostToDevice);//拷贝pinned-memory 中的数组到global memory
cutStopTimer(copy_timer);
float copyTime = cutGetTimerValue(copy_timer);
printf(“Time to copy: %f ms\n”,copyTime);
实验结果: copyTime=35.1ms
请问有什么好的方法可以优化吗?多谢!