18 #include <rmm/detail/error.hpp>
20 #include <cuda_runtime_api.h>
59 return lhs.value() == rhs.value();
72 return lhs.value() != rhs.value();
89 RMM_ASSERT_CUDA_SUCCESS(cudaGetDevice(&dev_id));
101 RMM_ASSERT_CUDA_SUCCESS(cudaGetDeviceCount(&num_dev));
117 needs_reset_{dev_id.value() >= 0 && old_device_ != dev_id}
119 if (needs_reset_) { RMM_ASSERT_CUDA_SUCCESS(cudaSetDevice(dev_id.
value())); }
126 if (needs_reset_) { RMM_ASSERT_CUDA_SUCCESS(cudaSetDevice(old_device_.
value())); }
cuda_device_id get_current_cuda_device()
Returns a cuda_device_id for the current device.
Definition: cuda_device.hpp:86
int get_num_cuda_devices()
Returns the number of CUDA devices in the system.
Definition: cuda_device.hpp:98
bool operator==(cuda_stream_view lhs, cuda_stream_view rhs)
Equality comparison operator for streams.
Definition: cuda_stream_view.hpp:177
bool operator!=(cuda_stream_view lhs, cuda_stream_view rhs)
Inequality comparison operator for streams.
Definition: cuda_stream_view.hpp:189
Strong type for a CUDA device identifier.
Definition: cuda_device.hpp:33
constexpr cuda_device_id(value_type dev_id) noexcept
Construct a cuda_device_id from the specified integer value.
Definition: cuda_device.hpp:41
constexpr value_type value() const noexcept
The wrapped integer value.
Definition: cuda_device.hpp:44
int value_type
Integer type used for device identifier.
Definition: cuda_device.hpp:34
RAII class that sets the current CUDA device to the specified device on construction and restores the...
Definition: cuda_device.hpp:109
~cuda_set_device_raii() noexcept
Reactivates the previous CUDA device.
Definition: cuda_device.hpp:124
cuda_set_device_raii(cuda_device_id dev_id)
Construct a new cuda_set_device_raii object and sets the current CUDA device to dev_id
Definition: cuda_device.hpp:115