Block-Structured AMR Software Framework
AMReX_ParallelDescriptor.H File Reference
#include <AMReX_Config.H>
#include <AMReX_ccse-mpi.H>
#include <AMReX_ParallelContext.H>
#include <AMReX_BLBackTrace.H>
#include <AMReX_BLProfiler.H>
#include <AMReX_BLassert.H>
#include <AMReX_Extension.H>
#include <AMReX_INT.H>
#include <AMReX_REAL.H>
#include <AMReX_GpuComplex.H>
#include <AMReX_Array.H>
#include <AMReX_Vector.H>
#include <AMReX_ValLocPair.H>
#include <AMReX_Box.H>
#include <algorithm>
#include <atomic>
#include <csignal>
#include <functional>
#include <limits>
#include <numeric>
#include <string>
#include <typeinfo>
#include <vector>

Go to the source code of this file.

Classes

class  amrex::ParallelDescriptor::Message
 Hold the description and status of communication data. More...
 
struct  amrex::ParallelDescriptor::ProcessTeam
 Provide functionalities needed to construct a team of processes to perform a particular job. More...
 
struct  amrex::ParallelDescriptor::Mpi_typemap< GpuComplex< T > >
 
struct  amrex::ParallelDescriptor::Mpi_typemap< ValLocPair< TV, TI > >
 

Namespaces

 amrex
 
 amrex::ParallelDescriptor
 Parallel frontend that abstracts functionalities needed to spawn processes and handle communication.
 
 amrex::ParallelDescriptor::detail
 

Functions

const std::string amrex::ParallelDescriptor::Unnamed ("Unnamed")
 Used as default argument to ParallelDescriptor::Barrier(). More...
 
void amrex::ParallelDescriptor::StartParallel (int *argc=nullptr, char ***argv=nullptr, MPI_Comm mpi_comm=MPI_COMM_WORLD)
 Perform any needed parallel initialization. This MUST be the first routine in this class called from within a program. More...
 
void amrex::ParallelDescriptor::Initialize ()
 
void amrex::ParallelDescriptor::Finalize ()
 
bool amrex::ParallelDescriptor::UseGpuAwareMpi ()
 
void amrex::ParallelDescriptor::StartTeams ()
 Split the process pool into teams. More...
 
void amrex::ParallelDescriptor::EndTeams ()
 
void amrex::ParallelDescriptor::EndParallel ()
 Perform any needed parallel finalization. This MUST be the last routine in this class called from within a program. More...
 
int amrex::ParallelDescriptor::MyProc () noexcept
 return the rank number local to the current Parallel Context More...
 
int amrex::ParallelDescriptor::MyProc (MPI_Comm comm) noexcept
 
int amrex::ParallelDescriptor::MinTag () noexcept
 
int amrex::ParallelDescriptor::MaxTag () noexcept
 
MPI_Comm amrex::ParallelDescriptor::Communicator () noexcept
 
int amrex::ParallelDescriptor::NProcsPerNode () noexcept
 
int amrex::ParallelDescriptor::MyRankInNode () noexcept
 
int amrex::ParallelDescriptor::NProcsPerProcessor () noexcept
 
int amrex::ParallelDescriptor::MyRankInProcessor () noexcept
 
int amrex::ParallelDescriptor::NProcs () noexcept
 return the number of MPI ranks local to the current Parallel Context More...
 
int amrex::ParallelDescriptor::NProcs (MPI_Comm comm) noexcept
 
int amrex::ParallelDescriptor::IOProcessorNumber () noexcept
 
bool amrex::ParallelDescriptor::IOProcessor () noexcept
 Is this CPU the I/O Processor? To get the rank number, call IOProcessorNumber() More...
 
int amrex::ParallelDescriptor::IOProcessorNumber (MPI_Comm comm) noexcept
 
bool amrex::ParallelDescriptor::IOProcessor (MPI_Comm comm) noexcept
 
int amrex::ParallelDescriptor::TeamSize () noexcept
 
int amrex::ParallelDescriptor::NTeams () noexcept
 
int amrex::ParallelDescriptor::MyTeamColor () noexcept
 
int amrex::ParallelDescriptor::MyTeamLead () noexcept
 
int amrex::ParallelDescriptor::MyRankInTeam () noexcept
 
int amrex::ParallelDescriptor::TeamLead (int rank) noexcept
 
bool amrex::ParallelDescriptor::isTeamLead () noexcept
 
bool amrex::ParallelDescriptor::sameTeam (int rank) noexcept
 
