49 assert(Ninstance == 1);
58 fprintf(stderr,
"Error at Communicator::setup(): inappropriate grid_size.\n");
68 const std::vector<int>& lattice_size,
69 std::vector<int>& grid_size,
72 int Ndim = lattice_size.size();
74 if (grid_size.size() != Ndim) {
75 grid_size.resize(Ndim, 1);
79 for (
int i = 0; i < Ndim; ++i) {
80 if (grid_size[i] != 1) {
86 printf(
"Error at Communicator: %s: unexpected grid_size.\n", __func__);
123 int Communicator::self_global()
156 for (
int i = 0; i < Ndim; ++i) {
168 for (
int i = 0; i < Ndim; ++i) {
191 int Communicator::sync_global()
243 memcpy(recv_buf, send_buf,
size);
250 memcpy(recv_buf, send_buf,
sizeof(dcomplex) * count);
257 memcpy(recv_buf, send_buf,
sizeof(
double) * count);
264 memcpy(recv_buf, send_buf,
sizeof(
float) * count);
271 memcpy(recv_buf, send_buf,
sizeof(
int) * count);
279 memcpy(recv_buf, send_buf,
size);
284 int Communicator::send_1to1(
int count, dcomplex *recv_buf, dcomplex *send_buf,
int send_to,
int recv_from,
int tag)
286 memcpy(recv_buf, send_buf,
sizeof(dcomplex) * count);
291 int Communicator::send_1to1(
int count,
double *recv_buf,
double *send_buf,
int send_to,
int recv_from,
int tag)
293 memcpy(recv_buf, send_buf,
sizeof(
double) * count);
300 memcpy(recv_buf, send_buf,
sizeof(
float) * count);
307 memcpy(recv_buf, send_buf,
sizeof(
int) * count);
315 memcpy(recv_buf, send_buf,
sizeof(dcomplex) * count);
322 memcpy(recv_buf, send_buf,
sizeof(
double) * count);
329 memcpy(recv_buf, send_buf,
sizeof(
float) * count);
336 memcpy(recv_buf, send_buf,
sizeof(
int) * count);
344 memcpy(recv_buf, send_buf,
sizeof(
double) * count);
351 memcpy(recv_buf, send_buf,
sizeof(
float) * count);
358 memcpy(recv_buf, send_buf,
sizeof(
int) * count);
417 printf(
"Communicator Single\n");
428 if (gettimeofday(&now, (
struct timezone *)0) != 0) {
432 double sec = (double)now.tv_sec + ((
double)now.tv_usec) * 1.0e-6;