chombo-discharge
Loading...
Searching...
No Matches
ParallelOps Namespace Reference

For putting a bunch of often-used MPI reductions in one place. More...

Functions

void barrier () noexcept
 MPI barrier.
std::pair< int, int > partition (int a_N) noexcept
 Partition the input number such that each MPI rank gets an equal chunk. We assume that N is the length of some container whose indexing starts at 0.
Real min (const Real &a_input) noexcept
 Get the minimum of the input, reduced over MPI ranks (in the Chombo communicator).
int min (const int &a_input) noexcept
 Get the minimum of the input, reduced over MPI ranks (in the Chombo communicator).
long long int min (const long long int &a_input) noexcept
 Get the minimum of the input, reduced over MPI ranks (in the Chombo communicator).
std::pair< Real, RealVect > min (const Real &a_val, const RealVect &a_pos) noexcept
 Get the minimum value and the position corresponding to the minimum value of a_val.
Real max (const Real &a_input) noexcept
 Get the maximum of the input, reduced over MPI ranks (in the Chombo communicator).
int max (const int &a_input) noexcept
 Get the maximum of the input, reduced over MPI ranks (in the Chombo communicator).
long long max (const long long &a_input) noexcept
 Get the maximum of the input, reduced over MPI ranks (in the Chombo communicator).
std::pair< Real, RealVect > max (const Real &a_val, const RealVect &a_pos) noexcept
 Get the maximum value and the position corresponding to the maximum value of a_val.
std::pair< Real, int > maxRank (const Real &a_val) noexcept
 Get the maximum value and the rank having the maximum value.
std::pair< Real, int > minRank (const Real &a_val) noexcept
 Get the minimum value and the rank having the minimum value.
Real average (const Real &a_val) noexcept
 Compute the average (across MPI ranks) of the input value.
Real sum (const Real &a_value) noexcept
 Compute the sum across all MPI ranks.
int sum (const int &a_value) noexcept
 Compute the sum across all MPI ranks.
long sum (const long &a_value) noexcept
 Compute the sum across all MPI ranks.
long long sum (const long long &a_value) noexcept
 Compute the sum across all MPI ranks.
unsigned long long sum (const unsigned long long &a_value) noexcept
 Compute the sum across all MPI ranks.
Real standardDeviation (const Real &a_value) noexcept
 Compute the standard deviation of the input value.
void sum (Vector< Real > &a_data) noexcept
 Perform a summation of all the MPI ranks's input data.
void sum (Vector< int > &a_data) noexcept
 Perform a summation of all the MPI ranks's input data.
void sum (Vector< long int > &a_data) noexcept
 Perform a summation of all the MPI ranks's input data.
void sum (Vector< long long int > &a_data) noexcept
 Perform a summation of all the MPI ranks's input data.
Vector< int > gather (const int &a_localValue) noexcept
 Gather local values – return a vector of local values.
Vector< Real > gather (const Real &a_localValue) noexcept
 Gather local values – return a vector of local values.
Vector< long long > gather (const long long &a_localValue) noexcept
 Gather local values – return a vector of local values.
void rankOffset (long long &a_offset, long long &a_total, const long long a_mine) noexcept
 Where this rank's rows start among every rank's, and how many there are in all.

Detailed Description

For putting a bunch of often-used MPI reductions in one place.

Function Documentation

◆ average()

Real ParallelOps::average ( const Real & a_val)
inlinenoexcept

Compute the average (across MPI ranks) of the input value.

Parameters
[in]a_valValue to take the average of
Returns
Return value

◆ gather() [1/3]

Vector< int > ParallelOps::gather ( const int & a_localValue)
inlinenoexcept

Gather local values – return a vector of local values.

Parameters
[in]a_localValueLocal value per MPI rank
Returns
Return value

◆ gather() [2/3]

Vector< long long > ParallelOps::gather ( const long long & a_localValue)
inlinenoexcept

Gather local values – return a vector of local values.

Parameters
[in]a_localValueLocal value per MPI rank
Returns
Return value

◆ gather() [3/3]

Vector< Real > ParallelOps::gather ( const Real & a_localValue)
inlinenoexcept

Gather local values – return a vector of local values.

Parameters
[in]a_localValueLocal value per MPI rank
Returns
Return value

◆ max() [1/4]

int ParallelOps::max ( const int & a_input)
inlinenoexcept

Get the maximum of the input, reduced over MPI ranks (in the Chombo communicator).

Parameters
[in]a_inputData input.
Returns
Global maximum

◆ max() [2/4]

long long ParallelOps::max ( const long long & a_input)
inlinenoexcept

Get the maximum of the input, reduced over MPI ranks (in the Chombo communicator).

Parameters
[in]a_inputData input.
Returns
Global maximum

◆ max() [3/4]

Real ParallelOps::max ( const Real & a_input)
inlinenoexcept

Get the maximum of the input, reduced over MPI ranks (in the Chombo communicator).

Parameters
[in]a_inputData input.
Returns
Global maximum

◆ max() [4/4]

std::pair< Real, RealVect > ParallelOps::max ( const Real & a_val,
const RealVect & a_pos )
inlinenoexcept

Get the maximum value and the position corresponding to the maximum value of a_val.

This returns the value a_val and position a_pos such that they correspond to the input variables for the processor which held the largest value a_val.

