cuda::experimental::devices
Defined in include/cuda/experimental/__device/all_devices.cuh
-
constexpr detail::all_devices cuda::experimental::devices = {}
A range of all available CUDA devices.
cuda::devices
provides a view of all available CUDA devices. It is useful for determining the number of supported devices and for iterating over all devices in a range-based for loop (e.g., to print device properties, perhaps).See also
- Class synopsis
class __all_devices { // exposition only public: using size_type = ::std::size_t; struct iterator; using const_iterator = iterator; [[nodiscard]] constexpr const device& operator[](size_type i) const noexcept; [[nodiscard]] size_type size() const; [[nodiscard]] iterator begin() const noexcept; [[nodiscard]] iterator end() const noexcept; };
__all_devices::iterator
is a random access iterator with areference
type ofconst device&
.- Example
auto& dev0 = cuda::devices[0]; assert(cuda::devices.size() == cuda::std::distance(cuda::devices.begin(), cuda::devices.end()));