ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
parallel_common.h
Go to the documentation of this file.
1#ifndef PARALLEL_COMMON_H
2#define PARALLEL_COMMON_H
3
4#ifdef __MPI
5#include "mpi.h"
6#endif
7
8#include <complex>
9#include <string>
10
11namespace Parallel_Common
12{
13
14#ifdef __MPI
15inline int comm_size(const MPI_Comm comm)
16{
17 int size = 0;
18 MPI_Comm_size(comm, &size);
19 return size;
20}
21#endif
22
23//(1) bcast array
24void bcast_complex_double(std::complex<double>* object, const int n);
25void bcast_string(std::string* object, const int n);
26void bcast_double(double* object, const int n);
27void bcast_int(int* object, const int n);
28void bcast_char(char* object, const int n);
29
30//(2) bcast single
31void bcast_complex_double(std::complex<double>& object);
32void bcast_string(std::string& object);
33void bcast_double(double& object);
34void bcast_int(int& object);
35void bcast_bool(bool& object);
36
37#ifdef __MPI
38//(3) bcast single on an explicit communicator, from the communicator's rank 0
39void bcast_bool(bool& object, const MPI_Comm& comm);
40void bcast_mpi_offset(MPI_Offset& object, const MPI_Comm& comm);
41#endif
42
43} // namespace Parallel_Common
44
45#endif
Definition parallel_common.cpp:10
void bcast_mpi_offset(MPI_Offset &object, const MPI_Comm &comm)
Definition parallel_common.cpp:121
void bcast_complex_double(std::complex< double > &object)
Definition parallel_common.cpp:50
void bcast_bool(bool &object)
Definition parallel_common.cpp:92
void bcast_string(std::string &object)
Definition parallel_common.cpp:22
void bcast_char(char *object, const int n)
Definition parallel_common.cpp:113
void bcast_int(int &object)
Definition parallel_common.cpp:78
void bcast_double(double &object)
Definition parallel_common.cpp:64
int comm_size(const MPI_Comm comm)
Definition parallel_common.h:15