ParGeMSLR
Classes | Macros | Typedefs | Functions
parallel.hpp File Reference

Parallel related data structures and functions. More...

#include <assert.h>
#include <mpi.h>
#include <vector>
#include "utils.hpp"

Go to the source code of this file.

Classes

class  pargemslr::ParallelLogClass
 The data structure for parallel computing, including data structures for MPI and CUDA. More...
 

Macros

#define PARGEMSLR_TIMES_NUM   60
 
#define PARGEMSLR_BUILDTIME_PARTITION   0
 
#define PARGEMSLR_BUILDTIME_IE   1
 
#define PARGEMSLR_BUILDTIME_METIS   2
 
#define PARGEMSLR_BUILDTIME_STRUCTURE   3
 
#define PARGEMSLR_BUILDTIME_RCM   4
 
#define PARGEMSLR_BUILDTIME_ILUT   5
 
#define PARGEMSLR_BUILDTIME_LRC   6
 
#define PARGEMSLR_BUILDTIME_ARNOLDI   7
 
#define PARGEMSLR_BUILDTIME_BUILD_RES   8
 
#define PARGEMSLR_BUILDTIME_SOLVELU   9
 
#define PARGEMSLR_BUILDTIME_SOLVELU_L   10
 
#define PARGEMSLR_BUILDTIME_SOLVELR   11
 
#define PARGEMSLR_BUILDTIME_SOLVEEBFC   12
 
#define PARGEMSLR_BUILDTIME_EXTRACTMAT   13
 
#define PARGEMSLR_BUILDTIME_MOVEDATA   14
 
#define PARGEMSLR_BUILDTIME_LOCALPERM   15
 
#define PARGEMSLR_BUILDTIME_EMV   16
 
#define PARGEMSLR_BUILDTIME_FMV   17
 
#define PARGEMSLR_BUILDTIME_GEN_MAT   18
 
#define PARGEMSLR_BUILDTIME_DECOMP   19
 
#define PARGEMSLR_BUILDTIME_MGS   20
 
#define PARGEMSLR_BUILDTIME_EBFC   21
 
#define PARGEMSLR_PRECTIME_PRECOND   30
 
#define PARGEMSLR_PRECTIME_ILUT   31
 
#define PARGEMSLR_PRECTIME_ILUT_L   32
 
#define PARGEMSLR_PRECTIME_LRC   33
 
#define PARGEMSLR_PRECTIME_EMV   34
 
#define PARGEMSLR_PRECTIME_FMV   35
 
#define PARGEMSLR_PRECTIME_INNER   36
 
#define PARGEMSLR_PRECTIME_MOVEDATA   37
 
#define PARGEMSLR_PRECTIME_LOCALPERM   38
 
#define PARGEMSLR_ITERTIME_AMV   40
 
#define PARGEMSLR_ITERTIME_MGS   41
 
#define PARGEMSLR_TOTAL_GEN_MAT_TIME   50
 
#define PARGEMSLR_TOTAL_SETUP_TIME   51
 
#define PARGEMSLR_TOTAL_SOLVE_TIME   52
 
#define PARGEMSLR_BUILDTIME_BMV   53
 
#define PARGEMSLR_BUILDTIME_CMV   54
 
#define PARGEMSLR_BUILDTIME_SMV   55
 
#define PARGEMSLR_PRECTIME_BMV   56
 
#define PARGEMSLR_PRECTIME_CMV   57
 
#define PARGEMSLR_PRECTIME_SMV   58
 
#define PARGEMSLR_GLOBAL_FIRM_TIME_CALL(num, ...)
 
#define PARGEMSLR_LOCAL_FIRM_TIME_CALL(num, ...)
 
#define PARGEMSLR_FIRM_TIME_CALL(comm, num, ...)
 
#define PARGEMSLR_GLOBAL_TIME_CALL(num, ...)
 
#define PARGEMSLR_LOCAL_TIME_CALL(num, ...)
 
#define PARGEMSLR_TIME_CALL(comm, num, ...)
 
#define PARGEMSLR_PRINT_TIMING_RESULT(print_level, ...)
 
