IOSS 2.0
Loading...
Searching...
No Matches
Ioss::ParallelUtils Class Reference

#include <Ioss_ParallelUtils.h>

Public Types

enum  MinMax { DO_MAX , DO_MIN , DO_SUM }
 

Public Member Functions

 ParallelUtils ()=default
 
 ParallelUtils (Ioss_MPI_Comm the_communicator)
 
void add_environment_properties (Ioss::PropertyManager &properties)
 
bool get_environment (const std::string &name, std::string &value, IOSS_MAYBE_UNUSED bool sync_parallel) const
 
bool get_environment (const std::string &name, int &value, IOSS_MAYBE_UNUSED bool sync_parallel) const
 
IOSS_NODISCARD bool get_environment (const std::string &name, IOSS_MAYBE_UNUSED bool sync_parallel) const
 
IOSS_NODISCARD std::string decode_filename (const std::string &filename, bool is_parallel) const
 
IOSS_NODISCARD Ioss_MPI_Comm communicator () const
 
IOSS_NODISCARD int parallel_size () const
 
IOSS_NODISCARD int parallel_rank () const
 
void barrier () const
 
void attribute_reduction (IOSS_MAYBE_UNUSED int length, IOSS_MAYBE_UNUSED char buffer[]) const
 
IOSS_NODISCARD int64_t generate_guid (IOSS_MAYBE_UNUSED size_t id, int rank=-1) const
 
void memory_stats (int64_t &min, int64_t &max, int64_t &avg) const
 
void hwm_memory_stats (int64_t &min, int64_t &max, int64_t &avg) const
 
void global_count (const IntVector &local_counts, IntVector &global_counts) const
 
void global_count (const Int64Vector &local_counts, Int64Vector &global_counts) const
 
template<typename T >
IOSS_NODISCARDglobal_minmax (IOSS_MAYBE_UNUSED T local_minmax, IOSS_MAYBE_UNUSED MinMax which) const
 
template<typename T >
void global_array_minmax (IOSS_MAYBE_UNUSED std::vector< T > &local_minmax, IOSS_MAYBE_UNUSED MinMax which) const
 
template<typename T >
void gather (T my_value, std::vector< T > &result) const
 
template<typename T >
void all_gather (T my_value, std::vector< T > &result) const
 
template<typename T >
void gather (std::vector< T > &my_values, std::vector< T > &result) const
 
template<typename T >
void all_gather (std::vector< T > &my_values, std::vector< T > &result) const
 
template<typename T >
int gather (int vals_count, int size_per_val, std::vector< T > &my_values, std::vector< T > &result) const
 
template<typename T >
void broadcast (T &my_value, int root=0) const
 
template<typename T >
void broadcast (std::vector< T > &my_value, int root=0) const
 
void progress (const std::string &output) const
 
template<typename T >
global_minmax (T local_minmax, IOSS_MAYBE_UNUSED Ioss::ParallelUtils::MinMax which) const
 
template<>
void broadcast (IOSS_MAYBE_UNUSED std::string &my_str, IOSS_MAYBE_UNUSED int root) const
 
template<typename T >
void broadcast (IOSS_MAYBE_UNUSED T &my_value, IOSS_MAYBE_UNUSED int root) const
 
template<>
IOSS_EXPORT void broadcast (IOSS_MAYBE_UNUSED std::vector< std::pair< int, int > > &my_value, IOSS_MAYBE_UNUSED int root) const
 
template<typename T >
void broadcast (IOSS_MAYBE_UNUSED std::vector< T > &my_value, IOSS_MAYBE_UNUSED int root) const
 
template<typename T >
int gather (int num_vals, IOSS_MAYBE_UNUSED int size_per_val, std::vector< T > &my_values, std::vector< T > &result) const
 

Static Public Member Functions

static IOSS_NODISCARD constexpr Ioss_MPI_Comm comm_world ()
 
static IOSS_NODISCARD constexpr Ioss_MPI_Comm comm_self ()
 
static IOSS_NODISCARD constexpr Ioss_MPI_Comm comm_null ()
 

