/home/runner/work/HiCR/HiCR/include/hicr/backends/hwloc/computeResource.hpp Source File
HiCR
|
computeResource.hpp
Go to the documentation of this file.
123 __INLINE__ physicalProcessorId_t getPhysicalProcessorId() const { return _physicalProcessorId; }
133 __INLINE__ static void detectThreadPUs(hwloc_topology_t topology, hwloc_obj_t obj, int depth, std::vector<logicalProcessorId_t> &threadPUs)
136 for (unsigned int i = 0; i < obj->arity; i++) detectThreadPUs(topology, obj->children[i], depth + 1, threadPUs);
146 __INLINE__ static logicalProcessorId_t detectLogicalProcessorId(hwloc_topology_t topology, const hwlocObjectIndex_t objectId)
149 if (!obj) HICR_THROW_RUNTIME("Attempting to access a compute resource that does not exist (%u) in this backend", objectId);
161 __INLINE__ static physicalProcessorId_t detectPhysicalProcessorId(hwloc_topology_t topology, const hwlocObjectIndex_t objectId)
164 if (!obj) HICR_THROW_RUNTIME("Attempting to access a compute resource that does not exist (%u) in this backend", objectId);
176 __INLINE__ static numaAffinity_t detectCoreNUMAffinity(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
181 if (!obj) HICR_THROW_RUNTIME("Attempting to access a compute resource that does not exist (%lu) in this backend", logicalProcessorId);
201 if (hwloc_obj_type_is_memory(nodeNUMA->type) && hwloc_bitmap_isset(obj->nodeset, nodeNUMA->os_index))
209 if (!found) HICR_THROW_RUNTIME("NUMA Domain not detected for compute resource (%lu)", logicalProcessorId);
228 __INLINE__ static std::unordered_set<std::shared_ptr<backend::hwloc::Cache>> detectCpuCaches(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
233 if (!obj) HICR_THROW_RUNTIME("Attempting to access a compute resource that does not exist (%lu) in this backend", logicalProcessorId);
245 if (cache->type == HWLOC_OBJ_L1CACHE || cache->type == HWLOC_OBJ_L2CACHE || cache->type == HWLOC_OBJ_L3CACHE || cache->type == HWLOC_OBJ_L4CACHE ||
297 __INLINE__ static numaAffinity_t getCpuNumaAffinity(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
302 if (!obj) HICR_THROW_RUNTIME("Attempting to access a compute resource that does not exist (%lu) in this backend", logicalProcessorId);
322 if (hwloc_obj_type_is_memory(nodeNUMA->type) && hwloc_bitmap_isset(obj->nodeset, nodeNUMA->os_index))
330 if (found == false) HICR_THROW_RUNTIME("NUMA Domain not detected for compute resource (%lu)", logicalProcessorId);
353 if (_type != "Processing Unit") HICR_THROW_LOGIC("The passed compute resource type '%s' is not compatible with this topology manager", _type.c_str());
356 if (input.contains(key) == false) HICR_THROW_LOGIC("The serialized object contains no '%s' key", key.c_str());
357 if (input[key].is_number() == false) HICR_THROW_LOGIC("The '%s' entry is not a number", key.c_str());
361 if (input.contains(key) == false) HICR_THROW_LOGIC("The serialized object contains no '%s' key", key.c_str());
362 if (input[key].is_number() == false) HICR_THROW_LOGIC("The '%s' entry is not a number", key.c_str());
366 if (input.contains(key) == false) HICR_THROW_LOGIC("The serialized object contains no '%s' key", key.c_str());
367 if (input[key].is_number() == false) HICR_THROW_LOGIC("The '%s' entry is not a number", key.c_str());
371 if (input.contains(key) == false) HICR_THROW_LOGIC("The serialized object contains no '%s' key", key.c_str());
372 if (input[key].is_array() == false) HICR_THROW_LOGIC("The '%s' entry is not an array", key.c_str());
Defines the Cache class for interacting with the host (CPUs) device type.
Definition computeResource.hpp:40
Definition computeResource.hpp:41
__INLINE__ void serializeImpl(nlohmann::json &output) const override
Definition computeResource.hpp:337
static __INLINE__ logicalProcessorId_t detectLogicalProcessorId(hwloc_topology_t topology, const hwlocObjectIndex_t objectId)
Definition computeResource.hpp:146
unsigned int hwlocObjectIndex_t
Definition computeResource.hpp:47
__INLINE__ void deserializeImpl(const nlohmann::json &input) override
Definition computeResource.hpp:350
ComputeResource(const hwlocObjectIndex_t hwlocObjectIndex, const logicalProcessorId_t logicalProcessorId, const physicalProcessorId_t physicalProcessorId, const numaAffinity_t numaAffinity, std::unordered_set< std::shared_ptr< backend::hwloc::Cache > > caches)
Definition computeResource.hpp:88
unsigned int logicalProcessorId_t
Definition computeResource.hpp:52
static __INLINE__ std::unordered_set< std::shared_ptr< backend::hwloc::Cache > > detectCpuCaches(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
Definition computeResource.hpp:228
unsigned int numaAffinity_t
Definition computeResource.hpp:62
ComputeResource()
Definition computeResource.hpp:108
ComputeResource(hwloc_topology_t topology, const hwlocObjectIndex_t hwlocObjectIndex)
Definition computeResource.hpp:69
unsigned int physicalProcessorId_t
Definition computeResource.hpp:57
static __INLINE__ physicalProcessorId_t detectPhysicalProcessorId(hwloc_topology_t topology, const hwlocObjectIndex_t objectId)
Definition computeResource.hpp:161
static __INLINE__ numaAffinity_t detectCoreNUMAffinity(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
Definition computeResource.hpp:176
__INLINE__ logicalProcessorId_t getProcessorId() const
Definition computeResource.hpp:115
__INLINE__ physicalProcessorId_t getPhysicalProcessorId() const
Definition computeResource.hpp:123
static __INLINE__ numaAffinity_t getCpuNumaAffinity(hwloc_topology_t topology, const logicalProcessorId_t logicalProcessorId)
Definition computeResource.hpp:297
~ComputeResource() override=default
static __INLINE__ void detectThreadPUs(hwloc_topology_t topology, hwloc_obj_t obj, int depth, std::vector< logicalProcessorId_t > &threadPUs)
Definition computeResource.hpp:133
Provides a base definition for a HiCR ComputeResource class.
Provides a failure model and corresponding exception classes.
Generated by