ParGeMSLR
Public Member Functions | Public Attributes | List of all members
pargemslr::CommunicationHelperClass Class Reference

The data structure for parallel matvec helper, store communication inforamtion for parallel matvec, and working buffers. More...

#include <parallel_csr_matrix.hpp>

Inheritance diagram for pargemslr::CommunicationHelperClass:

Public Member Functions

 CommunicationHelperClass ()
 The constructor of CommunicationHelperClass. More...
 
 CommunicationHelperClass (const CommunicationHelperClass &comm_helper)
 The copy constructor of CommunicationHelperClass. More...
 
 CommunicationHelperClass (CommunicationHelperClass &&comm_helper)
 The move constructor of CommunicationHelperClass. More...
 
CommunicationHelperClassoperator= (const CommunicationHelperClass &comm_helper)
 The = operator of CommunicationHelperClass. More...
 
CommunicationHelperClassoperator= (CommunicationHelperClass &&comm_helper)
 The = operator of CommunicationHelperClass. More...
 
 ~CommunicationHelperClass ()
 The destructor of CommunicationHelperClass. More...
 
int Clear ()
 Free the current matvec helper, set everything to 0. More...
 
int CreateHostBuffer (int unitsize)
 Create buffer. More...
 
int MoveData (int location)
 Move the index data to other location in the memory. More...
 
int MoveSendData (int location)
 Move the send data to other location in the memory. More...
 
int MoveRecvData (int location)
 Move the recv data to other location in the memory. More...
 
template<typename T >
int DataTransfer (const VectorVirtualClass< T > &vec_in, VectorVirtualClass< T > &vec_out, int loc_in, int loc_out)
 Apply communication using the buffer inside this comm helper. More...
 
template<typename T >
int DataTransferStart (const VectorVirtualClass< T > &vec_in, int loc_in)
 Start communication using the buffer inside this comm helper. More...
 
template<typename T >
int DataTransferOver (VectorVirtualClass< T > &vec_out, int loc_out)
 Finish communication using the buffer inside this comm helper. More...
 
template<typename T , class VectorType >
int DataTransfer (const std::vector< VectorType > &vec_in, std::vector< VectorType > &vec_out, int loc_in, int loc_out)
 Apply communication using the buffer inside this comm helper. More...
 
template<typename T , class VectorType >
int DataTransferStart (const std::vector< VectorType > &vec_in, int loc_in)
 Start communication using the buffer inside this comm helper. More...
 
template<typename T , class VectorType >
int DataTransferOver (std::vector< VectorType > &vec_out, int loc_out)
 Finish communication using the buffer inside this comm helper. More...
 
template<typename T >
int DataTransferReverse (const VectorVirtualClass< T > &vec_in, VectorVirtualClass< T > &vec_out, int loc_in, int loc_out)
 Apply communication using the buffer inside this comm helper in the opposite direction. More...
 
template<typename T >
int DataTransferStartReverse (const VectorVirtualClass< T > &vec_in, int loc_in)
 Start communication using the buffer inside this comm helper in the opposite direction. More...
 
template<typename T >
int DataTransferOverReverse (VectorVirtualClass< T > &vec_out, int loc_out)
 Finish communication using the buffer inside this comm helper in the opposite direction. More...
 

Public Attributes

int _n_in
 The size of the input vector. More...
 
int _n_out
 The size of the output vector. More...
 
vector_int _send_to_v
 The vector stores the MPI ranks that myid needs to send local vector to. More...
 
vector_int _recv_from_v
 The vector stores the MPI ranks that myid needs to recv external vector from. More...
 
std::vector< vector_int_send_idx_v2
 2D vector, send_idx_v2[i] is the index in local vector that need to be sent to proc. i. More...
 
std::vector< vector_int_recv_idx_v2
 2D vector, recv_idx_v2[i] is the index in external vector that need to be received from proc. i. More...
 
std::vector< vector_int_idx_helper_v2
 Helper array for building the comm helper. More...
 
vector< MPI_Request > _requests_v
 Vector of MPI_Request for communication. More...
 
bool _is_ready
 Is true when the comm_helper ready to use. More...
 
bool _is_waiting
 Is true when there is communication on going. More...
 
bool _is_nbhd_built
 If the neiborhood information (send_to and recv_from) is set in advance. More...
 

Detailed Description

The data structure for parallel matvec helper, store communication inforamtion for parallel matvec, and working buffers.

Constructor & Destructor Documentation

◆ CommunicationHelperClass() [1/3]