Private Attributes

Ioss_MPI_Comm communicator_ {comm_world()}
 
int parallelSize_ {-1}
 
int parallelRank_ {-1}
 

Member Enumeration Documentation

◆ MinMax

Enumerator
DO_MAX 
DO_MIN 
DO_SUM 

Constructor & Destructor Documentation

◆ ParallelUtils() [1/2]

Ioss::ParallelUtils::ParallelUtils ( )
default

◆ ParallelUtils() [2/2]

Ioss::ParallelUtils::ParallelUtils ( Ioss_MPI_Comm the_communicator)
explicit

Member Function Documentation

◆ add_environment_properties()

void Ioss::ParallelUtils::add_environment_properties ( Ioss::PropertyManager & properties)

See if any external properties specified via the IOSS_PROPERTIES environment variable. If any found, add to properties.

◆ all_gather() [1/2]

template<typename T >
void Ioss::ParallelUtils::all_gather ( std::vector< T > & my_values,
std::vector< T > & result ) const

◆ all_gather() [2/2]

template<typename T >
void Ioss::ParallelUtils::all_gather ( T my_value,
std::vector< T > & result ) const

◆ attribute_reduction()

void Ioss::ParallelUtils::attribute_reduction ( IOSS_MAYBE_UNUSED int length,
IOSS_MAYBE_UNUSED char buffer[] ) const

Global OR of attribute strings, the processors which have no knowledge of the value should initialize to '0' and the processors with knowledge set the appropriate values.

◆ barrier()

void Ioss::ParallelUtils::barrier ( ) const

◆ broadcast() [1/6]

template<>
void Ioss::ParallelUtils::broadcast ( IOSS_MAYBE_UNUSED std::string & my_str,
IOSS_MAYBE_UNUSED int root ) const

◆ broadcast() [2/6]

template<>
IOSS_EXPORT void Ioss::ParallelUtils::broadcast ( IOSS_MAYBE_UNUSED std::vector< std::pair< int, int > > & my_value,
IOSS_MAYBE_UNUSED int root ) const

◆ broadcast() [3/6]

template<typename T >
void Ioss::ParallelUtils::broadcast ( IOSS_MAYBE_UNUSED std::vector< T > & my_value,
IOSS_MAYBE_UNUSED int root ) const

◆ broadcast() [4/6]

template<typename T >
void Ioss::ParallelUtils::broadcast ( IOSS_MAYBE_UNUSED T & my_value,
IOSS_MAYBE_UNUSED int root ) const

◆ broadcast() [5/6]

template<typename T >
void Ioss::ParallelUtils::broadcast ( std::vector< T > & my_value,
int root = 0 ) const

◆ broadcast() [6/6]

template<typename T >
void Ioss::ParallelUtils::broadcast ( T & my_value,
int root = 0 ) const

◆ comm_null()

static IOSS_NODISCARD constexpr Ioss_MPI_Comm Ioss::ParallelUtils::comm_null ( )
inlinestaticconstexpr

◆ comm_self()

static IOSS_NODISCARD constexpr Ioss_MPI_Comm Ioss::ParallelUtils::comm_self ( )
inlinestaticconstexpr

◆ comm_world()

static IOSS_NODISCARD constexpr Ioss_MPI_Comm Ioss::ParallelUtils::comm_world ( )
inlinestaticconstexpr

◆ communicator()

IOSS_NODISCARD Ioss_MPI_Comm Ioss::ParallelUtils::communicator ( ) const
inline

◆ decode_filename()

std::string Ioss::ParallelUtils::decode_filename ( const std::string & filename,
bool is_parallel ) const

◆ gather() [1/4]

template<typename T >
int Ioss::ParallelUtils::gather ( int num_vals,
IOSS_MAYBE_UNUSED int size_per_val,
std::vector< T > & my_values,
std::vector< T > & result ) const

◆ gather() [2/4]

template<typename T >
int Ioss::ParallelUtils::gather ( int vals_count,
int size_per_val,
std::vector< T > & my_values,
std::vector< T > & result ) const