#define PARGEMSLR_RESET_TIME
 
#define PARGEMSLR_MPI_CALL(...)
 
#define PARGEMSLR_CUDA_SYNCHRONIZE
 
#define PARGEMSLR_GLOBAL_SEQUENTIAL_RUN(...)
 

Typedefs

typedef class pargemslr::ParallelLogClass pargemslr::parallel_log
 The data structure for parallel computing, including data structures for MPI and CUDA. More...
 
typedef class pargemslr::ParallelLogClasspargemslr::parallel_logp
 

Functions

int pargemslr::PargemslrSetOpenmpNumThreads (int nthreads)
 Set the OpenMP thread number for each MPI process. More...
 
int pargemslr::PargemslrNLocalToNGlobal (int n_local, long int &n_start, long int &n_global, MPI_Comm &comm)
 Each MPI rank holds n_local, get the n_start and n_global. More...
 
int pargemslr::PargemslrNLocalToNGlobal (int nrow_local, int ncol_local, long int &nrow_start, long int &ncol_start, long int &nrow_global, long int &ncol_global, MPI_Comm &comm)
 Each MPI rank holds two n_locals, get the n_starts and n_globals. More...
 
int pargemslr::PargemslrInit (int *argc, char ***argv)
 Initilize MPI, OpenMP, and CUDA. Note that if you have already called MPI_Init, call other init functions instead. More...
 
int pargemslr::PargemslrInitMpi (MPI_Comm comm)
 Initilize MPI data struct with MPI_Comm. More...
 
int pargemslr::PargemslrInitOpenMP (int nthreads)
 Initilize OpenMP and MKL. More...
 
int pargemslr::PargemslrInitCUDA ()
 Initilize CUDA. More...
 
int pargemslr::PargemslrPrintParallelInfo ()
 Print the parallel information to output. More...
 
int pargemslr::PargemslrFinalize ()
 Finalize MPI, OpenMP, and CUDA. Note that if you don't want to call MPI_Finalize here, call other finalize functions. More...
 
int pargemslr::PargemslrFinalizeMpi ()
 Finalize MPI data structure. Note that MPI_Finalize won't be called here. More...
 
int pargemslr::PargemslrFinalizeOpenMP ()
 Finalize OpenMP data structure. More...
 
int pargemslr::PargemslrFinalizeCUDA ()
 Finalize CUDA data structure. More...
 
int pargemslr::PargemslrMpiTime (MPI_Comm comm, double &t)
 Get current time using MPI_Wtime. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiIsend (T *buf, int count, int dest, int tag, MPI_Comm comm, MPI_Request *request)
 MPI_Isend. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiIsend (T *buf, int count, int dest, int tag, MPI_Comm comm, MPI_Request *request)
 MPI_Isend. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiIrecv (T *buf, int count, int source, int tag, MPI_Comm comm, MPI_Request *request)
 MPI_Irecv. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiIrecv (T *buf, int count, int source, int tag, MPI_Comm comm, MPI_Request *request)
 MPI_Irecv. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiSend (T *buf, int count, int dest, int tag, MPI_Comm comm)
 MPI_Send. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiSend (T *buf, int count, int dest, int tag, MPI_Comm comm)
 MPI_Send. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiRecv (T *buf, int count, int source, int tag, MPI_Comm comm, MPI_Status *status)
 MPI_Irecv. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiRecv (T *buf, int count, int source, int tag, MPI_Comm comm, MPI_Status *status)
 MPI_Irecv. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiBcast (T *buf, int count, int root, MPI_Comm comm)
 MPI_Bcast. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiBcast (T *buf, int count, int root, MPI_Comm comm)
 MPI_Bcast. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiScan (T *sendbuf, T *recvbuf, int count, MPI_Op op, MPI_Comm comm)
 MPI_Scan. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiScan (T *sendbuf, T *recvbuf, int count, MPI_Op op, MPI_Comm comm)
 MPI_Scan. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiReduce (T *sendbuf, T *recvbuf, int count, MPI_Op op, int root, MPI_Comm comm)
 MPI_Reduce. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiReduce (T *sendbuf, T *recvbuf, int count, MPI_Op op, int root, MPI_Comm comm)
 MPI_Reduce. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllreduce (T *sendbuf, T *recvbuf, int count, MPI_Op op, MPI_Comm comm)
 MPI_Allreduce. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllreduce (T *sendbuf, T *recvbuf, int count, MPI_Op op, MPI_Comm comm)
 MPI_Allreduce. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllreduceInplace (T *buf, int count, MPI_Op op, MPI_Comm comm)
 In place MPI_Allreduce. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllreduceInplace (T *buf, int count, MPI_Op op, MPI_Comm comm)
 In place MPI_Allreduce. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiGather (T *sendbuf, int count, T *recvbuf, int root, MPI_Comm comm)
 MPI_Gather. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiGather (T *sendbuf, int count, T *recvbuf, int root, MPI_Comm comm)
 MPI_Gather. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllgather (T *sendbuf, int count, T *recvbuf, MPI_Comm comm)
 MPI_Allgather. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllgather (T *sendbuf, int count, T *recvbuf, MPI_Comm comm)
 MPI_Allgather. More...
 