bool amrex::ParallelDescriptor::sameTeam (int rankA, int rankB) noexcept
 
int amrex::ParallelDescriptor::RankInLeadComm (int rank) noexcept
 
bool amrex::ParallelDescriptor::doTeamReduce () noexcept
 
const ProcessTeam & amrex::ParallelDescriptor::MyTeam () noexcept
 
std::pair< int, int > amrex::ParallelDescriptor::team_range (int begin, int end, int rit=-1, int nworkers=0) noexcept
 
template<typename F >
void amrex::ParallelDescriptor::team_for (int begin, int end, const F &f)
 
template<typename F >
void amrex::ParallelDescriptor::team_for (int begin, int end, int rit, const F &f)
 
template<typename F >
void amrex::ParallelDescriptor::team_for (int begin, int end, int rit, int nworkers, const F &f)
 
void amrex::ParallelDescriptor::Barrier (const std::string &)
 
void amrex::ParallelDescriptor::Barrier (const MPI_Comm &, const std::string &)
 
Message amrex::ParallelDescriptor::Abarrier ()
 
Message amrex::ParallelDescriptor::Abarrier (const MPI_Comm &)
 
void amrex::ParallelDescriptor::Test (MPI_Request &, int &, MPI_Status &)
 
void amrex::ParallelDescriptor::Test (Vector< MPI_Request > &, int &, Vector< MPI_Status > &)
 
void amrex::ParallelDescriptor::Comm_dup (MPI_Comm, MPI_Comm &)
 
void amrex::ParallelDescriptor::Abort (int errorcode=SIGABRT, bool backtrace=true)
 Abort with specified error code. More...
 
const char * amrex::ParallelDescriptor::ErrorString (int errorcode)
 ErrorString return string associated with error internal error condition. More...
 
double amrex::ParallelDescriptor::second () noexcept
 Returns wall-clock seconds since start of execution. More...
 
void amrex::ParallelDescriptor::ReduceBoolAnd (bool &rvar)
 And-wise boolean reduction. More...
 
void amrex::ParallelDescriptor::ReduceBoolAnd (bool &rvar, int cpu)
 And-wise boolean reduction to specified cpu. More...
 
void amrex::ParallelDescriptor::ReduceBoolOr (bool &rvar)
 Or-wise boolean reduction. More...
 
void amrex::ParallelDescriptor::ReduceBoolOr (bool &rvar, int cpu)
 Or-wise boolean reduction to specified cpu. More...
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealSum (T &rvar)
 Real sum reduction. More...
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealSum (T *rvar, int cnt)
 
void amrex::ParallelDescriptor::ReduceRealSum (Vector< std::reference_wrapper< Real > > const &)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealSum (Vector< std::reference_wrapper< T > > const &rvar)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealSum (T &rvar, int cpu)
 Real sum reduction to specified cpu. More...
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealSum (T *rvar, int cnt, int cpu)
 
void amrex::ParallelDescriptor::ReduceRealSum (Vector< std::reference_wrapper< Real > > const &, int)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealSum (Vector< std::reference_wrapper< T > > const &rvar, int cpu)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMax (T &rvar)
 Real max reduction. More...
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMax (T *rvar, int cnt)
 
void amrex::ParallelDescriptor::ReduceRealMax (Vector< std::reference_wrapper< Real > > const &)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMax (Vector< std::reference_wrapper< T > > const &rvar)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMax (T &rvar, int cpu)
 Real max reduction to specified cpu. More...
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMax (T *rvar, int cnt, int cpu)
 
void amrex::ParallelDescriptor::ReduceRealMax (Vector< std::reference_wrapper< Real > > const &, int)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMax (Vector< std::reference_wrapper< T > > const &rvar, int cpu)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMin (T &rvar)
 Real min reduction. More...
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMin (T *rvar, int cnt)
 
void amrex::ParallelDescriptor::ReduceRealMin (Vector< std::reference_wrapper< Real > > const &)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMin (Vector< std::reference_wrapper< T > > const &rvar)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMin (T &rvar, int cpu)
 Real min reduction to specified cpu. More...
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMin (T *rvar, int cnt, int cpu)
 
void amrex::ParallelDescriptor::ReduceRealMin (Vector< std::reference_wrapper< Real > > const &, int)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > amrex::ParallelDescriptor::ReduceRealMin (Vector< std::reference_wrapper< T > > const &rvar, int cpu)
 
void amrex::ParallelDescriptor::ReduceIntSum (int &rvar)
 Integer sum reduction. More...
 
