/home/runner/work/HiCR/HiCR/include/hicr/core/device.hpp Source File
HiCR
|
device.hpp
Go to the documentation of this file.
92 __INLINE__ void addComputeResource(const std::shared_ptr<HiCR::ComputeResource> &computeResource) { _computeResources.push_back(computeResource); }
99 __INLINE__ void addMemorySpace(const std::shared_ptr<HiCR::MemorySpace> &memorySpace) { _memorySpaces.push_back(memorySpace); }
134 for (const auto &computeResource : _computeResources) output[_HICR_DEVICE_COMPUTE_RESOURCES_KEY_] += computeResource->serialize();
138 for (const auto &memorySpace : _memorySpaces) output[_HICR_DEVICE_MEMORY_SPACES_KEY_] += memorySpace->serialize();
160 HICR_THROW_LOGIC("Serialized device information is invalid, as it lacks the '%s' entry", _HICR_DEVICE_COMPUTE_RESOURCES_KEY_);
162 HICR_THROW_LOGIC("Serialized device information is invalid, as '%s' entry is not an array.", _HICR_DEVICE_COMPUTE_RESOURCES_KEY_);
165 if (c.contains("Type") == false) HICR_THROW_LOGIC("In '%s', entry information is invalid, as it lacks the 'Type' entry", _HICR_DEVICE_COMPUTE_RESOURCES_KEY_);
167 HICR_THROW_LOGIC("In '%s', entry information information is invalid, as the 'Type' entry is not a string", _HICR_DEVICE_COMPUTE_RESOURCES_KEY_);
171 HICR_THROW_LOGIC("Serialized device information is invalid, as it lacks the '%s' entry", _HICR_DEVICE_MEMORY_SPACES_KEY_);
173 HICR_THROW_LOGIC("Serialized device information is invalid, as '%s' entry is not an array.", _HICR_DEVICE_MEMORY_SPACES_KEY_);
176 if (c.contains("Type") == false) HICR_THROW_LOGIC("In '%s', entry information is invalid, as it lacks the 'Type' entry", _HICR_DEVICE_MEMORY_SPACES_KEY_);
178 HICR_THROW_LOGIC("In '%s', entry information information is invalid, as the 'Type' entry is not a string", _HICR_DEVICE_MEMORY_SPACES_KEY_);
186 HICR_THROW_LOGIC("Deserialization failed, as the number of compute resources created (%lu) differs from the ones provided in the serialized input (%lu)",
190 HICR_THROW_LOGIC("Deserialization failed, as the number of memory spaces created (%lu) differs from the ones provided in the serialized input (%lu)",
Definition device.hpp:53
virtual ~Device()=default
Device(computeResourceList_t computeResources, memorySpaceList_t memorySpaces)
Definition device.hpp:112
__INLINE__ const memorySpaceList_t & getMemorySpaceList()
Definition device.hpp:85
virtual void serializeImpl(nlohmann::json &output) const =0
__INLINE__ void deserialize(const nlohmann::json &input)
Definition device.hpp:152
std::vector< std::shared_ptr< ComputeResource > > computeResourceList_t
Definition device.hpp:59
virtual std::string getType() const =0
std::vector< std::shared_ptr< MemorySpace > > memorySpaceList_t
Definition device.hpp:64
virtual void deserializeImpl(const nlohmann::json &input)=0
Device()=default
__INLINE__ void addMemorySpace(const std::shared_ptr< HiCR::MemorySpace > &memorySpace)
Definition device.hpp:99
__INLINE__ void addComputeResource(const std::shared_ptr< HiCR::ComputeResource > &computeResource)
Definition device.hpp:92
__INLINE__ const computeResourceList_t & getComputeResourceList()
Definition device.hpp:78
Provides a base definition for a HiCR ComputeResource class.
constexpr std::string_view _HICR_DEVICE_MEMORY_SPACES_KEY_
Definition device.hpp:40
constexpr std::string_view _HICR_DEVICE_COMPUTE_RESOURCES_KEY_
Definition device.hpp:35
Provides a base definition for a HiCR MemorySpace class.
Generated by