template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllgatherv (T *sendbuf, int count, T *recvbuf, int *recvcounts, int *recvdisps, MPI_Comm comm)
 MPI_Allgatherv. More...
 
template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllgatherv (T *sendbuf, int count, T *recvbuf, int *recvcounts, int *recvdisps, MPI_Comm comm)
 MPI_Allgatherv. More...
 
template<typename T >
MPI_Datatype pargemslr::PargemslrMpiDataType ()
 Get the MPI_Datatype. More...
 
template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< int > ()
 Get the MPI_Datatype. More...
 
template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< long int > ()
 Get the MPI_Datatype. More...
 
template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< float > ()
 Get the MPI_Datatype. More...
 
template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< double > ()
 Get the MPI_Datatype. More...
 
template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< complexs > ()
 Get the MPI_Datatype. More...
 
template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< complexd > ()
 Get the MPI_Datatype. More...
 

Macro Definition Documentation

◆ PARGEMSLR_FIRM_TIME_CALL

#define PARGEMSLR_FIRM_TIME_CALL (   comm,
  num,
  ... 
)

◆ PARGEMSLR_GLOBAL_FIRM_TIME_CALL

#define PARGEMSLR_GLOBAL_FIRM_TIME_CALL (   num,
  ... 
)

◆ PARGEMSLR_GLOBAL_SEQUENTIAL_RUN

#define PARGEMSLR_GLOBAL_SEQUENTIAL_RUN (   ...)
Value:
{\
for(int pgsri = 0 ; pgsri < pargemslr::parallel_log::_gsize ; pgsri++)\
{\
if( pargemslr::parallel_log::_grank == pgsri)\
{\
(__VA_ARGS__);\
}\
MPI_Barrier(*(pargemslr::parallel_log::_gcomm));\
}\
}

◆ PARGEMSLR_GLOBAL_TIME_CALL

#define PARGEMSLR_GLOBAL_TIME_CALL (   num,
  ... 
)
Value:
{\
(__VA_ARGS__);\
}

◆ PARGEMSLR_LOCAL_FIRM_TIME_CALL

#define PARGEMSLR_LOCAL_FIRM_TIME_CALL (   num,
  ... 
)

◆ PARGEMSLR_LOCAL_TIME_CALL

#define PARGEMSLR_LOCAL_TIME_CALL (   num,
  ... 
)
Value:
{\
(__VA_ARGS__);\
}

◆ PARGEMSLR_MPI_CALL

#define PARGEMSLR_MPI_CALL (   ...)
Value:
{\
(__VA_ARGS__);\
}

◆ PARGEMSLR_PRINT_TIMING_RESULT

