MPI specialized class for average computations.
More...
template<class container>
struct dg::Average< MPI_Vector< container > >
MPI specialized class for average computations.
dg::MPIGrid3d g( 0, lx, 0, ly, 0, lz, n, Nx, Ny, Nz, comm);
if(rank==0)std::cout << "Averaging z ... \n";
avg( vector, average_z, false);
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
Topological average computations in a Cartesian topology.
Definition: average.h:53
mpi Vector class
Definition: mpi_vector.h:32
The simplest implementation of aRealMPITopology3d.
Definition: mpi_grid.h:727
◆ Average() [1/2]
template<class container >
Prepare internal workspace.
- Parameters
-
g | the grid from which to take the dimensionality and sizes |
direction | the direction or plane over which to average when calling operator() (at the moment cannot be coo3d::xz or coo3d::y ) |
mode | either "exact" ( uses the exact and reproducible dot product for the summation) or "simple" (uses inexact but much faster direct summation) use simple if you do not need the reproducibility |
- Note
- computing in "exact" mode is especially difficult if the averaged direction is small compared to the remaining dimensions and for GPUs in general, expect to gain a factor 10-1000 (no joke) from going to "simple" mode in these cases
◆ Average() [2/2]
template<class container >
Prepare internal workspace.
- Parameters
-
g | the grid from which to take the dimensionality and sizes |
direction | the direction or plane over which to average when calling operator() (at the moment cannot be coo3d::xz or coo3d::y ) |
mode | either "exact" ( uses the exact and reproducible dot product for the summation) or "simple" (uses inexact but much faster direct summation) use simple if you do not need the reproducibility |
- Note
- computing in "exact" mode is especially difficult if the averaged direction is small compared to the remaining dimensions and for GPUs in general, expect to gain a factor 10-1000 (no joke) from going to "simple" mode in these cases
◆ operator()()
template<class container >
Compute the average as configured in the constructor.
The compuatation is based on the exact, reproducible scalar product provided in the dg::exblas
library. It is divided in two steps
- average the input field over the direction or plane given in the constructor
- extend the lower dimensional result back to the original dimensionality
- Parameters
-
src | Source Vector (must have the same size and communicator as the grid given in the constructor) |
res | result Vector (if extend==true , res must have same size and communicator as src vector, else it gets properly resized, may alias src ) |
extend | if true the average is extended back to the original dimensionality and the communicator is the 3d communicator, if false , this step is skipped. In that case, each process has a result vector with reduced dimensionality and a Cartesian communicator only in the remaining dimensions. Note that in any case all processes get the result (since the underlying dot product distributes its result to all processes) |
The documentation for this struct was generated from the following file: