36 throw std::runtime_error(
"No valid ID for Host execution space!");
39 throw std::runtime_error(
"Invalid execution space!");
44 operator int()
const {
77 return m_id == other.m_id && m_space == other.m_space;
87 os <<
"(" << device.
id() <<
")";
96 template<
typename Stream>
100 template<
typename Stream>
106#if defined(TTG_HAVE_CUDA)
107#include <cuda_runtime.h>
110 using Stream = cudaStream_t;
112#elif defined(TTG_HAVE_HIP)
113#include <hip/hip_runtime.h>
116 using Stream = hipStream_t;
118#elif defined(TTG_HAVE_LEVEL_ZERO)
119#include <CL/sycl.hpp>
122 using Stream = std::add_reference_t<sycl::queue>;
139#if !defined(TTG_HAVE_LEVEL_ZERO)
166 return TTG_IMPL_NS::num_devices();
181 inline void set_current(
int device, sycl::queue& stream) {
Represents a device in a specific execution space.
Device(const Device &)=default
bool operator==(const Device &other) const
ttg::ExecutionSpace space() const
Device & operator=(const Device &)=default
Device(int id, ttg::ExecutionSpace space)
std::ostream & operator<<(std::ostream &os, ttg::device::Device device)
const char * execution_space_name(ExecutionSpace space) noexcept
thread_local ttg::device::Device current_device_ts
thread_local Stream current_stream_ts
void set_current(int device, Stream stream)
constexpr const Stream default_stream_v
constexpr ttg::ExecutionSpace available_execution_space
ExecutionSpace
denotes task execution space
static constexpr const Stream value