【发布时间】:2018-02-06 12:29:59
【问题描述】:
将设备设置为1时会分配ptr,并且在将'ptr'从设备复制到'host_ptr'之前,我是否必须再次将设备设置为1?
cudaSetDevice(1);
cudaMalloc(ptr, size);
//do something here
...
cudaSetDevice(0);
//do something here
...
//cudaSetDevice(1); #My qustion: is this line needed?
cudaMemcpy(host_ptr, ptr, size, cudaMemcpyDeviceToHost);
【问题讨论】:
-
@Shadow 我都测试过,一切正常。所以我很困惑
标签: cuda