Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
Realm::HardwareTopology Class Reference

Represents the topology of the host processor cores and memory. More...

#include <hardware_topology.h>

Classes

struct  MemoryInfo
 Represents memory information for a NUMA domain. More...
 
struct  Proc
 Represents a processor core with sharing relationships. More...
 

Public Types

typedef int ProcID
 A unique integer identifier for a processor.
 

Public Member Functions

 HardwareTopology (void)
 Constructs an empty HardwareTopology instance.
 
 HardwareTopology (const std::vector< Proc > &logical_cores, const std::vector< MemoryInfo > &memories, const size_t host_memory)
 Constructs a HardwareTopology instance.
 
 ~HardwareTopology (void)
 Destructor for HardwareTopology.
 
HardwareTopologyoperator= (const HardwareTopology &rhs)=default
 
void remove_hyperthreads (void)
 Removes hyperthreads from the topology.
 
size_t system_memory (void) const
 Returns the size of system memory in bytes.
 
unsigned num_logical_cores (void) const
 Returns the number of logical cores.
 
unsigned num_physical_cores (void) const
 Returns the number of physical cores.
 
unsigned num_numa_domains (void) const
 Returns the number of NUMA domains.
 
void get_logical_cores (std::set< ProcID > &cores) const
 Retrieves the set of logical core IDs.
 
bool has_processor (ProcID proc_id) const
 Checks if a processor exists in the topology.
 
bool numa_domain_has_processors (int domain_id) const
 Checks if a NUMA domain exists in the topology and has processors.
 
const std::set< ProcID > & get_processors_by_domain (int domain_id) const
 Gets the processors in a specific NUMA domain.
 
const std::set< ProcID > & get_processors_share_alu (ProcID proc_id) const
 Gets processors sharing an ALU with a specified processor.
 
const std::set< ProcID > & get_processors_share_fpu (ProcID proc_id) const
 Gets processors sharing an FPU with a specified processor.
 
const std::set< ProcID > & get_processors_share_ldst (ProcID proc_id) const
 Gets processors sharing LD/ST with a specified processor.
 
const std::set< ProcID > & get_kernel_processor_ids (ProcID proc_id) const
 Gets kernel processor IDs (usually assigned by OS) associated with a specified processor.
 
std::vector< ProcIDdistribute_processors_across_domains (void) const
 Distributes processors across NUMA domains.
 

Static Public Member Functions

static HardwareTopology create_topology (void)
 Creates a topology instance based on the system's hardware.
 

Friends

std::ostream & operator<< (std::ostream &os, const HardwareTopology &topo)
 Outputs the topology information to a stream.
 

Detailed Description

Represents the topology of the host processor cores and memory.

This class provides an abstraction for enumerating processor cores and the ways in which they share components (e.g., ALU, FPU, LD/ST). It also describes NUMA domains and memory information for optimal resource allocation.

Member Typedef Documentation

◆ ProcID

A unique integer identifier for a processor.

Constructor & Destructor Documentation

◆ HardwareTopology() [1/2]

Realm::HardwareTopology::HardwareTopology ( void  )

Constructs an empty HardwareTopology instance.

◆ HardwareTopology() [2/2]

Realm::HardwareTopology::HardwareTopology ( const std::vector< Proc > &  logical_cores,
const std::vector< MemoryInfo > &  memories,
const size_t  host_memory 
)

Constructs a HardwareTopology instance.

Parameters
logical_coresVector of logical cores in the system.
memoriesVector of memory information for the system.
host_memoryTotal host memory size.

◆ ~HardwareTopology()

Realm::HardwareTopology::~HardwareTopology ( void  )

Destructor for HardwareTopology.

Member Function Documentation

◆ create_topology()

static HardwareTopology Realm::HardwareTopology::create_topology ( void  )
static

Creates a topology instance based on the system's hardware.

Returns
A unique pointer to the created HardwareTopology instance.

◆ distribute_processors_across_domains()

std::vector< ProcID > Realm::HardwareTopology::distribute_processors_across_domains ( void  ) const

Distributes processors across NUMA domains.

Returns
A vector of processor IDs representing the distribution.

◆ get_kernel_processor_ids()

const std::set< ProcID > & Realm::HardwareTopology::get_kernel_processor_ids ( ProcID  proc_id) const

Gets kernel processor IDs (usually assigned by OS) associated with a specified processor.

Parameters
proc_idProcessor ID.
Returns
A set of kernel processor IDs.

◆ get_logical_cores()

void Realm::HardwareTopology::get_logical_cores ( std::set< ProcID > &  cores) const

Retrieves the set of logical core IDs.

Parameters
coresOutput parameter to store the set of logical core IDs.

◆ get_processors_by_domain()

const std::set< ProcID > & Realm::HardwareTopology::get_processors_by_domain ( int  domain_id) const

Gets the processors in a specific NUMA domain.

Parameters
domain_idNUMA domain ID.
Returns
A set of processor IDs in the domain.

◆ get_processors_share_alu()

const std::set< ProcID > & Realm::HardwareTopology::get_processors_share_alu ( ProcID  proc_id) const

Gets processors sharing an ALU with a specified processor.

Parameters
proc_idProcessor ID.
Returns
A set of processor IDs sharing the ALU.

◆ get_processors_share_fpu()

const std::set< ProcID > & Realm::HardwareTopology::get_processors_share_fpu ( ProcID  proc_id) const

Gets processors sharing an FPU with a specified processor.

Parameters
proc_idProcessor ID.
Returns
A set of processor IDs sharing the FPU.

◆ get_processors_share_ldst()

const std::set< ProcID > & Realm::HardwareTopology::get_processors_share_ldst ( ProcID  proc_id) const

Gets processors sharing LD/ST with a specified processor.

Parameters
proc_idProcessor ID.
Returns
A set of processor IDs sharing LD/ST.

◆ has_processor()

bool Realm::HardwareTopology::has_processor ( ProcID  proc_id) const

Checks if a processor exists in the topology.

Parameters
proc_idProcessor ID to check.
Returns
True if the processor exists, false otherwise.

◆ num_logical_cores()

unsigned Realm::HardwareTopology::num_logical_cores ( void  ) const

Returns the number of logical cores.

Returns
Number of logical cores.

◆ num_numa_domains()

unsigned Realm::HardwareTopology::num_numa_domains ( void  ) const

Returns the number of NUMA domains.

Returns
Number of NUMA domains.

◆ num_physical_cores()

unsigned Realm::HardwareTopology::num_physical_cores ( void  ) const

Returns the number of physical cores.

Returns
Number of physical cores.

◆ numa_domain_has_processors()

bool Realm::HardwareTopology::numa_domain_has_processors ( int  domain_id) const

Checks if a NUMA domain exists in the topology and has processors.

Parameters
domain_idNUMA domain ID to check.
Returns
True if the domain exists and has processors, false otherwise.

◆ operator=()

HardwareTopology & Realm::HardwareTopology::operator= ( const HardwareTopology rhs)
default

◆ remove_hyperthreads()

void Realm::HardwareTopology::remove_hyperthreads ( void  )

Removes hyperthreads from the topology.

◆ system_memory()

size_t Realm::HardwareTopology::system_memory ( void  ) const

Returns the size of system memory in bytes.

Returns
Size of system memory.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const HardwareTopology topo 
)
friend

Outputs the topology information to a stream.

Parameters
osOutput stream.
topoHardwareTopology instance.
Returns
The output stream.

The documentation for this class was generated from the following file: