Go to the documentation of this file.
14 #ifndef COMMUNICATOR_INCLUDED
15 #define COMMUNICATOR_INCLUDED
62 static int init(
int *pargc,
char ***pargv);
88 static int setup(
int ninstance = 1);
98 static int setup(
const std::vector<int>& lattice_size,
99 std::vector<int>& grid_size,
108 static int nodeid() {
return self(); }
111 #ifdef ENABLE_MULTI_INSTANCE
112 static int self_global();
113 static int world_id();
117 static int ipe(
const int dir);
118 static int npe(
const int dir);
130 #ifdef ENABLE_MULTI_INSTANCE
131 static int sync_global();
135 static int broadcast(
int count, dcomplex *data,
int sender);
136 static int broadcast(
int count,
double *data,
int sender);
137 static int broadcast(
int count,
float *data,
int sender);
138 static int broadcast(
int count,
int *data,
int sender);
139 static int broadcast(
int count,
string& data,
int sender);
141 static int exchange(
int count, dcomplex *recv_buf, dcomplex *send_buf,
int idir,
int ipm,
int tag);
142 static int exchange(
int count,
double *recv_buf,
double *send_buf,
int idir,
int ipm,
int tag);
143 static int exchange(
int count,
float *recv_buf,
float *send_buf,
int idir,
int ipm,
int tag);
144 static int exchange(
int count,
int *recv_buf,
int *send_buf,
int idir,
int ipm,
int tag);
146 static int send_1to1(
int count, dcomplex *recv_buf, dcomplex *send_buf,
int p_to,
int p_from,
int tag);
147 static int send_1to1(
int count,
double *recv_buf,
double *send_buf,
int p_to,
int p_from,
int tag);
148 static int send_1to1(
int count,
float *recv_buf,
float *send_buf,
int p_to,
int p_from,
int tag);
149 static int send_1to1(
int count,
int *recv_buf,
int *send_buf,
int p_to,
int p_from,
int tag);
151 static int reduce_sum(
int count, dcomplex *recv_buf, dcomplex *send_buf,
int pattern = 0);
152 static int reduce_sum(
int count,
double *recv_buf,
double *send_buf,
int pattern = 0);
153 static int reduce_sum(
int count,
float *recv_buf,
float *send_buf,
int pattern = 0);
154 static int reduce_sum(
int count,
int *recv_buf,
int *send_buf,
int pattern = 0);
156 static int reduce_max(
int count,
double *recv_buf,
double *send_buf,
int pattern = 0);
157 static int reduce_max(
int count,
float *recv_buf,
float *send_buf,
int pattern = 0);
158 static int reduce_max(
int count,
int *recv_buf,
int *send_buf,
int pattern = 0);
160 static int reduce_min(
int count,
double *recv_buf,
double *send_buf,
int pattern = 0);
161 static int reduce_min(
int count,
float *recv_buf,
float *send_buf,
int pattern = 0);
162 static int reduce_min(
int count,
int *recv_buf,
int *send_buf,
int pattern = 0);
180 static Channel *
send_init(
int count,
int idir,
int ipm);
181 static Channel *
recv_init(
int count,
int idir,
int ipm);
184 static Channel *
send_init(
int count,
int idir,
int ipm,
void *buf);
185 static Channel *
recv_init(
int count,
int idir,
int ipm,
void *buf);
199 static int exchange(
size_t size,
void *recv_buf,
void *send_buf,
int idir,
int ipm,
int tag);
201 static int send_1to1(
size_t size,
void *recv_buf,
void *send_buf,
int send_to,
int recv_from,
int tag);
static int sync()
synchronize within small world.
static Channel * recv_init(int count, int idir, int ipm)
static double get_time()
obtain a wall-clock time.
static int reduce_max(int count, double *recv_buf, double *send_buf, int pattern=0)
find a global maximum of an array of double over the communicator. pattern specifies the dimensions t...
static int broadcast(size_t size, void *data, int sender)
static int broadcast(int count, dcomplex *data, int sender)
broadcast array of dcomplex from sender.
static int size()
size of small world.
static int grid_dims(int *grid_dims)
find grid dimensions.
static int exchange(size_t size, void *recv_buf, void *send_buf, int idir, int ipm, int tag)
static bool is_primary_master()
check if the present node is primary in global communicator.
Communicator & operator=(const Communicator &)
static int sync_usleep()
synchronize within small world. (slow but no busy wait)
static int setup(int ninstance=1)
setup communicator
static int reduce_sum(int count, dcomplex *recv_buf, dcomplex *send_buf, int pattern=0)
make a global sum of an array of dcomplex over the communicator. pattern specifies the dimensions to ...
static Channel * send_init(int count, int idir, int ipm)
static int npe(const int dir)
logical grid extent
static void abort()
terminate communicator
static int reduce_min(int count, double *recv_buf, double *send_buf, int pattern=0)
find a global minimum of an array of double over the communicator. pattern specifies the dimensions t...
static int send_1to1(size_t size, void *recv_buf, void *send_buf, int send_to, int recv_from, int tag)
static int send_1to1(int count, dcomplex *recv_buf, dcomplex *send_buf, int p_to, int p_from, int tag)
send array of dcomplex from rank p_from to rank p_to. communication distinguished by tag.
static bool is_primary()
check if the present node is primary in small communicator.
Communication library which wraps MPI.
Communicator()
no instance at all
static int finalize()
finalize communicator
static int ipe(const int dir)
logical coordinate of current proc.
static int grid_coord(int *grid_coord, const int rank)
find grid coordinate from rank number.
static int init(int *pargc, char ***pargv)
initialize communicator
static int exchange(int count, dcomplex *recv_buf, dcomplex *send_buf, int idir, int ipm, int tag)
receive array of dcomplex from upstream specified by idir and ipm, and send array to downstream.
static int grid_rank(int *rank, const int *grid_coord)
find rank number from grid coordinate.
Communicator(const Communicator &)