#define PARGEMSLR_PRINT_TIMING_RESULT (   print_level,
  ... 
)
Value:
{\
if(__VA_ARGS__)\
{\
PARGEMSLR_PRINT("\n");\
PargemslrPrintDashLine(pargemslr::pargemslr_global::_dash_line_width);\
PARGEMSLR_PRINT("Time info:\n");\
PARGEMSLR_PRINT("\tLoad matrix time: %fs\n",pargemslr::ParallelLogClass::_times[PARGEMSLR_TOTAL_GEN_MAT_TIME]);\
PARGEMSLR_PRINT("\tPartition time: %fs\n",pargemslr::ParallelLogClass::_times[PARGEMSLR_BUILDTIME_PARTITION]);\
PARGEMSLR_PRINT("\tSetup time: %fs\n",pargemslr::ParallelLogClass::_times[PARGEMSLR_TOTAL_SETUP_TIME]-pargemslr::ParallelLogClass::_times[PARGEMSLR_BUILDTIME_PARTITION]);\
PARGEMSLR_PRINT("\tSolve time: %fs\n",pargemslr::ParallelLogClass::_times[PARGEMSLR_TOTAL_SOLVE_TIME]);\
PARGEMSLR_PRINT("\tTotal time: %fs\n",pargemslr::ParallelLogClass::_times[PARGEMSLR_TOTAL_SETUP_TIME]+pargemslr::ParallelLogClass::_times[PARGEMSLR_TOTAL_SOLVE_TIME]);\
PargemslrPrintDashLine(pargemslr::pargemslr_global::_dash_line_width);\
PARGEMSLR_PRINT("\n");\
}\
}

◆ PARGEMSLR_TIME_CALL

#define PARGEMSLR_TIME_CALL (   comm,
  num,
  ... 
)
Value:
{\
(__VA_ARGS__);\
}

Typedef Documentation

◆ parallel_log

The data structure for parallel computing, including data structures for MPI and CUDA.
All CUDA information are shared, local MPI information can be different.

Function Documentation

◆ PargemslrFinalize()

int pargemslr::PargemslrFinalize ( )

Finalize MPI, OpenMP, and CUDA. Note that if you don't want to call MPI_Finalize here, call other finalize functions.

Returns
Return error message.

◆ PargemslrFinalizeCUDA()

int pargemslr::PargemslrFinalizeCUDA ( )

Finalize CUDA data structure.

Returns
Return error message.

◆ PargemslrFinalizeMpi()

int pargemslr::PargemslrFinalizeMpi ( )

Finalize MPI data structure. Note that MPI_Finalize won't be called here.

Returns
Return error message.

◆ PargemslrFinalizeOpenMP()

int pargemslr::PargemslrFinalizeOpenMP ( )

Finalize OpenMP data structure.

Returns
Return error message.

◆ PargemslrInit()

int pargemslr::PargemslrInit ( int *  argc,
char ***  argv 
)

Initilize MPI, OpenMP, and CUDA. Note that if you have already called MPI_Init, call other init functions instead.

Parameters
[in,out]argcInput of the main function.
[in,out]argvInput of the main function.
Returns
Return error message.

◆ PargemslrInitCUDA()

int pargemslr::PargemslrInitCUDA ( )

Initilize CUDA.

Returns
Return error message.

◆ PargemslrInitMpi()

int pargemslr::PargemslrInitMpi ( MPI_Comm  comm)

Initilize MPI data struct with MPI_Comm. The ParGEMSLR package will duplicate this MPI_Comm.

Parameters
[in]commThe comm for ParGEMSLR, typically should be MPI_COMM_WORLD.
Returns
Return error message.

◆ PargemslrInitOpenMP()

int pargemslr::PargemslrInitOpenMP ( int  nthreads)

Initilize OpenMP and MKL.

Parameters
[in]nthreadsThe max number of OpenMP threads.
Returns
Return error message.

◆ PargemslrMpiAllgather() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllgather ( T *  sendbuf,
int  count,
T *  recvbuf,
MPI_Comm  comm 
)

MPI_Allgather.

Parameters
[in]sendbufPointer to the send data.
[in]countSize of each single send/recv.
[out]recvbufPointer to the recv data.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiAllgather() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllgather ( T *  sendbuf,
int  count,
T *  recvbuf,
MPI_Comm  comm 
)

