Gromacs
2025-dev-20240910-a7e2421
|
Functions | |
void | translateCpuInfoLogicalProcessorsToMachine (const std::vector< CpuInfo::LogicalProcessor > &logicalProcessors, HardwareTopology::Machine *machine) |
Utlility function to renumber and translate low-level APIC info to topology. More... | |
HardwareTopology::SupportLevel | parseCpuInfo (HardwareTopology::Machine *machine) |
Initialize machine data from basic information in cpuinfo. More... | |
int | detectLogicalProcessorCount () |
Try to detect the number of logical processors. More... | |
std::vector< int > | parseCpuString (const std::string &cpuString) |
Parse cpu list (integers) from string separated by commas and ranges. More... | |
HardwareTopology::SupportLevel | parseSysFsCpuTopology (HardwareTopology::Machine *machine, const std::string &root="", const std::vector< int > &allowedCpus={}) |
Attempt to read basic topology from Linux sysfs interface. More... | |
std::string | findCgroupPath (const std::vector< std::string > &mountPoints, const std::vector< std::string > &subGroups, const std::string &root) |
Find the active cgroup path for the current process. More... | |
float | parseCgroup1CpuLimit (const std::vector< std::string > &mountPoints, const std::string &root="") |
Parse cpu limits from cgroup version 1 file system on Linux. More... | |
float | parseCgroup2CpuLimit (const std::vector< std::string > &mountPoints, const std::string &root="") |
Parse cpu limits from cgroup version 2 file system on Linux. More... | |
float | detectCpuLimit (const std::string &root="") |
int | setMaxThreads (float cpuLimit, int topologyCpus, int systemCpus) |
int gmx::anonymous_namespace{hardwaretopology.cpp}::detectLogicalProcessorCount | ( | ) |
Try to detect the number of logical processors.
std::string gmx::anonymous_namespace{hardwaretopology.cpp}::findCgroupPath | ( | const std::vector< std::string > & | mountPoints, |
const std::vector< std::string > & | subGroups, | ||
const std::string & | root | ||
) |
Find the active cgroup path for the current process.
mountPoints | List of potential mount points |
subGroups | List of potential subgroup paths |
root | Optional mock root for creating topologies from saved data. If provided, all paths will be relative to this mock root. |
This routine will attempt to detect the path to the cgroup that's active for the present process by searching for our own process id in the cgroups.procs file in each combination of mountPoint and subGroup.
float gmx::anonymous_namespace{hardwaretopology.cpp}::parseCgroup1CpuLimit | ( | const std::vector< std::string > & | mountPoints, |
const std::string & | root = "" |
||
) |
Parse cpu limits from cgroup version 1 file system on Linux.
mountPoints | Top-level mount point for cgroups1 |
root | Optional mock root for creating topologies from saved data. If provided, all paths will be relative to this mock root. |
float gmx::anonymous_namespace{hardwaretopology.cpp}::parseCgroup2CpuLimit | ( | const std::vector< std::string > & | mountPoints, |
const std::string & | root = "" |
||
) |
Parse cpu limits from cgroup version 2 file system on Linux.
mountPoints | Top-level mount point for cgroups2 |
root | Optional mock root for creating topologies from saved data. If provided, all paths will be relative to this mock root. |
HardwareTopology::SupportLevel gmx::anonymous_namespace{hardwaretopology.cpp}::parseCpuInfo | ( | HardwareTopology::Machine * | machine | ) |
Initialize machine data from basic information in cpuinfo.
machine | Machine tree structure where information will be assigned if the cpuinfo object contains topology information. |
std::vector<int> gmx::anonymous_namespace{hardwaretopology.cpp}::parseCpuString | ( | const std::string & | cpuString | ) |
Parse cpu list (integers) from string separated by commas and ranges.
cpuString | String with integers in the standard linux cpulist format, i.e. integers and integer ranges (specified with dashes) separated by commas like "0,3-5,7,8,10-15". If the string is ill-formed, or If any integer is negative or the indices are not strictly increasing, we return an empty vector. |
HardwareTopology::SupportLevel gmx::anonymous_namespace{hardwaretopology.cpp}::parseSysFsCpuTopology | ( | HardwareTopology::Machine * | machine, |
const std::string & | root = "" , |
||
const std::vector< int > & | allowedCpus = {} |
||
) |
Attempt to read basic topology from Linux sysfs interface.
machine | Pointer to machine structure in topology to be populated |
root | Optional path to (mock) file system root. If this is provided, all file system access will be relative to this path instead. This allows us to create mock topologies based on saved data. |
allowedCpus | When creating mock topologies by setting the root parameter, we will not attempt to check if we can run on processors based on cpuset affinity masks, but you should use this parameter to provide a vector of logical (OS) processor indices on which we are allowed to run. |
This is a poor man's version of the much fancier topology detection available from hwloc, but given the compilcations of modern hardware we are critically dependent on being able to understand at least how many sockets/cores/threads we have, even when Gromacs is compiled without hwloc support.
void gmx::anonymous_namespace{hardwaretopology.cpp}::translateCpuInfoLogicalProcessorsToMachine | ( | const std::vector< CpuInfo::LogicalProcessor > & | logicalProcessors, |
HardwareTopology::Machine * | machine | ||
) |
Utlility function to renumber and translate low-level APIC info to topology.
logicalProcessors | Logical processor information according to the CpuInfo structure. Note that the indices refer to low-level hardware, so they will be renumbered to only consider logical cores/processing units we use. |
machine | Hardware topology machine structure where result is written. |