◆ gather() [3/4]

template<typename T >
void Ioss::ParallelUtils::gather ( std::vector< T > & my_values,
std::vector< T > & result ) const

◆ gather() [4/4]

template<typename T >
void Ioss::ParallelUtils::gather ( T my_value,
std::vector< T > & result ) const

◆ generate_guid()

int64_t Ioss::ParallelUtils::generate_guid ( IOSS_MAYBE_UNUSED size_t id,
int rank = -1 ) const

Generate a "globally unique id" which is unique over all entities of a specific type over all processors. Used by some applications for uniquely identifying an entity. If rank == -1, then use parallel_rank; otherwise use rank

◆ get_environment() [1/3]

bool Ioss::ParallelUtils::get_environment ( const std::string & name,
int & value,
IOSS_MAYBE_UNUSED bool sync_parallel ) const

Returns 'true' if 'name' is defined in the environment. The value of the environment variable is converted to an integer and returned in 'value'. No checking is done to ensure that the environment variable points to a valid integer. getenv system call is only done on processor 0. If '!sync_parallel', then don't push to other processors.

◆ get_environment() [2/3]

bool Ioss::ParallelUtils::get_environment ( const std::string & name,
IOSS_MAYBE_UNUSED bool sync_parallel ) const

Returns 'true' if 'name' is defined in the environment no matter what the value. Returns false otherwise. getenv system call is only done on processor 0. If '!sync_parallel', then don't push to other processors.

◆ get_environment() [3/3]

bool Ioss::ParallelUtils::get_environment ( const std::string & name,
std::string & value,
IOSS_MAYBE_UNUSED bool sync_parallel ) const

Returns 'true' if 'name' is defined in the environment. The value of the environment variable is returned in 'value'. getenv system call is only done on processor 0. If '!sync_parallel', then don't push to other processors.

◆ global_array_minmax()

template<typename T >
void Ioss::ParallelUtils::global_array_minmax ( IOSS_MAYBE_UNUSED std::vector< T > & local_minmax,
IOSS_MAYBE_UNUSED MinMax which ) const

◆ global_count() [1/2]

void Ioss::ParallelUtils::global_count ( const Int64Vector & local_counts,
Int64Vector & global_counts ) const

◆ global_count() [2/2]

void Ioss::ParallelUtils::global_count ( const IntVector & local_counts,
IntVector & global_counts ) const

Vector 'local_counts' contains the number of objects local to this processor. On exit, global_counts contains the total number of objects on all processors. Assumes that ordering is the same on all processors

◆ global_minmax() [1/2]

template<typename T >
template IOSS_EXPORT double Ioss::ParallelUtils::global_minmax ( IOSS_MAYBE_UNUSED T local_minmax,
IOSS_MAYBE_UNUSED MinMax which ) const

◆ global_minmax() [2/2]

template<typename T >
T Ioss::ParallelUtils::global_minmax ( T local_minmax,
IOSS_MAYBE_UNUSED Ioss::ParallelUtils::MinMax which ) const

◆ hwm_memory_stats()

void Ioss::ParallelUtils::hwm_memory_stats ( int64_t & min,
int64_t & max,
int64_t & avg ) const

Return high-water-mark min, max, average memory used by any process

◆ memory_stats()

void Ioss::ParallelUtils::memory_stats ( int64_t & min,
int64_t & max,
int64_t & avg ) const

Return min, max, average memory used by any process

◆ parallel_rank()

int Ioss::ParallelUtils::parallel_rank ( ) const

◆ parallel_size()

int Ioss::ParallelUtils::parallel_size ( ) const

◆ progress()

void Ioss::ParallelUtils::progress ( const std::string & output) const

Member Data Documentation

◆ communicator_

Ioss_MPI_Comm Ioss::ParallelUtils::communicator_ {comm_world()}
private

◆ parallelRank_

int Ioss::ParallelUtils::parallelRank_ {-1}
mutableprivate

◆ parallelSize_

int Ioss::ParallelUtils::parallelSize_ {-1}
mutableprivate

The documentation for this class was generated from the following files: