fml  0.1-0
Fused Matrix Library
mpihelpers Namespace Reference

MPI class helpers. More...

Functions

template<typename REAL_IN , typename REAL_OUT >
void mpi2cpu_all (const mpimat< REAL_IN > &mpi, cpumat< REAL_OUT > &cpu)
 Copy data from an MPI object to a CPU object. More...
 
template<typename REAL >
cpumat< REAL > mpi2cpu_all (const mpimat< REAL > &mpi)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename REAL_IN , typename REAL_OUT >
void mpi2cpu (const mpimat< REAL_IN > &mpi, cpumat< REAL_OUT > &cpu, int rdest=0, int cdest=0)
 Copy data from an MPI object to a CPU object. More...
 
template<typename REAL >
cpumat< REAL > mpi2cpu (const mpimat< REAL > &mpi)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename REAL_IN , typename REAL_OUT >
void cpu2mpi (const cpumat< REAL_IN > &cpu, mpimat< REAL_OUT > &mpi)
 Copy data from a CPU object to an MPI object. More...
 
template<typename REAL_IN , typename REAL_OUT >
void mpi2mpi (const mpimat< REAL_IN > &mpi_in, mpimat< REAL_OUT > &mpi_out)
 Copy data from an MPI object to another. More...
 

Detailed Description

MPI class helpers.

Function Documentation

◆ cpu2mpi()

template<typename REAL_IN , typename REAL_OUT >
void mpihelpers::cpu2mpi ( const cpumat< REAL_IN > &  cpu,
mpimat< REAL_OUT > &  mpi 
)

Copy data from a CPU object to an MPI object.

The CPU matrix should be replicated across all processes in the grid. This is just for testing purposes and should not be used in production.

Parameters
[in]cpuInput data.
[out]mpiOutput. Dimensions should match those of the input data. If not, the matrix will automatically be resized.
Memory Allocations\n If the output dimensions do not match those of the input, the
internal data will automatically be re-allocated.
Exceptions\n If a reallocation is triggered and fails, a bad_alloc exception
will be thrown.
Communication Details\n The method has no communication.
Template Parameters
REAL_IN,REAL_OUTShould be float or double. They do not have to be the same type.

◆ mpi2cpu()

template<typename REAL_IN , typename REAL_OUT >
void mpihelpers::mpi2cpu ( const mpimat< REAL_IN > &  mpi,
cpumat< REAL_OUT > &  cpu,
int  rdest = 0,
int  cdest = 0 
)

Copy data from an MPI object to a CPU object.

The process at grid positiong (rdest, cdest) will receive the full matrix.

Parameters
[in]mpiInput data.
[out]cpuOutput. Dimensions should match those of the input data. If not, the matrix will automatically be resized.
[in]rdest,cdestRow/column position in the communicator grid of the receiving process.
Memory Allocations\n If the output dimensions do not match those of the input, the
internal data will automatically be re-allocated. Each process also needs temporary storage of the size mpi.bf_rows().
Exceptions\n If an allocation or reallocation is triggered and fails, a
bad_alloc exception will be thrown.
Communication Details\n The method will communicate across all processes in the BLACS grid.
Template Parameters
REAL_IN,REAL_OUTShould be float or double. They do not have to be the same type.

◆ mpi2cpu_all()

template<typename REAL_IN , typename REAL_OUT >
void mpihelpers::mpi2cpu_all ( const mpimat< REAL_IN > &  mpi,
cpumat< REAL_OUT > &  cpu 
)

Copy data from an MPI object to a CPU object.

Every process in the grid receives a copy of the data.

Parameters
[in]mpiInput data.
[out]cpuOutput. Dimensions should match those of the input data. If not, the matrix will automatically be resized.
Memory Allocations\n If the output dimensions do not match those of the input, the
internal data will automatically be re-allocated.
Exceptions\n If a reallocation is triggered and fails, a bad_alloc exception
will be thrown.
Communication Details\n The method will communicate across all processes in the BLACS grid.
Template Parameters
REAL_IN,REAL_OUTShould be float or double. They do not have to be the same type.

◆ mpi2mpi()

template<typename REAL_IN , typename REAL_OUT >
void mpihelpers::mpi2mpi ( const mpimat< REAL_IN > &  mpi_in,
mpimat< REAL_OUT > &  mpi_out 
)

Copy data from an MPI object to another.

Parameters
[in]mpi_inInput data.
[out]mpi_outOutput. Dimensions should match those of the input data. If not, the matrix will automatically be resized.
Memory Allocations\n If the output dimensions do not match those of the input, the
internal data will automatically be re-allocated.
Exceptions\n If a reallocation is triggered and fails, a bad_alloc exception
will be thrown.
Template Parameters
REAL_IN,REAL_OUTShould be float or double. They do not have to be the same type.