cudaError_t cudaSetDevice ( int  device  ) 

Sets device as the current device for the calling host thread.

Any device memory subsequently allocated from this host thread using cudaMalloc(), cudaMallocPitch() or cudaMallocArray() will be physically resident on device. Any host memory allocated from this host thread using cudaMallocHost() or cudaHostAlloc() or cudaHostRegister() will have its lifetime associated with device. Any streams or events created from this host thread will be associated with device. Any kernels launched from this host thread using the <<<>>> operator or cudaLaunch() will be executed on device.

This call may be made from any host thread, to any device, and at any time. This function will do no synchronization with the previous or new device, and should be considered a very low overhead call.

device - Device on which the active host thread should execute the device code.
cudaSuccess, cudaErrorInvalidDevice, cudaErrorSetOnActiveProcess
Note that this function may also return error codes from previous, asynchronous launches.
See also:
cudaGetDeviceCount, cudaGetDevice, cudaGetDeviceProperties, cudaChooseDevice

Generated by Doxygen for NVIDIA CUDA Library  NVIDIA