Gromacs
2020.4
|
Declares functions for managing mdrun thread affinity.
Functions | |
void | analyzeThreadsOnThisNode (const gmx::PhysicalNodeCommunicator &physicalNodeComm, int numThreadsOnThisRank, int *numThreadsOnThisNode, int *intraNodeThreadOffset) |
Communicates within physical nodes to discover the distribution of threads over ranks. | |
void | gmx_set_thread_affinity (const gmx::MDLogger &mdlog, const t_commrec *cr, const gmx_hw_opt_t *hw_opt, const gmx::HardwareTopology &hwTop, int numThreadsOnThisRank, int numThreadsOnThisNode, int intraNodeThreadOffset, gmx::IThreadAffinityAccess *affinityAccess) |
Sets the thread affinity using the requested setting stored in hw_opt. More... | |
void | gmx_check_thread_affinity_set (const gmx::MDLogger &mdlog, gmx_hw_opt_t *hw_opt, int ncpus, gmx_bool bAfterOpenmpInit) |
Checks the process affinity mask and if it is found to be non-zero, will honor it and disable mdrun internal affinity setting. More... | |
void gmx_check_thread_affinity_set | ( | const gmx::MDLogger & | mdlog, |
gmx_hw_opt_t * | hw_opt, | ||
int | ncpus, | ||
gmx_bool | bAfterOpenmpInit | ||
) |
Checks the process affinity mask and if it is found to be non-zero, will honor it and disable mdrun internal affinity setting.
This function should be called first before the OpenMP library gets initialized with the last argument FALSE (which will detect affinity set by external tools like taskset), and later, after the OpenMP initialization, with the last argument TRUE to detect affinity changes made by the OpenMP library.
Note that this will only work on Linux as we use a GNU feature. With bAfterOpenmpInit false, it will also detect whether OpenMP environment variables for setting the affinity are set.
void gmx_set_thread_affinity | ( | const gmx::MDLogger & | mdlog, |
const t_commrec * | cr, | ||
const gmx_hw_opt_t * | hw_opt, | ||
const gmx::HardwareTopology & | hwTop, | ||
int | numThreadsOnThisRank, | ||
int | numThreadsOnThisNode, | ||
int | intraNodeThreadOffset, | ||
gmx::IThreadAffinityAccess * | affinityAccess | ||
) |
Sets the thread affinity using the requested setting stored in hw_opt.
See analyzeThreadsOnThisNode(), which prepares some of the input.
[out] | mdlog | Logger. |
[in] | cr | Communication handler. |
[in] | hw_opt | Accesses user choices for thread affinity handling. |
[in] | hwTop | Detected hardware topology. |
[in] | numThreadsOnThisRank | The number of threads on this rank. |
[in] | numThreadsOnThisNode | The number of threads on all ranks of this node. |
[in] | intraNodeThreadOffset | The index of the first hardware thread of this rank in the set of all the threads of all MPI ranks within a node (ordered by MPI rank ID). |
[in] | affinityAccess | Interface for low-level access to affinity details. |