Function rcudnn::cudaSetDevice[][src]

pub unsafe extern "C" fn cudaSetDevice(device: i32) -> cudaError
Expand description

\brief Set device to be used for GPU executions

Sets \p device as the current device for the calling host thread. Valid device id’s are 0 to (::cudaGetDeviceCount() - 1).

Any device memory subsequently allocated from this host thread using ::cudaMalloc(), ::cudaMallocPitch() or ::cudaMallocArray() will be physically resident on \p device. Any host memory allocated from this host thread using ::cudaMallocHost() or ::cudaHostAlloc() or ::cudaHostRegister() will have its lifetime associated with \p device. Any streams or events created from this host thread will be associated with \p device. Any kernels launched from this host thread using the <<<>>> operator or ::cudaLaunchKernel() will be executed on \p 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.

\param device - Device on which the active host thread should execute the device code.

\return ::cudaSuccess, ::cudaErrorInvalidDevice, ::cudaErrorDeviceAlreadyInUse \notefnerr \note_init_rt \note_callback

\sa ::cudaGetDeviceCount, ::cudaGetDevice, ::cudaGetDeviceProperties, ::cudaChooseDevice, ::cuCtxSetCurrent