pargemslr::CommunicationHelperClass::CommunicationHelperClass ( )

The constructor of CommunicationHelperClass.

◆ CommunicationHelperClass() [2/3]

pargemslr::CommunicationHelperClass::CommunicationHelperClass ( const CommunicationHelperClass comm_helper)

The copy constructor of CommunicationHelperClass.

Parameters
[in]comm_helperThe target CommunicationHelperClass.

◆ CommunicationHelperClass() [3/3]

pargemslr::CommunicationHelperClass::CommunicationHelperClass ( CommunicationHelperClass &&  comm_helper)

The move constructor of CommunicationHelperClass.

Parameters
[in]comm_helperThe target CommunicationHelperClass.

◆ ~CommunicationHelperClass()

pargemslr::CommunicationHelperClass::~CommunicationHelperClass ( )

The destructor of CommunicationHelperClass, just a call to the free function.

Member Function Documentation

◆ Clear()

int pargemslr::CommunicationHelperClass::Clear ( )

Free the current matvec helper, set everything to 0.

Returns
return Error message.

◆ CreateHostBuffer()

int pargemslr::CommunicationHelperClass::CreateHostBuffer ( int  unitsize)

Create buffer.

Parameters
[in]unitsizeThe unit size in byte.
Returns
return Error message.

◆ DataTransfer() [1/2]

template<typename T , class VectorType >
int pargemslr::CommunicationHelperClass::DataTransfer ( const std::vector< VectorType > &  vec_in,
std::vector< VectorType > &  vec_out,
int  loc_in,
int  loc_out 
)

Apply communication using the buffer inside this comm helper.

Parameters
[in]vec_inThe 2D vector we send information from.
[out]vec_outThe 2D vector we recv information to. Space should be reserved before calling this function.
[in]loc_inThe data location of the input data. For 2D array, this is the second dimension. The fist dimention std::vector is always on the host.
[in]loc_outThe data location of the output data. For 2D array, this is the second dimension. The fist dimention std::vector is always on the host.
Returns
Return error information.

◆ DataTransfer() [2/2]

template<typename T >
int pargemslr::CommunicationHelperClass::DataTransfer ( const VectorVirtualClass< T > &  vec_in,
VectorVirtualClass< T > &  vec_out,
int  loc_in,
int  loc_out 
)

Apply communication using the buffer inside this comm helper.

Parameters
[in]vec_inThe vector we send information from.
[out]vec_outThe vector we recv information to. Space should be reserved before calling this function.
[in]loc_inThe data location of the input data.
[in]loc_outThe data location of the output data.
Returns
Return error information.

◆ DataTransferOver() [1/2]

template<typename T , class VectorType >
int pargemslr::CommunicationHelperClass::DataTransferOver ( std::vector< VectorType > &  vec_out,
int  loc_out 
)

Finish communication using the buffer inside this comm helper.

Parameters
[out]vec_outThe 2D vector we recv information to. Space should be reserved before calling this function.
[in]loc_outThe data location of the output data. For 2D array, this is the second dimension. The fist dimention std::vector is always on the host.
Returns
Return error information.

◆ DataTransferOver() [2/2]

template<typename T >
int pargemslr::CommunicationHelperClass::DataTransferOver ( VectorVirtualClass< T > &  vec_out,
int  loc_out 
)

Finish communication using the buffer inside this comm helper.

Parameters
[out]vec_outThe vector we recv information to. Space should be reserved before calling this function.
[in]loc_outThe data location of the output data.
Returns
Return error information.

◆ DataTransferOverReverse()

template<typename T >
template int pargemslr::CommunicationHelperClass::DataTransferOverReverse ( VectorVirtualClass< T > &  vec_out,
int  loc_out 
)

Finish communication using the buffer inside this comm helper in the opposite direction.

Parameters
[out]vec_outThe vector we recv information to. Space should be reserved before calling this function.
[in]loc_outThe data location of the output data.
Returns
Return error information.

◆ DataTransferReverse()

template<typename T >
template int pargemslr::CommunicationHelperClass::DataTransferReverse ( const VectorVirtualClass< T > &  vec_in,
VectorVirtualClass< T > &  vec_out,
int  loc_in,
int  loc_out 
)

Apply communication using the buffer inside this comm helper in the opposite direction.

Parameters
[in]vec_inThe vector we send information from.
[out]vec_outThe vector we recv information to. Space should be reserved before calling this function.
[in]loc_inThe data location of the input data.
[in]loc_outThe data location of the output data.
Returns
Return error information.

