47 #ifndef LIB_MPI_HELPER_H_
48 #define LIB_MPI_HELPER_H_
58 inline MPI_Datatype
mpi_type(
int const &t ) {
return MPI_INT; }
59 inline MPI_Datatype
mpi_type(
long const &t ) {
return MPI_LONG; }
60 inline MPI_Datatype
mpi_type(
unsigned long const &t ) {
return MPI_UNSIGNED_LONG; }
61 inline MPI_Datatype
mpi_type(
long long const &t ) {
return MPI_LONG_LONG; }
62 inline MPI_Datatype
mpi_type(
float const &t ) {
return MPI_FLOAT; }
63 inline MPI_Datatype
mpi_type(
double const &t ) {
return MPI_DOUBLE; }
64 inline MPI_Datatype
mpi_type(
char const &t ) {
return MPI_CHAR; }
65 inline MPI_Datatype
mpi_type(
short const &t ) {
return MPI_SHORT; }
66 inline MPI_Datatype
mpi_type(
unsigned short const &t ) {
return MPI_UNSIGNED_SHORT; }
68 template<
typename T>
inline std::vector<T>
gather(
T t, MPI_Comm comm ) {
70 MPI_Comm_size( comm, &size );
71 MPI_Comm_rank( comm, &rank );
73 if ( rank == 0 ) v.resize( size );
MPI_Datatype mpi_type(T const &t)
std::vector< T > gather(T t, MPI_Comm comm)
Definition: lib_mpi_helper.h:68