Struct GpuInfo¶
Defined in File gpu_info.hpp
Struct Documentation¶
-
struct
ripple
::
GpuInfo
¶ The GpuInfo struct stores information about the gpu.
Public Types
-
using
Index
= uint32_t¶ Type used for the device index.
-
using
StreamContainer
= std::array<Stream, total_streams>¶ Type of container for streams for the device.
-
using
Id
= uint8_t¶ Defines the type used for stream ids for a gpu.
Public Functions
-
GpuInfo
(Index idx) noexcept¶ Constructor to initialise the info with a specific index.
- Parameters
idx
: The index of the gpu for the info.
-
~GpuInfo
() noexcept¶ Destructor which cleans up the streams.
-
auto
is_invalid
() const noexcept -> bool¶ Determines if the info is invalid.
- Return
true if the index matches the invalid index.
-
auto
peer_to_peer_available
() const noexcept -> bool¶ Determines if the gpu has any peer to peer access with another device.
- Return
true if the gpu can directly access any other gpu’s memory.
-
auto
peer_to_peer_available
(Index other_id) const noexcept -> bool¶ R Determines if this gpu can directly access the memory of the gpu with the given index.
- Return
true if this gpu can directly access the other gpu’s memory.
- Parameters
other_id
: The index of the other gpu to check peer access with.
-
auto
next_compute_stream_id
() noexcept -> Id¶ Gets the id of the next compute stream for the device.
- Return
The id of the next compute stream for the device.
-
auto
next_transfer_stream_id
() noexcept -> Id¶ Gets the id of the next transfer stream for the device.
- Return
The id of the next transfer stream for the device.
-
auto
synchronize_streams
() const noexcept -> void¶ Synchronizes all streams for the GPU.
-
auto
prepare_barrier
() noexcept -> void¶ Prepares he barrier for asynchronous execution, setting that the barrier is up and should be waited on.
This will then be set as down once the barrier is executed.
-
auto
execute_barrier
() noexcept -> void¶ Creates a barrier on all accelerators, blocking until the device is synchronized.
-
auto
is_barrier_down
() const noexcept -> bool¶ Returns true if the barrier is down.
Public Members
-
StreamContainer
streams
= {}¶ Streams for the device.
-
PeerContainer
peers
= {}¶ Default to no peers.
-
uint64_t
mem_size
= 0¶ Amount of memory for the device.
-
uint64_t
mem_alloc
= 0¶ Amount of device memory.
-
bool
barrier_up
= false¶ If the barrier is up.
-
uint8_t
pad
[padding_size
]¶ Padding for false sharing.
Public Static Functions
-
auto
create_for_all_devices
() -> std::vector<GpuInfo>¶ Creates the information for all gpus in the system.
- Return
A vector of information for all the system gpus.
-
auto
device_count
() noexcept -> uint32_t¶ Gets the total number of gpus detected in the system.
- Return
The number of devices in the system.
Public Static Attributes
-
constexpr size_t
compute_streams
= 1¶ The number of streams for the gpu.
-
constexpr size_t
transfer_streams
= 2¶ The number of transfer streams for the gpu.
-
constexpr size_t
total_streams
= compute_streams + transfer_streams¶ The total number of streams for the gpu.
-
constexpr size_t
padding_size
= avoid_false_sharing_size - ((sizeof(PeerContainer) + sizeof(Index) + sizeof(uint64_t) + sizeof(uint64_t) + sizeof(uint8_t) + sizeof(uint8_t) + sizeof(bool) + sizeof(StreamContainer)) % avoid_false_sharing_size)¶ The amount of padding to avoid false sharing.
-
using