Returns
Global maximum
Parameters
[in,out]a_valDescription
[in,out]a_posDescription

◆ maxRank()

std::pair< Real, int > ParallelOps::maxRank ( const Real & a_val)
inlinenoexcept

Get the maximum value and the rank having the maximum value.

Parameters
[in]a_valValue to be compared.
Returns
Return value

◆ min() [1/4]

int ParallelOps::min ( const int & a_input)
inlinenoexcept

Get the minimum of the input, reduced over MPI ranks (in the Chombo communicator).

Parameters
[in]a_inputData input. Returns the smallest.
Returns
Global minimum

◆ min() [2/4]

long long int ParallelOps::min ( const long long int & a_input)
inlinenoexcept

Get the minimum of the input, reduced over MPI ranks (in the Chombo communicator).

Parameters
[in]a_inputData input. Returns the smallest.
Returns
Global minimum

◆ min() [3/4]

Real ParallelOps::min ( const Real & a_input)
inlinenoexcept

Get the minimum of the input, reduced over MPI ranks (in the Chombo communicator).

Parameters
[in]a_inputData input. Returns the smallest.
Returns
Global minimum

◆ min() [4/4]

std::pair< Real, RealVect > ParallelOps::min ( const Real & a_val,
const RealVect & a_pos )
inlinenoexcept

Get the minimum value and the position corresponding to the minimum value of a_val.

This returns the value a_val and position a_pos such that they correspond to the input variables for the processor which held the smallest value a_val.

Returns
Global minimum
Parameters
[in,out]a_valDescription
[in,out]a_posDescription

◆ minRank()

std::pair< Real, int > ParallelOps::minRank ( const Real & a_val)
inlinenoexcept

Get the minimum value and the rank having the minimum value.

Parameters
[in]a_valValue to be compared.
Returns
Return value

◆ partition()

std::pair< int, int > ParallelOps::partition ( int a_N)
inlinenoexcept

Partition the input number such that each MPI rank gets an equal chunk. We assume that N is the length of some container whose indexing starts at 0.

Returns start/stop indices along N. For example, if using two MPI ranks with N = 10 the first rank obtains pair(0,4) and the second rank get (5,9)

Parameters
[in]a_NSome container size.
Returns
Return value

◆ rankOffset()

void ParallelOps::rankOffset ( long long & a_offset,
long long & a_total,
const long long a_mine )
inlinenoexcept

Where this rank's rows start among every rank's, and how many there are in all.

Parameters
[out]a_offsetRows the ranks before this one hold.
[out]a_totalRows every rank holds together.
[in]a_mineRows this rank holds.

◆ standardDeviation()

Real ParallelOps::standardDeviation ( const Real & a_value)
inlinenoexcept

Compute the standard deviation of the input value.

Parameters
[in]a_valueValue to compute the standard deviation of.
Returns
Return value

◆ sum() [1/9]

int ParallelOps::sum ( const int & a_value)
inlinenoexcept

Compute the sum across all MPI ranks.

Parameters
[in]a_valueValue to the take the sum of.
Returns
Global sum

◆ sum() [2/9]

long ParallelOps::sum ( const long & a_value)
inlinenoexcept

Compute the sum across all MPI ranks.

Parameters
[in]a_valueValue to the take the sum of.
Returns
Global sum

◆ sum() [3/9]

long long ParallelOps::sum ( const long long & a_value)
inlinenoexcept

Compute the sum across all MPI ranks.

Parameters
[in]a_valueValue to the take the sum of.
Returns
Global sum

◆ sum() [4/9]

Real ParallelOps::sum ( const Real & a_value)
inlinenoexcept

Compute the sum across all MPI ranks.

Parameters
[in]a_valueValue to the take the sum of.
Returns
Global sum

◆ sum() [5/9]

unsigned long long ParallelOps::sum ( const unsigned long long & a_value)
inlinenoexcept

Compute the sum across all MPI ranks.

Parameters
[in]a_valueValue to the take the sum of.
Returns
Global sum

◆ sum() [6/9]

void ParallelOps::sum ( Vector< int > & a_data)
inlinenoexcept

Perform a summation of all the MPI ranks's input data.

This performs a rank-wise summation. If rank 1 has data (1,2,3) and rank 2 has data (3,4,5), the output data on both ranks is (4,6,8).

Parameters
[in,out]a_dataOn

◆ sum() [7/9]

void ParallelOps::sum ( Vector< long int > & a_data)
inlinenoexcept

Perform a summation of all the MPI ranks's input data.

This performs a rank-wise summation. If rank 1 has data (1,2,3) and rank 2 has data (3,4,5), the output data on both ranks is (4,6,8).

Parameters
[in,out]a_dataOn

◆ sum() [8/9]

void ParallelOps::sum ( Vector< long long int > & a_data)
inlinenoexcept

Perform a summation of all the MPI ranks's input data.

This performs a rank-wise summation. If rank 1 has data (1,2,3) and rank 2 has data (3,4,5), the output data on both ranks is (4,6,8).

Parameters
[in,out]a_dataOn

◆ sum() [9/9]

void ParallelOps::sum ( Vector< Real > & a_data)
inlinenoexcept

Perform a summation of all the MPI ranks's input data.

This performs a rank-wise summation. If rank 1 has data (1,2,3) and rank 2 has data (3,4,5), the output data on both ranks is (4,6,8).

Parameters
[in,out]a_dataOn