void amrex::ParallelDescriptor::ReduceIntSum (int *, int)
 
void amrex::ParallelDescriptor::ReduceIntSum (Vector< std::reference_wrapper< int > > const &)
 
void amrex::ParallelDescriptor::ReduceIntSum (int &rvar, int cpu)
 Integer sum reduction to specified cpu. More...
 
void amrex::ParallelDescriptor::ReduceIntSum (int *, int, int)
 
void amrex::ParallelDescriptor::ReduceIntSum (Vector< std::reference_wrapper< int > > const &, int)
 
void amrex::ParallelDescriptor::ReduceIntMax (int &rvar)
 Integer max reduction. More...
 
void amrex::ParallelDescriptor::ReduceIntMax (int *, int)
 
void amrex::ParallelDescriptor::ReduceIntMax (Vector< std::reference_wrapper< int > > const &)
 
void amrex::ParallelDescriptor::ReduceIntMax (int &rvar, int cpu)
 Integer max reduction to specified cpu. More...
 
void amrex::ParallelDescriptor::ReduceIntMax (int *, int, int)
 
void amrex::ParallelDescriptor::ReduceIntMax (Vector< std::reference_wrapper< int > > const &, int)
 
void amrex::ParallelDescriptor::ReduceIntMin (int &rvar)
 Integer min reduction. More...
 
void amrex::ParallelDescriptor::ReduceIntMin (int *, int)
 
void amrex::ParallelDescriptor::ReduceIntMin (Vector< std::reference_wrapper< int > > const &)
 
void amrex::ParallelDescriptor::ReduceIntMin (int &rvar, int cpu)
 Integer min reduction to specified cpu. More...
 
void amrex::ParallelDescriptor::ReduceIntMin (int *, int, int)
 
void amrex::ParallelDescriptor::ReduceIntMin (Vector< std::reference_wrapper< int > > const &, int)
 
void amrex::ParallelDescriptor::ReduceLongSum (Long &rvar)
 Long sum reduction. More...
 
void amrex::ParallelDescriptor::ReduceLongSum (Long *, int)
 
void amrex::ParallelDescriptor::ReduceLongSum (Vector< std::reference_wrapper< Long > > const &)
 
void amrex::ParallelDescriptor::ReduceLongSum (Long &rvar, int cpu)
 Long sum reduction to specified cpu. More...
 
void amrex::ParallelDescriptor::ReduceLongSum (Long *, int, int)
 
void amrex::ParallelDescriptor::ReduceLongSum (Vector< std::reference_wrapper< Long > > const &, int)
 
void amrex::ParallelDescriptor::ReduceLongMax (Long &rvar)
 Long max reduction. More...
 
void amrex::ParallelDescriptor::ReduceLongMax (Long *, int)
 
void amrex::ParallelDescriptor::ReduceLongMax (Vector< std::reference_wrapper< Long > > const &)
 
void amrex::ParallelDescriptor::ReduceLongMax (Long &rvar, int cpu)
 Long max reduction to specified cpu. More...
 
void amrex::ParallelDescriptor::ReduceLongMax (Long *, int, int)
 
void amrex::ParallelDescriptor::ReduceLongMax (Vector< std::reference_wrapper< Long > > const &, int)
 
void amrex::ParallelDescriptor::ReduceLongMin (Long &rvar)
 Long min reduction. More...
 
void amrex::ParallelDescriptor::ReduceLongMin (Long *, int)
 
void amrex::ParallelDescriptor::ReduceLongMin (Vector< std::reference_wrapper< Long > > const &)
 
void amrex::ParallelDescriptor::ReduceLongMin (Long &rvar, int cpu)
 Long min reduction to specified cpu. More...
 
void amrex::ParallelDescriptor::ReduceLongMin (Long *, int, int)
 
void amrex::ParallelDescriptor::ReduceLongMin (Vector< std::reference_wrapper< Long > > const &, int)
 
void amrex::ParallelDescriptor::ReduceLongAnd (Long &rvar)
 Long and-wise reduction. More...
 
void amrex::ParallelDescriptor::ReduceLongAnd (Long *, int)
 
void amrex::ParallelDescriptor::ReduceLongAnd (Vector< std::reference_wrapper< Long > > const &)
 
void amrex::ParallelDescriptor::ReduceLongAnd (Long &rvar, int cpu)
 Long and-wise reduction to specified cpu. More...
 
void amrex::ParallelDescriptor::ReduceLongAnd (Long *, int, int)
 
