flags as the flags to use when initializing the current device. If no device has been made current to the calling thread then
flags will be applied to the initialization of any device initialized by the calling host thread, unless that device has had its initialization flags set explicitly by this or any host thread.
If the current device has been set and that device has already been initialized then this call will fail with the error cudaErrorSetOnActiveProcess. In this case it is necessary to reset
device using cudaDeviceReset() before the device's initialization flags may be set.
The two LSBs of the
flags parameter can be used to control how the CPU thread interacts with the OS scheduler when waiting for results from the device.
- cudaDeviceScheduleAuto: The default value if the
flags parameter is zero, uses a heuristic based on the number of active CUDA contexts in the process
C and the number of logical processors in the system
P, then CUDA will yield to other OS threads when waiting for the device, otherwise CUDA will not yield while waiting for results and actively spin on the processor.
- cudaDeviceScheduleSpin: Instruct CUDA to actively spin when waiting for results from the device. This can decrease latency when waiting for the device, but may lower the performance of CPU threads if they are performing work in parallel with the CUDA thread.
- cudaDeviceScheduleYield: Instruct CUDA to yield its thread when waiting for results from the device. This can increase latency when waiting for the device, but can increase the performance of CPU threads performing work in parallel with the device.
- cudaDeviceScheduleBlockingSync: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the device to finish work.
- cudaDeviceBlockingSync: Instruct CUDA to block the CPU thread on a synchronization primitive when waiting for the device to finish work.
- This flag was deprecated as of CUDA 4.0 and replaced with cudaDeviceScheduleBlockingSync.
|flags ||- Parameters for device operation|
- cudaSuccess, cudaErrorInvalidDevice, cudaErrorSetOnActiveProcess
- See also:
- cudaGetDeviceCount, cudaGetDevice, cudaGetDeviceProperties, cudaSetDevice, cudaSetValidDevices, cudaChooseDevice