Gromacs  2026.0-dev-20241204-d69d709
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
#include <cstdio>
#include <vector>
#include "gromacs/ewald/pme.h"
#include "gromacs/utility/basedefinitions.h"
+ Include dependency graph for resourcedivision.h:
+ This graph shows which files directly or indirectly include this file:

Description

Declares utility functionality for dividing resources and checking for consistency and usefulness.

Author
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Functions

int get_nthreads_mpi (const gmx_hw_info_t *hwinfo, gmx_hw_opt_t *hw_opt, int numDevicesToUse, bool nonbondedOnGpu, bool pmeOnGpu, const t_inputrec *inputrec, const gmx_mtop_t &mtop, const gmx::MDLogger &mdlog, bool doMembed)
 Return the number of threads to use for thread-MPI based on how many were requested, which algorithms we're using, and how many particles there are. At the point we have already called check_and_update_hw_opt. Thus all options should be internally consistent and consistent with the hardware, except that ntmpi could be larger than number of GPUs. If necessary, this function will modify hw_opt->nthreads_omp.
 
void check_resource_division_efficiency (const gmx_hw_info_t *hwinfo, bool willUsePhysicalGpu, t_commrec *cr, const gmx::MDLogger &mdlog)
 Check if the number of OpenMP threads is within reasonable range considering the hardware used. This is a crude check, but mainly intended to catch cases where the user starts 1 MPI rank per hardware thread or 1 rank per physical node. With a sub-optimal setup a note is printed to fplog and stderr. This function should be called after thread-MPI and OpenMP are set up.
 
void checkAndUpdateHardwareOptions (const gmx::MDLogger &mdlog, gmx_hw_opt_t *hw_opt, bool isSimulationMainRank, int nPmeRanks, const t_inputrec *inputrec)
 Checks what our hardware options are based on how Gromacs was compiled and user-set options. More...
 
void checkAndUpdateRequestedNumOpenmpThreads (gmx_hw_opt_t *hw_opt, const gmx_hw_info_t &hwinfo, const t_commrec *cr, const gmx_multisim_t *ms, int numRanksOnThisNode, PmeRunMode pmeRunMode, const gmx_mtop_t &mtop, const t_inputrec &inputrec)
 Check, and if necessary update, the number of OpenMP threads requested. More...
 
void gmx::checkHardwareOversubscription (int numThreadsOnThisRank, int rank, const HardwareTopology &hwTop, const PhysicalNodeCommunicator &comm, const MDLogger &mdlog)
 Warns for oversubscribing the hardware threads, when that is the case.
 

Function Documentation

void checkAndUpdateHardwareOptions ( const gmx::MDLogger mdlog,
gmx_hw_opt_t hw_opt,
bool  isSimulationMainRank,
int  nPmeRanks,
const t_inputrec *  inputrec 
)

Checks what our hardware options are based on how Gromacs was compiled and user-set options.

Parameters
[in]mdlogLogger
[in,out]hw_optHardware-related and threading options
[in]isSimulationMainRank
[in]nPmeRanksNumber of PME ranks
[in]inputrecThe input record, should point to a valid object when isSimulationMainRank = true
void checkAndUpdateRequestedNumOpenmpThreads ( gmx_hw_opt_t hw_opt,
const gmx_hw_info_t &  hwinfo,
const t_commrec *  cr,
const gmx_multisim_t ms,
int  numRanksOnThisNode,
PmeRunMode  pmeRunMode,
const gmx_mtop_t &  mtop,
const t_inputrec &  inputrec 
)

Check, and if necessary update, the number of OpenMP threads requested.

Should be called when we know the MPI rank count and PME run mode.