forked from SCOREC/redev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_initPtnObjOwnership.cpp
47 lines (42 loc) · 1.4 KB
/
test_initPtnObjOwnership.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
#include <iostream>
#include "redev.h"
const std::string timeout="8";
auto makeRedev(int dim, redev::LOs& ranks, redev::Reals& cuts, bool isRendezvous) {
auto ptn = redev::RCBPtn(dim,ranks,cuts);
return redev::Redev(MPI_COMM_WORLD,ptn,static_cast<redev::ProcessType>(isRendezvous));
}
void client() {
const auto dim = 1;
auto ranks = redev::LOs(1);
auto cuts = redev::Reals(1);
const bool isRendezvous = false;
auto rdv = makeRedev(dim, ranks, cuts, isRendezvous);
adios2::Params params{ {"Streaming", "On"}, {"OpenTimeoutSecs", timeout}};
auto commPair = rdv.CreateAdiosClient<redev::LO>("foo",params,redev::TransportType::BP4);
}
void server() {
const auto dim = 1;
auto ranks = redev::LOs({0});
auto cuts = redev::Reals({0});
const bool isRendezvous=true;
auto rdv = makeRedev(dim, ranks, cuts, isRendezvous);
adios2::Params params{ {"Streaming", "On"}, {"OpenTimeoutSecs", timeout}};
auto commPair = rdv.CreateAdiosClient<redev::LO>("foo",params,redev::TransportType::BP4);
}
int main(int argc, char** argv) {
MPI_Init(&argc, &argv);
int nproc;
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
REDEV_ALWAYS_ASSERT(nproc == 1);
REDEV_ALWAYS_ASSERT(argc == 2);
const int isRdv = atoi(argv[1]);
std::cout << "isRdv " << isRdv << "\n";
REDEV_ALWAYS_ASSERT(isRdv == 1 || isRdv == 0);
if(isRdv)
server();
else
client();
std::cout << "done\n";
MPI_Finalize();
return 0;
}