Gromacs  2018.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
#include <cstdio>
#include "gromacs/utility/basedefinitions.h"
+ Include dependency graph for threadaffinity.h:

Description

Declares functions for managing mdrun thread affinity.

Functions

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 nthread_local, gmx::IThreadAffinityAccess *affinityAccess)
 Sets the thread affinity using the requested setting stored in hw_opt.
 
void gmx_check_thread_affinity_set (const gmx::MDLogger &mdlog, const t_commrec *cr, 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...
 

Function Documentation

void gmx_check_thread_affinity_set ( const gmx::MDLogger mdlog,
const t_commrec *  cr,
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.