Skip to content

Commit 971eca1

Browse files
committed
fix: use vector for hypercube to simplify SDAG
1 parent 74e0140 commit 971eca1

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

sim

41 KB
Binary file not shown.

src/allGather/allGather.ci

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module allGather {
2+
include "vector";
23
readonly double alpha;
34
readonly double beta;
45

@@ -15,23 +16,16 @@ module allGather {
1516
serial { HypercubeToSend = thisIndex ^ ((int)pow(2, iter)); }
1617
if (HypercubeToSend < n) {
1718
serial {
18-
CkNcpyBuffer data[hyperCubeStore.size()];
19-
int dataIndx[hyperCubeIndx.size()];
20-
int numBuffers = hyperCubeStore.size();
21-
for(int i = 0; i < numBuffers; i++) {
22-
data[i] = hyperCubeStore[i];
23-
dataIndx[i] = hyperCubeIndx[i];
24-
}
2519
#ifdef TIMESTAMP
26-
thisProxy(HypercubeToSend).recvHypercube(iter, data, dataIndx, numBuffers, (timeStamp + alpha + beta * hyperCubeStore.size() * 8));
20+
thisProxy(HypercubeToSend).recvHypercube(iter, hyperCubeStore, hyperCubeIndx, (timeStamp + alpha + beta * hyperCubeStore.size() * 8));
2721
timeStamp += alpha;
2822
#else
29-
thisProxy(HypercubeToSend).recvHypercube(iter, data, dataIndx, numBuffers, 0.0);
23+
thisProxy(HypercubeToSend).recvHypercube(iter, hyperCubeStore, hyperCubeIndx, 0.0);
3024
#endif
3125
}
32-
when recvHypercube[iter](int ref, CkNcpyBuffer data[size], int dataIndx[size], int size, double recvTime) {
26+
when recvHypercube[iter](int ref, std::vector<CkNcpyBuffer> data, std::vector<int> dataIndx, double recvTime) {
3327
serial {
34-
for(int m = 0; m < size; m++) {
28+
for(int m = 0; m < data.size(); m++) {
3529
hyperCubeStore.emplace_back(data[m]);
3630
hyperCubeIndx.emplace_back(dataIndx[m]);
3731
CkNcpyBuffer dst(store + dataIndx[m] * k, k * sizeof(long int), zero_copy_callback, CK_BUFFER_UNREG);
@@ -45,7 +39,7 @@ module allGather {
4539
}
4640
}
4741
};
48-
entry void recvHypercube(int ref, CkNcpyBuffer data[size], int dataIndx[size], int size, double recvTime);
42+
entry void recvHypercube(int ref, std::vector<CkNcpyBuffer> data, std::vector<int> dataIndx, double recvTime);
4943
entry void Flood(int sender, CkNcpyBuffer data, double recvTime);
5044
};
5145
};

0 commit comments

Comments
 (0)