Gromacs  2022.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
basenetwork.h File Reference

Description

Utility functions for basic MPI and network functionality.

Functions

bool gmx_mpi_initialized ()
 Returns whether MPI has been initialized. More...
 
int gmx_node_num ()
 Returns the number of nodes. More...
 
int gmx_node_rank ()
 Returns the rank of the node. More...
 
int gmx_physicalnode_id_hash ()
 Return a non-negative hash that is, hopefully, unique for each physical node. More...
 
void gmx_broadcast_world (int size, void *buffer)
 Broadcasts given data from rank zero to all other ranks.
 
void gmx_abort (int errorno)
 Abort the parallel run.
 

Function Documentation

bool gmx_mpi_initialized ( )

Returns whether MPI has been initialized.

The return value is FALSE if MPI_Init() has not been called, or if GROMACS has been compiled without MPI support. For thread-MPI, returns TRUE when the threads have been started.

Note that there is a lot of code in between MPI_Init() and the thread-MPI thread start where the return value is different depending on compilation options.

int gmx_node_num ( )

Returns the number of nodes.

For thread-MPI, returns one before the threads have been started. This allows code between the real MPI_Init() and the thread-MPI "init" to still use this function to check for serial/parallel status and work as expected: for thread-MPI, at that point they should behave as if the run was serial.

int gmx_node_rank ( )

Returns the rank of the node.

For thread-MPI, returns zero before the threads have been started. This allows code between the real MPI_Init() and the thread-MPI "init" to still use this function to check for master node work as expected: for thread-MPI, at that point the only thread of execution should behave as if it the master node.

int gmx_physicalnode_id_hash ( )

Return a non-negative hash that is, hopefully, unique for each physical node.

This hash is useful for determining hardware locality.