Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part of #1404: Avoid flushing aggregators in lockstep #1826

Merged
merged 1 commit into from
Oct 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/CommAggregation.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module CommAggregation {
type aggType = (c_ptr(elemType), elemType);
const bufferSize = dstBuffSize;
const myLocaleSpace = 0..<numLocales;
var lastLocale: int;
var opsUntilYield = yieldFrequency;
var lBuffers: c_ptr(c_ptr(aggType));
var rBuffers: [myLocaleSpace] remoteBuffer(aggType);
Expand All @@ -65,14 +66,16 @@ module CommAggregation {
}

proc flush() {
for loc in myLocaleSpace {
for offsetLoc in myLocaleSpace + lastLocale {
const loc = offsetLoc % numLocales;
_flushBuffer(loc, bufferIdxs[loc], freeData=true);
}
}

inline proc copy(ref dst: elemType, const in srcVal: elemType) {
// Get the locale of dst and the local address on that locale
const loc = dst.locale.id;
lastLocale = loc;
const dstAddr = getAddr(dst);

// Get our current index into the buffer for dst's locale
Expand Down Expand Up @@ -152,13 +155,13 @@ module CommAggregation {
type aggType = c_ptr(elemType);
const bufferSize = srcBuffSize;
const myLocaleSpace = 0..<numLocales;
var lastLocale: int;
var opsUntilYield = yieldFrequency;
var dstAddrs: c_ptr(c_ptr(aggType));
var lSrcAddrs: c_ptr(c_ptr(aggType));
var lSrcVals: [myLocaleSpace][0..#bufferSize] elemType;
var rSrcAddrs: [myLocaleSpace] remoteBuffer(aggType);
var rSrcVals: [myLocaleSpace] remoteBuffer(elemType);

var bufferIdxs: c_ptr(int);

proc postinit() {
Expand Down Expand Up @@ -186,7 +189,8 @@ module CommAggregation {
}

proc flush() {
for loc in myLocaleSpace {
for offsetLoc in myLocaleSpace + lastLocale {
const loc = offsetLoc % numLocales;
_flushBuffer(loc, bufferIdxs[loc], freeData=true);
}
}
Expand All @@ -198,6 +202,7 @@ module CommAggregation {
const dstAddr = getAddr(dst);

const loc = src.locale.id;
lastLocale = loc;
const srcAddr = getAddr(src);

ref bufferIdx = bufferIdxs[loc];
Expand Down