MPI_Allgather.

Parameters
[in]sendbufPointer to the send data.
[in]countSize of each single send/recv.
[out]recvbufPointer to the recv data.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiAllgatherv() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllgatherv ( T *  sendbuf,
int  count,
T *  recvbuf,
int *  recvcounts,
int *  recvdisps,
MPI_Comm  comm 
)

MPI_Allgatherv.

Parameters
[in]sendbufPointer to the send data.
[in]countSize of each single send/recv.
[out]recvbufPointer to the recv data.
[in]recvcountsNumber of elements on each processor.
[in]recvdispsDisplacement of elements on each processor.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiAllgatherv() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllgatherv ( T *  sendbuf,
int  count,
T *  recvbuf,
int *  recvcounts,
int *  recvdisps,
MPI_Comm  comm 
)

MPI_Allgatherv.

Parameters
[in]sendbufPointer to the send data.
[in]countSize of each single send/recv.
[out]recvbufPointer to the recv data.
[in]recvcountsNumber of elements on each processor.
[in]recvdispsDisplacement of elements on each processor.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiAllreduce() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllreduce ( T *  sendbuf,
T *  recvbuf,
int  count,
MPI_Op  op,
MPI_Comm  comm 
)

MPI_Allreduce.

Parameters
[in]sendbufPointer to the send data.
[out]recvbufPointer to the recv data.
[in]countNumber of elements.
[in]opMPI_Op.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiAllreduce() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllreduce ( T *  sendbuf,
T *  recvbuf,
int  count,
MPI_Op  op,
MPI_Comm  comm 
)

MPI_Allreduce.

Parameters
[in]sendbufPointer to the send data.
[out]recvbufPointer to the recv data.
[in]countNumber of elements.
[in]opMPI_Op.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiAllreduceInplace() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllreduceInplace ( T *  buf,
int  count,
MPI_Op  op,
MPI_Comm  comm 
)

In place MPI_Allreduce.

Parameters
[in,out]bufPointer to the data.
[in]countNumber of elements.
[in]opMPI_Op.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiAllreduceInplace() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiAllreduceInplace ( T *  buf,
int  count,
MPI_Op  op,
MPI_Comm  comm 
)

In place MPI_Allreduce.

Parameters
[in,out]bufPointer to the data.
[in]countNumber of elements.
[in]opMPI_Op.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiBcast() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiBcast ( T *  buf,
int  count,
int  root,
MPI_Comm  comm 
)

MPI_Bcast.

Parameters
[in,out]bufPointer to the data.
[in]countNumber of elements.
[in]rootRoot's MPI rank.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiBcast() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiBcast ( T *  buf,
int  count,
int  root,
MPI_Comm  comm 
)

MPI_Bcast.

Parameters
[in,out]bufPointer to the data.
[in]countNumber of elements.
[in]rootRoot's MPI rank.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiDataType()

template<typename T >
MPI_Datatype pargemslr::PargemslrMpiDataType ( )

Get the MPI_Datatype.

Returns
Return the MPI_Datatype.

◆ PargemslrMpiDataType< complexd >()

template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< complexd > ( )

Get the MPI_Datatype.

Returns
Return the MPI_Datatype.

◆ PargemslrMpiDataType< complexs >()

template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< complexs > ( )

Get the MPI_Datatype.

Returns
Return the MPI_Datatype.

◆ PargemslrMpiDataType< double >()

template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< double > ( )

Get the MPI_Datatype.

Returns
Return the MPI_Datatype.

◆ PargemslrMpiDataType< float >()

template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< float > ( )

Get the MPI_Datatype.

Returns
Return the MPI_Datatype.

◆ PargemslrMpiDataType< int >()

template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< int > ( )

Get the MPI_Datatype.

Returns
Return the MPI_Datatype.

◆ PargemslrMpiDataType< long int >()

template<>
MPI_Datatype pargemslr::PargemslrMpiDataType< long int > ( )

Get the MPI_Datatype.

Returns
Return the MPI_Datatype.

