Gromacs
2016.5
|
#include <cstdio>
#include "gromacs/hardware/hw_info.h"
#include "gromacs/utility/basedefinitions.h"
Declares functions for managing mdrun thread affinity.
Functions | |
void | gmx_set_thread_affinity (FILE *fplog, const t_commrec *cr, const gmx_hw_opt_t *hw_opt, const gmx_hw_info_t *hwinfo) |
Sets the thread affinity using the requested setting stored in hw_opt. More... | |
void | gmx_check_thread_affinity_set (FILE *fplog, 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... | |
void gmx_check_thread_affinity_set | ( | FILE * | fplog, |
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.
void gmx_set_thread_affinity | ( | FILE * | fplog, |
const t_commrec * | cr, | ||
const gmx_hw_opt_t * | hw_opt, | ||
const gmx_hw_info_t * | hwinfo | ||
) |
Sets the thread affinity using the requested setting stored in hw_opt.
The hardware topology is requested from hwinfo, when present.