fml  0.1-0
Fused Matrix Library
fml::copy Namespace Reference

Copiers. More...

Functions

template<typename REAL_IN , typename REAL_OUT >
void cpu2cpu (const cpuvec< REAL_IN > &cpu_in, cpuvec< REAL_OUT > &cpu_out)
 Copy data from a CPU object to another. More...
 
template<typename REAL >
cpuvec< REAL > cpu2cpu (const cpuvec< REAL > &cpu_in)
 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 cpu2cpu (const cpumat< REAL_IN > &cpu_in, cpumat< REAL_OUT > &cpu_out)
 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 >
cpumat< REAL > cpu2cpu (const cpumat< REAL > &cpu_in)
 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 gpu2cpu (const gpuvec< REAL_IN > &gpu, cpuvec< REAL_OUT > &cpu)
 Copy data from a GPU object to a CPU object. More...
 
template<typename REAL >
gpuvec< REAL > gpu2cpu (const gpuvec< REAL > &gpu)
 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 gpu2cpu (const gpumat< REAL_IN > &gpu, cpumat< REAL_OUT > &cpu)
 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 >
cpumat< REAL > gpu2cpu (const gpumat< REAL > &gpu)
 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 cpu2gpu (const cpuvec< REAL_IN > &cpu, gpuvec< REAL_OUT > &gpu)
 Copy data from a CPU object to a GPU object. More...
 
template<typename REAL_IN , typename REAL_OUT >
void cpu2gpu (const cpumat< REAL_IN > &cpu, gpumat< REAL_OUT > &gpu)
 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 gpu2gpu (const gpuvec< REAL_IN > &gpu_in, gpuvec< REAL_OUT > &gpu_out)
 Copy data from a GPU object to another. More...
 
template<typename REAL >
gpuvec< REAL > gpu2gpu (const gpuvec< REAL > &gpu_in)
 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 gpu2gpu (const gpumat< REAL_IN > &gpu_in, gpumat< REAL_OUT > &gpu_out)
 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 >
gpumat< REAL > gpu2gpu (const gpumat< REAL > &gpu_in)
 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_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...
 
template<typename REAL_IN , typename REAL_OUT >
void par2cpu (const parmat_cpu< REAL_IN > &par, cpumat< REAL_OUT > &cpu)
 Copy data from an PAR object to a CPU object. More...
 
template<typename REAL_IN , typename REAL_OUT >
void cpu2par (const cpumat< REAL_IN > &cpu, parmat_cpu< REAL_OUT > &par)
 Copy data from an CPU object to a PAR object. More...
 
template<typename REAL_IN , typename REAL_OUT >
void par2par (const parmat_cpu< REAL_IN > &par_in, parmat_cpu< REAL_OUT > &par_out)
 Copy data from a PAR object to another. More...
 
template<typename REAL_IN , typename REAL_OUT >
void par2par (const parmat_gpu< REAL_IN > &par_in, parmat_gpu< REAL_OUT > &par_out)
 Copy data from a PAR object to another. More...
 

Detailed Description

Copiers.

MPI class helpers.

Function Documentation

◆ cpu2cpu()

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::cpu2cpu ( const cpuvec< REAL_IN > &  cpu_in,
cpuvec< REAL_OUT > &  cpu_out 
)

Copy data from a CPU object to another.

Parameters
[in]cpu_inInput data.
[out]cpu_outOutput. Dimensions should match those of the input data. If not, the matrix will automatically be resized.

Memory Allocations
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
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.

◆ cpu2gpu()

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::cpu2gpu ( const cpuvec< REAL_IN > &  cpu,
gpuvec< REAL_OUT > &  gpu 
)

Copy data from a CPU object to a GPU object.

Parameters
[in]cpuInput data.
[out]gpuOutput. Dimensions should match those of the input data. If not, the matrix will automatically be resized.

Memory Allocations
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
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. Additionally, REAL_OUT can be __half.

◆ cpu2mpi()

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::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
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
If a reallocation is triggered and fails, a bad_alloc exception will be thrown.

Communication Details
The method has no communication.

Template Parameters
REAL_IN,REAL_OUTShould be float or double. They do not have to be the same type.

◆ cpu2par()

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::cpu2par ( const cpumat< REAL_IN > &  cpu,
parmat_cpu< REAL_OUT > &  par 
)

Copy data from an CPU object to a PAR object.

Every process should have a copy of the data on input.

Parameters
[in]parInput data.
[out]cpuOutput.

Memory Allocations
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
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.

◆ gpu2cpu()

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::gpu2cpu ( const gpuvec< REAL_IN > &  gpu,
cpuvec< REAL_OUT > &  cpu 
)

Copy data from a GPU object to a CPU object.

Parameters
[in]gpuInput data.
[out]cpuOutput. Dimensions should match those of the input data. If not, the matrix will automatically be resized.

Memory Allocations
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
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. Additionally, REAL_IN can be __half.

◆ gpu2gpu()

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::gpu2gpu ( const gpuvec< REAL_IN > &  gpu_in,
gpuvec< REAL_OUT > &  gpu_out 
)

Copy data from a GPU object to another.

The GPU objects should be on the same card.

Parameters
[in]gpu_inInput data.
[out]gpu_outOutput. Dimensions should match those of the input data. If not, the matrix will automatically be resized.

Memory Allocations
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
If a reallocation is triggered and fails, a bad_alloc exception will be thrown. If the objects are on different cards, a logic_error exception will be thrown.

Template Parameters
REAL_IN,REAL_OUTshould be __half, float, or double. They do not have to be the same type.

◆ mpi2cpu()

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::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
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
If an allocation or reallocation is triggered and fails, a bad_alloc exception will be thrown.

Communication Details
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 fml::copy::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
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
If a reallocation is triggered and fails, a bad_alloc exception will be thrown.

Communication Details
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 fml::copy::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
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
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.

◆ par2cpu()

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::par2cpu ( const parmat_cpu< REAL_IN > &  par,
cpumat< REAL_OUT > &  cpu 
)

Copy data from an PAR object to a CPU object.

Every process receives a copy of the data. The number of rows of the input should fit in the storage of a len_t.

Parameters
[in]parInput data.
[out]cpuOutput.

Memory Allocations
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
If a reallocation is triggered and fails, a bad_alloc exception will be thrown.

Communication Details
The method will communicate across all processes in the communicator.

Template Parameters
REAL_IN,REAL_OUTShould be float or double. They do not have to be the same type.

◆ par2par() [1/2]

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::par2par ( const parmat_cpu< REAL_IN > &  par_in,
parmat_cpu< REAL_OUT > &  par_out 
)

Copy data from a PAR object to another.

Parameters
[in]par_inInput data.
[out]par_outOutput.

Memory Allocations
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
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.

◆ par2par() [2/2]

template<typename REAL_IN , typename REAL_OUT >
void fml::copy::par2par ( const parmat_gpu< REAL_IN > &  par_in,
parmat_gpu< REAL_OUT > &  par_out 
)

Copy data from a PAR object to another.

Parameters
[in]par_inInput data.
[out]par_outOutput.

Memory Allocations
If the output dimensions do not match those of the input, the internal data will automatically be re-allocated.

Exceptions
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.