◆ PargemslrMpiGather() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiGather ( T *  sendbuf,
int  count,
T *  recvbuf,
int  root,
MPI_Comm  comm 
)

MPI_Gather.

Parameters
[in]sendbufPointer to the send data.
[in]countSize of each single send/recv.
[out]recvbufPointer to the recv data.
[in]rootThe MPI rank of the reciver.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiGather() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiGather ( T *  sendbuf,
int  count,
T *  recvbuf,
int  root,
MPI_Comm  comm 
)

MPI_Gather.

Parameters
[in]sendbufPointer to the send data.
[in]countSize of each single send/recv.
[out]recvbufPointer to the recv data.
[in]rootThe MPI rank of the reciver.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiIrecv() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiIrecv ( T *  buf,
int  count,
int  source,
int  tag,
MPI_Comm  comm,
MPI_Request *  request 
)

MPI_Irecv.

Parameters
[in]bufPointer to the data.
[in]countNumber of elements.
[in]destRank of the source MPI rank.
[in]tagTag of the message.
[in]commMPI_Comm.
[out]requestMPI_Request.
Returns
Return error message.

◆ PargemslrMpiIrecv() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiIrecv ( T *  buf,
int  count,
int  source,
int  tag,
MPI_Comm  comm,
MPI_Request *  request 
)

MPI_Irecv.

Parameters
[in]bufPointer to the data.
[in]countNumber of elements.
[in]sourceRank of the source MPI rank.
[in]tagTag of the message.
[in]commMPI_Comm.
[out]requestMPI_Request.
Returns
Return error message.

◆ PargemslrMpiIsend() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiIsend ( T *  buf,
int  count,
int  dest,
int  tag,
MPI_Comm  comm,
MPI_Request *  request 
)

MPI_Isend.

Parameters
[in]bufPointer to the data.
[in]countNumber of elements.
[in]destRank of the target MPI rank.
[in]tagTag of the message.
[in]commMPI_Comm.
[out]requestMPI_Request.
Returns
Return error message.

◆ PargemslrMpiIsend() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiIsend ( T *  buf,
int  count,
int  dest,
int  tag,
MPI_Comm  comm,
MPI_Request *  request 
)

MPI_Isend.

Parameters
[in]bufPointer to the data.
[in]countNumber of elements.
[in]destRank of the target MPI rank.
[in]tagTag of the message.
[in]commMPI_Comm.
[out]requestMPI_Request.
Returns
Return error message.

◆ PargemslrMpiRecv() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiRecv ( T *  buf,
int  count,
int  source,
int  tag,
MPI_Comm  comm,
MPI_Status *  status 
)

MPI_Irecv.

Parameters
[in]bufPointer to the data.
[in]countNumber of elements.
[in]sourceRank of the source MPI rank.
[in]tagTag of the message.
[in]commMPI_Comm.
[out]statusMPI_Status.
Returns
Return error message.

◆ PargemslrMpiRecv() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiRecv ( T *  buf,
int  count,
int  source,
int  tag,
MPI_Comm  comm,
MPI_Status *  status 
)

MPI_Irecv.

Parameters
[in]bufPointer to the data.
[in]countNumber of elements.
[in]sourceRank of the source MPI rank.
[in]tagTag of the message.
[in]commMPI_Comm.
[out]statusMPI_Status.
Returns
Return error message.

◆ PargemslrMpiReduce() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiReduce ( T *  sendbuf,
T *  recvbuf,
int  count,
MPI_Op  op,
int  root,
MPI_Comm  comm 
)

MPI_Reduce.

Parameters
[in]sendbufPointer to the send data.
[out]recvbufPointer to the recv data.
[in]countNumber of elements.
[in]opMPI_Op.
[in]rootRoot's MPI rank.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiReduce() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiReduce ( T *  sendbuf,
T *  recvbuf,
int  count,
MPI_Op  op,
int  root,
MPI_Comm  comm 
)

MPI_Reduce.

Parameters
[in]sendbufPointer to the send data.
[out]recvbufPointer to the recv data.
[in]countNumber of elements.
[in]opMPI_Op.
[in]rootRoot's MPI rank.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiScan() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiScan ( T *  sendbuf,
T *  recvbuf,
int  count,
MPI_Op  op,
MPI_Comm  comm 
)