void amrex::ParallelDescriptor::ReduceLongAnd (Vector< std::reference_wrapper< Long > > const &, int)
 
void amrex::ParallelDescriptor::Gather (Real const *sendbuf, int nsend, Real *recvbuf, int root)
 Parallel gather. More...
 
int amrex::ParallelDescriptor::SeqNum () noexcept
 Returns sequential message sequence numbers, usually used as tags for send/recv. More...
 
template<class T >
Message amrex::ParallelDescriptor::Asend (const T *, size_t n, int pid, int tag)
 
template<class T >
Message amrex::ParallelDescriptor::Asend (const T *, size_t n, int pid, int tag, MPI_Comm comm)
 
template<class T >
Message amrex::ParallelDescriptor::Asend (const std::vector< T > &buf, int pid, int tag)
 
template<class T >
Message amrex::ParallelDescriptor::Arecv (T *, size_t n, int pid, int tag)
 
template<class T >
Message amrex::ParallelDescriptor::Arecv (T *, size_t n, int pid, int tag, MPI_Comm comm)
 
template<class T >
Message amrex::ParallelDescriptor::Arecv (std::vector< T > &buf, int pid, int tag)
 
template<class T >
Message amrex::ParallelDescriptor::Send (const T *buf, size_t n, int dst_pid, int tag)
 
template<class T >
Message amrex::ParallelDescriptor::Send (const T *buf, size_t n, int dst_pid, int tag, MPI_Comm comm)
 
template<class T >
Message amrex::ParallelDescriptor::Send (const std::vector< T > &buf, int dst_pid, int tag)
 
template<class T >
Message amrex::ParallelDescriptor::Recv (T *, size_t n, int pid, int tag)
 
template<class T >
Message amrex::ParallelDescriptor::Recv (T *, size_t n, int pid, int tag, MPI_Comm comm)
 
template<class T >
Message amrex::ParallelDescriptor::Recv (std::vector< T > &buf, int pid, int tag)
 
template<class T >
void amrex::ParallelDescriptor::Bcast (T *, size_t n, int root=0)
 
template<class T >
void amrex::ParallelDescriptor::Bcast (T *, size_t n, int root, const MPI_Comm &comm)
 
void amrex::ParallelDescriptor::Bcast (void *, int, MPI_Datatype, int, MPI_Comm)
 
template<class T , class T1 >
void amrex::ParallelDescriptor::Scatter (T *, size_t n, const T1 *, size_t n1, int root)
 
template<class T , class T1 >
void amrex::ParallelDescriptor::Gather (const T *, size_t n, T1 *, size_t n1, int root)
 
template<class T >
std::vector< T > amrex::ParallelDescriptor::Gather (const T &, int root)
 
template<class T >
void amrex::ParallelDescriptor::Gatherv (const T *send, int sc, T *recv, const std::vector< int > &rc, const std::vector< int > &disp, int root)
 
template<class T >
void amrex::ParallelDescriptor::GatherLayoutDataToVector (const LayoutData< T > &sendbuf, Vector< T > &recvbuf, int root)
 Gather LayoutData values to a vector on root. More...
 
void amrex::ParallelDescriptor::Wait (MPI_Request &, MPI_Status &)
 
void amrex::ParallelDescriptor::Waitall (Vector< MPI_Request > &, Vector< MPI_Status > &)
 
void amrex::ParallelDescriptor::Waitany (Vector< MPI_Request > &, int &, MPI_Status &)
 
void amrex::ParallelDescriptor::Waitsome (Vector< MPI_Request > &, int &, Vector< int > &, Vector< MPI_Status > &)
 
void amrex::ParallelDescriptor::ReadAndBcastFile (const std::string &filename, Vector< char > &charBuf, bool bExitOnError, const MPI_Comm &comm)
 
void amrex::ParallelDescriptor::IProbe (int, int, int &, MPI_Status &)
 
void amrex::ParallelDescriptor::IProbe (int, int, MPI_Comm, int &, MPI_Status &)
 
std::string amrex::ParallelDescriptor::mpi_level_to_string (int mtlev)
 
template<typename T >
void amrex::ParallelDescriptor::detail::DoAllReduce (T *r, MPI_Op op, int cnt)
 
template<typename T >
void amrex::ParallelDescriptor::detail::DoReduce (T *r, MPI_Op op, int cnt, int cpu)
 
template<typename T , typename F >
MPI_Op amrex::ParallelDescriptor::Mpi_op ()