devices#
-
constexpr __all_devices cuda::devices = {}#
A range of all available CUDA devices.
cuda::devicesprovides 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
device
- Class synopsis
class __all_devices { // exposition only public: using size_type = ::std::size_t; struct iterator; using const_iterator = iterator; [[nodiscard]] device_ref operator[](size_type i) const noexcept; [[nodiscard]] size_type size() const; [[nodiscard]] iterator begin() const noexcept; [[nodiscard]] iterator end() const noexcept; };
__all_devices::iteratoris a random access iterator with areferencetype ofconst device_ref&.- Example
auto& dev0 = cuda::devices[0]; assert(cuda::devices.size() == cuda::std::distance(cuda::devices.begin(), cuda::devices.end()));