IOSS 2.0
|
#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_NODISCARD T | global_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 > | |
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} |
|
default |
|
explicit |
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
.
void Ioss::ParallelUtils::all_gather | ( | std::vector< T > & | my_values, |
std::vector< T > & | result ) const |
void Ioss::ParallelUtils::all_gather | ( | T | my_value, |
std::vector< T > & | result ) const |
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.
void Ioss::ParallelUtils::barrier | ( | ) | const |
void Ioss::ParallelUtils::broadcast | ( | IOSS_MAYBE_UNUSED std::string & | my_str, |
IOSS_MAYBE_UNUSED int | root ) const |
IOSS_EXPORT void Ioss::ParallelUtils::broadcast | ( | IOSS_MAYBE_UNUSED std::vector< std::pair< int, int > > & | my_value, |
IOSS_MAYBE_UNUSED int | root ) const |
void Ioss::ParallelUtils::broadcast | ( | IOSS_MAYBE_UNUSED std::vector< T > & | my_value, |
IOSS_MAYBE_UNUSED int | root ) const |
void Ioss::ParallelUtils::broadcast | ( | IOSS_MAYBE_UNUSED T & | my_value, |
IOSS_MAYBE_UNUSED int | root ) const |
void Ioss::ParallelUtils::broadcast | ( | std::vector< T > & | my_value, |
int | root = 0 ) const |
void Ioss::ParallelUtils::broadcast | ( | T & | my_value, |
int | root = 0 ) const |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inline |
std::string Ioss::ParallelUtils::decode_filename | ( | const std::string & | filename, |
bool | is_parallel ) const |
int Ioss::ParallelUtils::gather | ( | int | num_vals, |
IOSS_MAYBE_UNUSED int | size_per_val, | ||
std::vector< T > & | my_values, | ||
std::vector< T > & | result ) const |
int Ioss::ParallelUtils::gather | ( | int | vals_count, |
int | size_per_val, | ||
std::vector< T > & | my_values, | ||
std::vector< T > & | result ) const |
void Ioss::ParallelUtils::gather | ( | std::vector< T > & | my_values, |
std::vector< T > & | result ) const |
void Ioss::ParallelUtils::gather | ( | T | my_value, |
std::vector< T > & | result ) const |
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
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.
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.
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.
void Ioss::ParallelUtils::global_array_minmax | ( | IOSS_MAYBE_UNUSED std::vector< T > & | local_minmax, |
IOSS_MAYBE_UNUSED MinMax | which ) const |
void Ioss::ParallelUtils::global_count | ( | const Int64Vector & | local_counts, |
Int64Vector & | global_counts ) const |
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
template IOSS_EXPORT double Ioss::ParallelUtils::global_minmax | ( | IOSS_MAYBE_UNUSED T | local_minmax, |
IOSS_MAYBE_UNUSED MinMax | which ) const |
T Ioss::ParallelUtils::global_minmax | ( | T | local_minmax, |
IOSS_MAYBE_UNUSED Ioss::ParallelUtils::MinMax | which ) const |
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
void Ioss::ParallelUtils::memory_stats | ( | int64_t & | min, |
int64_t & | max, | ||
int64_t & | avg ) const |
Return min, max, average memory used by any process
int Ioss::ParallelUtils::parallel_rank | ( | ) | const |
int Ioss::ParallelUtils::parallel_size | ( | ) | const |
void Ioss::ParallelUtils::progress | ( | const std::string & | output | ) | const |
|
private |
|
mutableprivate |
|
mutableprivate |