ptrが1にデバイスを設定した場合、およびホストするために、デバイスから「host_ptr」に「PTR」をコピーする前に、mallocさ、私は再び1にデバイスを設定しなければならないのですか?デバイスからホストへの 'cudaMemcpy'のときに、適切なデバイスを設定する必要がありますか?
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、すべてが働きました。だから私は混乱している –