MPI_Scan.

Parameters
[in]sendbufPointer to the send data.
[out]recvbufPointer to the recv data.
[in]countNumber of elements.
[in]opMPI_Op.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiScan() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiScan ( T *  sendbuf,
T *  recvbuf,
int  count,
MPI_Op  op,
MPI_Comm  comm 
)

MPI_Scan.

Parameters
[in]sendbufPointer to the send data.
[out]recvbufPointer to the recv data.
[in]countNumber of elements.
[in]opMPI_Op.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiSend() [1/2]

template<typename T >
std::enable_if<!PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiSend ( T *  buf,
int  count,
int  dest,
int  tag,
MPI_Comm  comm 
)

MPI_Send.

Parameters
[in]bufPointer to the data.
[in]countNumber of elements.
[in]destRank of the target MPI rank.
[in]tagTag of the message.
[in]commMPI_Comm.
Returns
Return error message.

◆ PargemslrMpiSend() [2/2]

template<typename T >
std::enable_if< PargemslrIsComplex< T >::value, int >::type pargemslr::PargemslrMpiSend ( T *  buf,
int  count,
int  dest,
int  tag,
MPI_Comm  comm 
)

MPI_Send.

Parameters
[in]bufPointer to the data.
[in]countNumber of elements.
[in]destRank of the target MPI rank.
[in]tagTag of the message.
[in]commMPI_Comm.
[out]requestMPI_Request.
Returns
Return error message.

◆ PargemslrMpiTime()

int pargemslr::PargemslrMpiTime ( MPI_Comm  comm,
double &  t 
)

Get current time using MPI_Wtime.

Parameters
[in]commThe MPI_Comm.
[out]tThe time.
Returns
Return error message.

◆ PargemslrNLocalToNGlobal() [1/2]

int pargemslr::PargemslrNLocalToNGlobal ( int  n_local,
long int &  n_start,
long int &  n_global,
MPI_Comm &  comm 
)

Each MPI rank holds n_local, get the n_start and n_global.

Parameters
[in]n_localThe local size.
[out]n_startThe start index.
[out]n_globalThe global size.
[out]commThe MPI_comm.
Returns
Return error message.

◆ PargemslrNLocalToNGlobal() [2/2]

int pargemslr::PargemslrNLocalToNGlobal ( int  nrow_local,
int  ncol_local,
long int &  nrow_start,
long int &  ncol_start,
long int &  nrow_global,
long int &  ncol_global,
MPI_Comm &  comm 
)

Each MPI rank holds two n_locals, get the n_starts and n_globals.

Parameters
[in]nrow_localThe first local size.
[in]ncol_localThe second local size.
[out]nrow_startThe first start index.
[out]ncol_startThe second start index.
[out]nrow_globalThe first global size.
[out]ncol_globalThe second global size.
[out]commThe MPI_comm.
Returns
Return error message.

◆ PargemslrPrintParallelInfo()

int pargemslr::PargemslrPrintParallelInfo ( )

Print the parallel information to output.

Returns
Return error message.

◆ PargemslrSetOpenmpNumThreads()

int pargemslr::PargemslrSetOpenmpNumThreads ( int  nthreads)

Set the OpenMP thread number for each MPI process.

Parameters
[in]nthreadsThe number of threads per MPI process.
Returns
Return error message.
pargemslr::ParallelLogClass::_gcomm
static MPI_Comm * _gcomm
The global MPI comm.
Definition: parallel.hpp:321
pargemslr::ParallelLogClass::_times_buffer_start
static vector< double > _times_buffer_start
The std::vector stores the start time of each section.
Definition: parallel.hpp:363
pargemslr::ParallelLogClass::_times_buffer_end
static vector< double > _times_buffer_end
The std::vector stores the end time of each section.
Definition: parallel.hpp:369
pargemslr::ParallelLogClass::_times
static vector< double > _times
The std::vector stores the timing information.
Definition: parallel.hpp:357