Skip to content

Commit 4e55480

Browse files
committed
update README
Signed-off-by: Chang-Ning Tsai <changnit@amazon.com>
1 parent f6edd96 commit 4e55480

File tree

1 file changed

+13
-40
lines changed

1 file changed

+13
-40
lines changed

README.md

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -63,53 +63,26 @@ enabling a more straightforward programming model without manual callback manage
6363
The example below shows how to build a PoC using pure [libfabric](https://github.com/ofiwg/libfabric/) and [MPI](https://www.open-mpi.org/).
6464

6565
```cpp
66-
#include <io/runner.h>
66+
#include <bench/arguments.h>
6767
#include <rdma/fabric/memory.h>
68+
#include <bench/modules/sendrecv.cuh>
6869
#include <bench/mpi/fabric.cuh>
6970

70-
struct PairBench {
71-
int target;
72-
template <typename T>
73-
void operator()(FabricBench& peer, FabricBench::Buffers<T>& send, FabricBench::Buffers<T>& recv) {
74-
for (auto& efa : peer.efas) IO::Get().Join<FabricSelector>(efa);
75-
Run([&]() -> Coro<> {
76-
size_t channel = 0;
77-
if (peer.mpi.GetWorldRank() == 0) {
78-
co_await send[target]->Sendall(channel);
79-
co_await recv[target]->Recvall(channel);
80-
} else if (peer.mpi.GetWorldRank() == target) {
81-
co_await recv[0]->Recvall(channel);
82-
co_await send[0]->Sendall(channel);
83-
}
84-
for (auto& efa : peer.efas) IO::Get().Quit<FabricSelector>(efa);
85-
}());
86-
}
87-
};
88-
89-
template <typename BufType>
90-
struct Test {
91-
static BenchResult Run(size_t size) {
92-
FabricBench peer;
93-
peer.Exchange();
94-
peer.Connect();
95-
int rank = peer.mpi.GetWorldRank();
96-
int world = peer.mpi.GetWorldSize();
97-
auto send = peer.Alloc<BufType>(size, rank);
98-
auto recv = peer.Alloc<BufType>(size, -1);
99-
auto noop = [](auto&, auto&) {};
100-
std::vector<BenchResult> res;
101-
for (int t = 1; t < world; ++t) res.emplace_back(peer.Bench(send, recv, PairBench{t}, noop, 100));
102-
return res;
103-
}
104-
};
105-
106-
using DeviceTest = Test<SymmetricDMAMemory>;
107-
10871
// mpirun -np 2 --npernode 1 example
10972

11073
int main(int argc, char *argv[]) {
11174
size_t bufsize = 128 << 10; // 128k
112-
auto results = DeviceTest::Run(bufsize);
75+
FabricBench peer;
76+
peer.Exchange();
77+
peer.Connect();
78+
int rank = peer.mpi.GetWorldRank();
79+
80+
auto send = peer.Alloc<fi::SymmetricDMAMemory>(bufsize, rank);
81+
auto recv = peer.Alloc<fi::SymmetricDMAMemory>(bufsize, -1);
82+
peer.Handshake(send, recv);
83+
84+
auto verify = [](auto&, auto&) {};
85+
auto result = peer.Bench("test", send, recv, PairBench<FabricBench, fi::FabricSelector>{1}, verify, 100);
11386
return 0;
11487
}
11588
```

0 commit comments

Comments
 (0)