-
Notifications
You must be signed in to change notification settings - Fork 0
/
dawgsMain.cpp
566 lines (466 loc) · 19.5 KB
/
dawgsMain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
/*
The MIT License (MIT)
Copyright (c) 2017-2022 Tim Warburton, Noel Chalmers, Jesse Chan, Ali Karakus
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "dawgs.hpp"
#include <random>
dfloat CheckCorrectness(const int N,
memory<dfloat> qtest,
memory<dfloat> qcheck,
const memory<hlong> ids,
comm_t comm) {
for (dlong n=0;n<N;n++) {
if (fabs(qtest[n]-qcheck[n])>1.0e-6) {
printf("Rank %d, Entry %d, baseId %lld q = %f, qRef = %f \n", comm.rank(), n, ids[n], qtest[n], qcheck[n]);
}
}
dfloat err=0.0;
for (dlong n=0;n<N;n++) err += fabs(qtest[n]-qcheck[n]);
comm.Allreduce(err);
return err;
}
memory<hlong> MakeIds(dawgsSettings_t &settings) {
comm_t& comm = settings.comm;
//number of MPI ranks
int size = comm.size();
//global MPI rank
int rank = comm.rank();
// find a factorization size = size_x*size_y*size_z such that
// size_x>=size_y>=size_z are all 'close' to one another
int size_x, size_y, size_z;
Factor3(size, size_x, size_y, size_z);
//determine (x,y,z) rank coordinates for this processes
int rank_x=-1, rank_y=-1, rank_z=-1;
RankDecomp3(size_x, size_y, size_z,
rank_x, rank_y, rank_z,
rank);
//get polynomial degree
int N=0;
settings.getSetting("POLYNOMIAL DEGREE", N);
//get global size from settings
int NX=0, NY=0, NZ=0;
settings.getSetting("BOX NX", NX);
settings.getSetting("BOX NY", NY);
settings.getSetting("BOX NZ", NZ);
//get local size from settings
int nx=0, ny=0, nz=0;
settings.getSetting("LOCAL BOX NX", nx);
settings.getSetting("LOCAL BOX NY", ny);
settings.getSetting("LOCAL BOX NZ", nz);
// if (NX*NY*NZ <= 0) { //if the user hasn't given global sizes
// //set global size by multiplying local size by grid dims
NX = nx * size_x;
NY = ny * size_y;
NZ = nz * size_z;
// settings.changeSetting("BOX NX", std::to_string(NX));
// settings.changeSetting("BOX NY", std::to_string(NY));
// settings.changeSetting("BOX NZ", std::to_string(NZ));
// } else {
//WARNING setting global sizes on input overrides any local sizes provided
nx = NX/size_x + ((rank_x < (NX % size_x)) ? 1 : 0);
ny = NY/size_y + ((rank_y < (NY % size_y)) ? 1 : 0);
nz = NZ/size_z + ((rank_z < (NZ % size_z)) ? 1 : 0);
// }
dlong Nelements = nx*ny*nz;
//find what global offsets my indices will start at
hlong NX_offset = rank_x * (NX/size_x) + ((rank_x < (NX % size_x)) ? rank_x : (NX % size_x));
hlong NY_offset = rank_y * (NY/size_y) + ((rank_y < (NY % size_y)) ? rank_y : (NY % size_y));
hlong NZ_offset = rank_z * (NZ/size_z) + ((rank_z < (NZ % size_z)) ? rank_z : (NZ % size_z));
int Nq = N+1; //number of points in 1D
int Np = Nq*Nq*Nq; //number of points in full cube
if (rank==0) {
std::cout << "Ranks = " << size << ", ";
std::cout << "Global DOFS = " << Np*NX*NY*NZ << ", ";
std::cout << "Max Local DOFS = " << Np*Nelements << ", ";
std::cout << "Degree = " << N << std::endl;
}
//Now make array of global indices mimiking a 3D box of cube elements
memory<hlong> ids(Nelements*Np);
for (int K=0;K<nz;K++) {
for (int J=0;J<ny;J++) {
for (int I=0;I<nx;I++) {
hlong *ids_e = ids.ptr() + (I + J*nx + K*nx*ny)*Np;
hlong baseId = (I + NX_offset)*N
+ (J + NY_offset)*N*(N*NX+1)
+ (K + NZ_offset)*N*(N*NX+1)*(N*NY+1)
+ 1; //0 indcies are ignored, so shift everything by 1
for (int k=0;k<Nq;k++) {
for (int j=0;j<Nq;j++) {
for (int i=0;i<Nq;i++) {
ids_e[i+j*Nq+k*Nq*Nq] = i + j*(N*NX+1) + k*(N*NX+1)*(N*NY+1) + baseId;
}
}
}
}
}
}
return ids;
}
void PerformanceTest(platform_t &platform,
comm_t comm,
const int N,
memory<hlong> ids,
ogs::Method method) {
int rank = comm.rank();
int size = comm.size();
int K = 1;
dlong Ndofs = ids.length();
//make an array
memory<dfloat> q(K*Ndofs);
/*Create rng*/
std::mt19937 RNG = std::mt19937(comm.rank());
std::uniform_real_distribution<> distrib(-0.25, 0.25);
//fill with random numbers
for (dlong n=0;n<K*Ndofs;n++) q[n]=distrib(RNG);
//make a device array o_q, copying q from host on creation
deviceMemory<dfloat> o_q = platform.malloc<dfloat>(K*Ndofs, q);
bool verbose=true;
bool unique = false;
ogs::ogs_t ogs;
ogs.Setup(Ndofs, ids, comm, ogs::Unsigned,
method, unique, verbose, platform);
unique = true;
ogs::ogs_t sogs;
sogs.Setup(Ndofs, ids, comm, ogs::Signed,
method, unique, verbose, platform);
deviceMemory<dfloat> o_gq = platform.malloc<dfloat>(K*sogs.Ngather);
memory<dfloat> gq(K*sogs.Ngather);
int Nwarmup = 10;
int Ntests = 20;
timePoint_t start, end;
double elapsedTime;
for (int n=0;n<Nwarmup;n++) {
ogs.GatherScatter(q, K, ogs::Add, ogs::Sym);
}
start = GlobalPlatformTime(platform);
for (int n=0;n<Ntests;n++) {
ogs.GatherScatter(q, K, ogs::Add, ogs::Sym);
}
end = GlobalPlatformTime(platform);
elapsedTime = ElapsedTime(start, end)/Ntests;
if (rank==0) {
std::cout << "Host GatherScatter: Ranks = " << size << ", ";
std::cout << "Global DOFS = " << ogs.NgatherGlobal << ", ";
std::cout << "Max Local DOFS = " << Ndofs << ", ";
std::cout << "Degree = " << N << ", ";
std::cout << "Time taken = " << elapsedTime << " s, ";
std::cout << "DOFS/s = " << (ogs.NgatherGlobal)/elapsedTime << ", ";
std::cout << "DOFS/(s*rank) = " << (ogs.NgatherGlobal)/(elapsedTime*size) << std::endl;
}
for (int n=0;n<Nwarmup;n++) {
ogs.GatherScatter(o_q, K, ogs::Add, ogs::Sym);
}
start = GlobalPlatformTime(platform);
for (int n=0;n<Ntests;n++) {
ogs.GatherScatter(o_q, K, ogs::Add, ogs::Sym);
}
end = GlobalPlatformTime(platform);
elapsedTime = ElapsedTime(start, end)/Ntests;
if (rank==0) {
std::cout << "Device GatherScatter: Ranks = " << size << ", ";
std::cout << "Global DOFS = " << ogs.NgatherGlobal << ", ";
std::cout << "Max Local DOFS = " << Ndofs << ", ";
std::cout << "Degree = " << N << ", ";
std::cout << "Time taken = " << elapsedTime << " s, ";
std::cout << "DOFS/s = " << (ogs.NgatherGlobal)/elapsedTime << ", ";
std::cout << "DOFS/(s*rank) = " << (ogs.NgatherGlobal)/(elapsedTime*size) << std::endl;
}
for (int n=0;n<Nwarmup;n++) {
sogs.Gather(gq, q, K, ogs::Add, ogs::Trans);
}
start = GlobalPlatformTime(platform);
for (int n=0;n<Ntests;n++) {
sogs.Gather(gq, q, K, ogs::Add, ogs::Trans);
}
end = GlobalPlatformTime(platform);
elapsedTime = ElapsedTime(start, end)/Ntests;
if (rank==0) {
std::cout << "Host Gather: Ranks = " << size << ", ";
std::cout << "Global DOFS = " << ogs.NgatherGlobal << ", ";
std::cout << "Max Local DOFS = " << Ndofs << ", ";
std::cout << "Degree = " << N << ", ";
std::cout << "Time taken = " << elapsedTime << " s, ";
std::cout << "DOFS/s = " << (ogs.NgatherGlobal)/elapsedTime << ", ";
std::cout << "DOFS/(s*rank) = " << (ogs.NgatherGlobal)/(elapsedTime*size) << std::endl;
}
for (int n=0;n<Nwarmup;n++) {
sogs.Gather(o_gq, o_q, K, ogs::Add, ogs::Trans);
}
start = GlobalPlatformTime(platform);
for (int n=0;n<Ntests;n++) {
sogs.Gather(o_gq, o_q, K, ogs::Add, ogs::Trans);
}
end = GlobalPlatformTime(platform);
elapsedTime = ElapsedTime(start, end)/Ntests;
if (rank==0) {
std::cout << "Device Gather: Ranks = " << size << ", ";
std::cout << "Global DOFS = " << ogs.NgatherGlobal << ", ";
std::cout << "Max Local DOFS = " << Ndofs << ", ";
std::cout << "Degree = " << N << ", ";
std::cout << "Time taken = " << elapsedTime << " s, ";
std::cout << "DOFS/s = " << (ogs.NgatherGlobal)/elapsedTime << ", ";
std::cout << "DOFS/(s*rank) = " << (ogs.NgatherGlobal)/(elapsedTime*size) << std::endl;
}
for (int n=0;n<Nwarmup;n++) {
sogs.Scatter(q, gq, K, ogs::NoTrans);
}
start = GlobalPlatformTime(platform);
for (int n=0;n<Ntests;n++) {
sogs.Scatter(q, gq, K, ogs::NoTrans);
}
end = GlobalPlatformTime(platform);
elapsedTime = ElapsedTime(start, end)/Ntests;
if (rank==0) {
std::cout << "Host Scatter: Ranks = " << size << ", ";
std::cout << "Global DOFS = " << ogs.NgatherGlobal << ", ";
std::cout << "Max Local DOFS = " << Ndofs << ", ";
std::cout << "Degree = " << N << ", ";
std::cout << "Time taken = " << elapsedTime << " s, ";
std::cout << "DOFS/s = " << (ogs.NgatherGlobal)/elapsedTime << ", ";
std::cout << "DOFS/(s*rank) = " << (ogs.NgatherGlobal)/(elapsedTime*size) << std::endl;
}
for (int n=0;n<Nwarmup;n++) {
sogs.Scatter(o_q, o_gq, K, ogs::NoTrans);
}
start = GlobalPlatformTime(platform);
for (int n=0;n<Ntests;n++) {
sogs.Scatter(o_q, o_gq, K, ogs::NoTrans);
}
end = GlobalPlatformTime(platform);
elapsedTime = ElapsedTime(start, end)/Ntests;
if (rank==0) {
std::cout << "Device Scatter: Ranks = " << size << ", ";
std::cout << "Global DOFS = " << ogs.NgatherGlobal << ", ";
std::cout << "Max Local DOFS = " << Ndofs << ", ";
std::cout << "Degree = " << N << ", ";
std::cout << "Time taken = " << elapsedTime << " s, ";
std::cout << "DOFS/s = " << (ogs.NgatherGlobal)/elapsedTime << ", ";
std::cout << "DOFS/(s*rank) = " << (ogs.NgatherGlobal)/(elapsedTime*size) << std::endl;
}
}
void CorrectnessTest(platform_t &platform,
comm_t comm,
memory<hlong> ids,
ogs::Method method) {
int K = 1;
dlong Ndofs = ids.length();
//make an array
memory<dfloat> q(K*Ndofs);
/*Create rng*/
std::mt19937 RNG = std::mt19937(comm.rank());
std::uniform_real_distribution<> distrib(-0.25, 0.25);
//fill with random numbers
for (dlong n=0;n<K*Ndofs;n++) q[n]=distrib(RNG);
//make a device array o_q, copying q from host on creation
deviceMemory<dfloat> o_q = platform.malloc<dfloat>(K*Ndofs, q);
//make a host gs handle (calls gslib)
int verbose = 0;
int iunique = 0;
void *gsHandle = gsSetup(comm.comm(), Ndofs, ids.ptr(), iunique, verbose);
ogs::ogs_t ogs;
ogs::ogs_t sogs;
//populate an array with the result we expect
memory<dfloat> qcheck(K*Ndofs);
deviceMemory<dfloat> o_gq;
memory<dfloat> gq;
//make the golden result
int transpose = 0;
qcheck.copyFrom(q);
gsGatherScatterVec(qcheck.ptr(), K, gsHandle, transpose);
dfloat err;
memory<dfloat> qtest(K*Ndofs);
verbose=true;
bool unique = false;
ogs.Setup(Ndofs, ids, comm, ogs::Unsigned,
method, unique, verbose, platform);
unique = true;
sogs.Setup(Ndofs, ids, comm, ogs::Signed,
method, unique, verbose, platform);
o_gq = platform.malloc<dfloat>(K*sogs.Ngather);
gq.malloc(K*sogs.Ngather);
o_q.copyFrom(q);
ogs.GatherScatter(o_q, K, ogs::Add, ogs::Sym);
o_q.copyTo(qtest);
err = CheckCorrectness(K*Ndofs, qtest, qcheck, ids, comm);
if (comm.rank()==0) {
std::cout << "Device GatherScatter: Error = " << err << std::endl;
}
qtest.copyFrom(q);
ogs.GatherScatter(qtest, K, ogs::Add, ogs::Sym);
err = CheckCorrectness(K*Ndofs, qtest, qcheck, ids, comm);
if (comm.rank()==0) {
std::cout << "Host GatherScatter: Error = " << err << std::endl;
}
o_q.copyFrom(q);
sogs.GatherScatter(o_q, K, ogs::Add, ogs::Sym);
o_q.copyTo(qtest);
err = CheckCorrectness(K*Ndofs, qtest, qcheck, ids, comm);
if (comm.rank()==0) {
std::cout << "Device GatherScatter: Error = " << err << std::endl;
}
qtest.copyFrom(q);
sogs.GatherScatter(qtest, K, ogs::Add, ogs::Sym);
err = CheckCorrectness(K*Ndofs, qtest, qcheck, ids, comm);
if (comm.rank()==0) {
std::cout << "Host GatherScatter: Error = " << err << std::endl;
}
o_q.copyFrom(q);
sogs.Gather (o_gq, o_q, K, ogs::Add, ogs::Trans);
sogs.Scatter(o_q, o_gq, K, ogs::NoTrans);
o_q.copyTo(qtest);
err = CheckCorrectness(K*Ndofs, qtest, qcheck, ids, comm);
if (comm.rank()==0) {
std::cout << "Device Gather+Scatter: Error = " << err << std::endl;
}
sogs.Gather (gq, q, K, ogs::Add, ogs::Trans);
sogs.Scatter(qtest, gq, K, ogs::NoTrans);
err = CheckCorrectness(K*Ndofs, qtest, qcheck, ids, comm);
if (comm.rank()==0) {
std::cout << "Host Gather+Scatter: Error = " << err << std::endl;
}
gsFree(gsHandle);
}
int main(int argc, char **argv){
// start up MPI
comm_t::Init(argc, argv);
{
comm_t comm(comm_t::world().Dup());
//parse run settings from cmd line
dawgsSettings_t settings(argc, argv, comm);
// set up platform (wraps OCCA device)
platform_t platform(settings);
//Trigger JIT kernel builds
ogs::InitializeKernels(platform, ogs::Dfloat, ogs::Add);
if (settings.compareSetting("VERBOSE", "TRUE"))
settings.report();
bool sweep;
sweep = settings.compareSetting("SWEEP", "TRUE");
bool check;
check = settings.compareSetting("CORRECTNESS CHECK", "TRUE");
if (!sweep) {
//get polynomial degree
int N;
settings.getSetting("POLYNOMIAL DEGREE", N);
memory<hlong> ids;
if (check) {
if (settings.compareSetting("METHOD", "Pairwise")) {
if (comm.rank()==0) std::cout << " ---- Pairwise ----" << std::endl;
ids = MakeIds(settings);
CorrectnessTest(platform, comm, ids, ogs::Pairwise);
} else if (settings.compareSetting("METHOD", "Alltoall")) {
if (comm.rank()==0) std::cout << " ---- Alltoall ----" << std::endl;
ids = MakeIds(settings);
CorrectnessTest(platform, comm, ids, ogs::AllToAll);
if (comm.rank()==0) std::cout << " ---- CrystalRouter ----" << std::endl;
} else if (settings.compareSetting("METHOD", "CrystalRouter")) {
ids = MakeIds(settings);
CorrectnessTest(platform, comm, ids, ogs::CrystalRouter);
} else {
if (comm.rank()==0) std::cout << " ---- Pairwise ----" << std::endl;
ids = MakeIds(settings);
CorrectnessTest(platform, comm, ids, ogs::Pairwise);
if (comm.rank()==0) std::cout << " ---- Alltoall ----" << std::endl;
ids = MakeIds(settings);
CorrectnessTest(platform, comm, ids, ogs::AllToAll);
if (comm.rank()==0) std::cout << " ---- CrystalRouter ----" << std::endl;
ids = MakeIds(settings);
CorrectnessTest(platform, comm, ids, ogs::CrystalRouter);
if (comm.rank()==0) std::cout << " ---- Auto ----" << std::endl;
ids = MakeIds(settings);
CorrectnessTest(platform, comm, ids, ogs::Auto);
}
} else {
if (settings.compareSetting("METHOD", "Pairwise")) {
if (comm.rank()==0) std::cout << " ---- Pairwise ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::Pairwise);
} else if (settings.compareSetting("METHOD", "Alltoall")) {
if (comm.rank()==0) std::cout << " ---- Alltoall ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::AllToAll);
if (comm.rank()==0) std::cout << " ---- CrystalRouter ----" << std::endl;
} else if (settings.compareSetting("METHOD", "CrystalRouter")) {
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::CrystalRouter);
} else {
if (comm.rank()==0) std::cout << " ---- Pairwise ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::Pairwise);
if (comm.rank()==0) std::cout << " ---- Alltoall ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::AllToAll);
if (comm.rank()==0) std::cout << " ---- CrystalRouter ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::CrystalRouter);
if (comm.rank()==0) std::cout << " ---- Auto ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::Auto);
}
}
} else {
//sweep through lots of tests
std::vector<int> NN_low { 2, 2, 2, 2, 2, 2, 2, 2};
std::vector<int> NN_high{122,102, 82, 62, 54, 38, 28, 28};
std::vector<int> NN_step{ 8, 4, 4, 4, 4, 2, 2, 2};
settings.changeSetting("BOX NX", std::to_string(-1));
settings.changeSetting("BOX NY", std::to_string(-1));
settings.changeSetting("BOX NZ", std::to_string(-1));
for (int N=1;N<9;N++) {
settings.changeSetting("POLYNOMIAL DEGREE", std::to_string(N));
const int low = NN_low[N-1];
const int high = NN_high[N-1];
const int step = NN_step[N-1];
for (int NN=low;NN<=high;NN+=step) {
settings.changeSetting("LOCAL BOX NX", std::to_string(NN));
settings.changeSetting("LOCAL BOX NY", std::to_string(NN));
settings.changeSetting("LOCAL BOX NZ", std::to_string(NN));
memory<hlong> ids;
if (settings.compareSetting("METHOD", "Pairwise")) {
if (comm.rank()==0) std::cout << " ---- Pairwise ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::Pairwise);
} else if (settings.compareSetting("METHOD", "Alltoall")) {
if (comm.rank()==0) std::cout << " ---- Alltoall ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::AllToAll);
if (comm.rank()==0) std::cout << " ---- CrystalRouter ----" << std::endl;
} else if (settings.compareSetting("METHOD", "CrystalRouter")) {
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::CrystalRouter);
} else {
if (comm.rank()==0) std::cout << " ---- Pairwise ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::Pairwise);
if (comm.rank()==0) std::cout << " ---- Alltoall ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::AllToAll);
if (comm.rank()==0) std::cout << " ---- CrystalRouter ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::CrystalRouter);
if (comm.rank()==0) std::cout << " ---- Auto ----" << std::endl;
ids = MakeIds(settings);
PerformanceTest(platform, comm, N, ids, ogs::Auto);
}
}
}
}
}
// close down MPI
comm_t::Finalize();
return LIBP_SUCCESS;
}