#include "gromacs/gmxlib/md_logging.h"
#include "gromacs/hardware/hardwaretopology.h"
#include "gromacs/hardware/hw_info.h"
-#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/utility/basenetwork.h"
#include "gromacs/utility/cstringutil.h"
gmx_set_thread_affinity(FILE *fplog,
const t_commrec *cr,
const gmx_hw_opt_t *hw_opt,
- const gmx::HardwareTopology &hwTop)
+ const gmx::HardwareTopology &hwTop,
+ int nthread_local)
{
- int thread0_id_node,
- nthread_local, nthread_node;
+ int thread0_id_node, nthread_node;
int * localityOrder = nullptr;
if (hw_opt->thread_affinity == threadaffOFF)
return;
}
- /* threads on this MPI process or TMPI thread */
- if (cr->duty & DUTY_PP)
- {
- nthread_local = gmx_omp_nthreads_get(emntNonbonded);
- }
- else
- {
- nthread_local = gmx_omp_nthreads_get(emntPME);
- }
-
/* map the current process to cores */
thread0_id_node = 0;
nthread_node = nthread_local;
gmx_set_thread_affinity(FILE *fplog,
const t_commrec *cr,
const gmx_hw_opt_t *hw_opt,
- const gmx::HardwareTopology &hwTop);
+ const gmx::HardwareTopology &hwTop,
+ int nthread_local);
/*! \brief
* Checks the process affinity mask and if it is found to be non-zero,
gmx_check_thread_affinity_set(fplog, cr,
hw_opt, hwinfo->nthreads_hw_avail, TRUE);
+ int nthread_local;
+ /* threads on this MPI process or TMPI thread */
+ if (cr->duty & DUTY_PP)
+ {
+ nthread_local = gmx_omp_nthreads_get(emntNonbonded);
+ }
+ else
+ {
+ nthread_local = gmx_omp_nthreads_get(emntPME);
+ }
+
/* Set the CPU affinity */
- gmx_set_thread_affinity(fplog, cr, hw_opt, *hwinfo->hardwareTopology);
+ gmx_set_thread_affinity(fplog, cr, hw_opt, *hwinfo->hardwareTopology,
+ nthread_local);
}
/* Initiate PME if necessary,