◆ DataTransferStart() [1/2]

template<typename T , class VectorType >
int pargemslr::CommunicationHelperClass::DataTransferStart ( const std::vector< VectorType > &  vec_in,
int  loc_in 
)

Start communication using the buffer inside this comm helper.

Note
Need to call DataTransferOver function to make sure the communication finished.
Parameters
[in]vec_inThe 2D vector we send information from.
[in]loc_inThe data location of the input data. For 2D array, this is the second dimension. The fist dimention std::vector is always on the host.
Returns
Return error information.

◆ DataTransferStart() [2/2]

template<typename T >
int pargemslr::CommunicationHelperClass::DataTransferStart ( const VectorVirtualClass< T > &  vec_in,
int  loc_in 
)

Start communication using the buffer inside this comm helper.

Note
Need to call DataTransferOver function to make sure the communication finished.
Parameters
[in]vec_inThe vector we send information from.
[in]loc_inThe data location of the input data.
Returns
Return error information.

◆ DataTransferStartReverse()

template<typename T >
template int pargemslr::CommunicationHelperClass::DataTransferStartReverse ( const VectorVirtualClass< T > &  vec_in,
int  loc_in 
)

Start communication using the buffer inside this comm helper in the opposite direction.

Note
Need to call DataTransferOver function to make sure the communication finished.
Parameters
[in]vec_inThe vector we send information from.
[in]loc_inThe data location of the input data.
Returns
Return error information.

◆ MoveData()

int pargemslr::CommunicationHelperClass::MoveData ( int  location)

Move the index data to other location in the memory.

Returns
Return error message.

◆ MoveRecvData()

int pargemslr::CommunicationHelperClass::MoveRecvData ( int  location)

Move the recv data to other location in the memory.

Returns
Return error message.

◆ MoveSendData()

int pargemslr::CommunicationHelperClass::MoveSendData ( int  location)

Move the send data to other location in the memory.

Returns
Return error message.

◆ operator=() [1/2]

CommunicationHelperClass & pargemslr::CommunicationHelperClass::operator= ( CommunicationHelperClass &&  comm_helper)

The = operator of CommunicationHelperClass.

Parameters
[in]comm_helperThe target CommunicationHelperClass.
Returns
Return the CommunicationHelperClass.

◆ operator=() [2/2]

CommunicationHelperClass & pargemslr::CommunicationHelperClass::operator= ( const CommunicationHelperClass comm_helper)

The = operator of CommunicationHelperClass.

Parameters
[in]comm_helperThe target CommunicationHelperClass.
Returns
Return the CommunicationHelperClass.

Member Data Documentation

◆ _idx_helper_v2

std::vector<vector_int > pargemslr::CommunicationHelperClass::_idx_helper_v2

Helper array for building the comm helper.

◆ _is_nbhd_built

bool pargemslr::CommunicationHelperClass::_is_nbhd_built

If the neiborhood information (send_to and recv_from) is set in advance.

◆ _is_ready

bool pargemslr::CommunicationHelperClass::_is_ready

Is true when the comm_helper ready to use.

◆ _is_waiting

bool pargemslr::CommunicationHelperClass::_is_waiting

Is true when there is communication on going.

◆ _n_in

int pargemslr::CommunicationHelperClass::_n_in

The size of the input vector.

◆ _n_out

int pargemslr::CommunicationHelperClass::_n_out

The size of the output vector.

◆ _recv_from_v

vector_int pargemslr::CommunicationHelperClass::_recv_from_v

The vector stores the MPI ranks that myid needs to recv external vector from.

◆ _recv_idx_v2

std::vector<vector_int > pargemslr::CommunicationHelperClass::_recv_idx_v2

2D vector, recv_idx_v2[i] is the index in external vector that need to be received from proc. i.
The external vector can be directly used in matvec with offd_mat of trans(offd_mat) depending on the type of the current matvec helper.

◆ _requests_v

vector<MPI_Request> pargemslr::CommunicationHelperClass::_requests_v

Vector of MPI_Request for communication.

◆ _send_idx_v2

std::vector<vector_int > pargemslr::CommunicationHelperClass::_send_idx_v2

2D vector, send_idx_v2[i] is the index in local vector that need to be sent to proc. i.

◆ _send_to_v

vector_int pargemslr::CommunicationHelperClass::_send_to_v

The vector stores the MPI ranks that myid needs to send local vector to.


The documentation for this class was generated from the following files: