Functions

baton.c File Reference

Stage independent processes by passing a baton. More...

Go to the source code of this file.

Functions

void baton_start (const int Nb, const int tag)
 This function starts off a "Baton Passing" scheme for regulating the maximum number of processes active at a given moment.
void baton_stop (const int Nb, const int tag)
 This function marks the end of a section of code which is regulated by "Baton Passing".

Detailed Description

Stage independent processes by passing a baton.

PURPOSE: Stage independent processes by passing a baton. The functions here assume that no MPI communication will proceed between baton_start() and baton_stop() and that the arguments to the functions will be identical. This is easy enough to accomplish, but can be error prone. Use these functions with caution!

These functions were written and added to athena by T. A. Gardiner in March, 2008.

CONTAINS PUBLIC FUNCTIONS:

Definition in file baton.c.


Function Documentation

void baton_start ( const int  Nb,
const int  tag 
)

This function starts off a "Baton Passing" scheme for regulating the maximum number of processes active at a given moment.

NOTES on baton_start() and baton_stop():

The values for Nb and tag MUST be the same in the call to baton_start() and in baton_stop().

  • Nb -> Number of Batons = max number of ranks in action at a given time.
  • tag -> MPI message tag to use for this baton passing.

This function starts off a "Baton Passing" scheme for regulating the maximum number of processes active at a given moment. It works by handing out Nb batons to the first (0 -> Nb-1) ranks. Then ranks (Nb -> 2Nb-1) wait for a signal from the ranks (0 -> Nb-1) which is sent by the baton_stop() function and so the process continues until all of the MPI ranks have completed.

Definition at line 46 of file baton.c.

References ath_error().

Referenced by change_rundir().

Here is the call graph for this function:

Here is the caller graph for this function:

void baton_stop ( const int  Nb,
const int  tag 
)

This function marks the end of a section of code which is regulated by "Baton Passing".

It signals the next process to start, i.e. it hands off the Baton.

Definition at line 76 of file baton.c.

References ath_error().

Referenced by change_rundir().

Here is the call graph for this function:

Here is the caller graph for this function: