cuda::experimental::device_ref

Defined in /home/runner/work/cccl/cccl/cudax/include/cuda/experimental/__device/device_ref.cuh

class device_ref

A non-owning representation of a CUDA device.

Subclassed by cuda::experimental::device

Public Functions

inline constexpr device_ref(int __id) noexcept

Create a device_ref object from a native device ordinal.

inline constexpr int get() const noexcept

Retrieve the native ordinal of the device_ref

Returns

int The native device ordinal held by the device_ref object

inline constexpr bool operator==(device_ref __lhs, device_ref __rhs) noexcept

Compares two device_refs for equality.

Note

Allows comparison with int due to implicit conversion to device_ref.

Parameters
Returns

true if lhs and rhs refer to the same device ordinal

template<typename _Attr>
inline auto attr(_Attr __attr) const

Retrieve the specified attribute for the device.

See also

device::attrs

Parameters

__attr – The attribute to query. See device::attrs for the available attributes.

Throws

cuda_error – if the attribute query fails

template<::cudaDeviceAttr _Attr>
inline auto attr() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

inline const arch_traits_t &arch_traits() const