Skip to content

Instantly share code, notes, and snippets.

@mppf
Last active October 9, 2025 14:47
Show Gist options
  • Select an option

  • Save mppf/6c4c3879357e469c24d25632290c417b to your computer and use it in GitHub Desktop.

Select an option

Save mppf/6c4c3879357e469c24d25632290c417b to your computer and use it in GitHub Desktop.
Chapel Operations Involving Unexpected Locales
output of ./testforall -nl 4 | grep 'node 1' with chpl 75c9635e6a85a557758397b2cf60d62443032270
Create and destroy a Block Domain distributed to Locales 2,3 (ideally should not involve node 1)
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
Create and destroy a Block Array distributed to Locales 2,3 (ideally should not involve node 1)
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
Forall over a Block Array distributed to Locales 2,3 (ideally should not involve node 1)
Creating a slice over the portion of a Block Array distributed to Locales 2,3 (ideally should not involve node 1)
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
0: $CHPL_HOME/modules/internal/LocaleModelHelpFlat.chpl:133: remote non-blocking executeOn, node 1
Forall over a slice over the portion of a Block Array distributed to Locales 2,3 (ideally should not involve node 1)
Bulk transfer between portions of a Block Array distributed to Locales 2,3 (ideally should not involve node 1)
use CommDiagnostics;
use Time;
use BlockDist;
config const verboseComm = true;
config var printCounts = false;
config var printAllCounts = false;
config const n = 100_000_000;
// this is a config param just so it can be in COMPOPTS
config param checkMaxAttained = false;
var timer:stopwatch;
proc start() {
resetCommDiagnostics();
startCommDiagnostics();
if verboseComm then startVerboseComm();
timer.clear();
timer.start();
}
proc stop() {
timer.stop();
if verboseComm then stopVerboseComm();
stopCommDiagnostics();
}
if numLocales != 4 {
writeln("Requires 4 locales");
exit();
}
{
writeln("Create and destroy a Block Domain distributed to Locales 2,3 (ideally should not involve node 1)");
start();
{
const D = blockDist.createDomain(0..<n,
targetLocales=[Locales[2], Locales[3]]);
}
stop();
}
{
writeln("Create and destroy a Block Array distributed to Locales 2,3 (ideally should not involve node 1)");
const D = blockDist.createDomain(0..<n,
targetLocales=[Locales[2], Locales[3]]);
start();
{
var A: [D] int;
}
stop();
}
{
writeln("Forall over a Block Array distributed to Locales 2,3 (ideally should not involve node 1)");
const D = blockDist.createDomain(0..<n,
targetLocales=[Locales[2], Locales[3]]);
var A: [D] int;
start();
{
forall a in A {
a = 23;
}
}
stop();
}
{
writeln("Creating a slice over the portion of a Block Array distributed to Locales 2,3 (ideally should not involve node 1)");
const D = blockDist.createDomain(0..<n,
targetLocales=[Locales[2], Locales[3]]);
var A: [D] int;
start();
{
var loc2start = 2 * n / 4 + 1;
ref Slice = A[loc2start..<n];
}
stop();
}
{
writeln("Forall over a slice over the portion of a Block Array distributed to Locales 2,3 (ideally should not involve node 1)");
const D = blockDist.createDomain(0..<n,
targetLocales=[Locales[2], Locales[3]]);
var A: [D] int;
var loc2start = 2 * n / 4 + 1;
ref Slice = A[loc2start..<n];
start();
{
forall a in Slice {
a = 23;
}
}
stop();
}
{
writeln("Bulk transfer between portions of a Block Array distributed to Locales 2,3 (ideally should not involve node 1)");
const D = blockDist.createDomain(0..<n,
targetLocales=[Locales[2], Locales[3]]);
var A: [D] int;
const nper = n / 4;
const amt = nper / 2;
var loc2start = 2 * nper + 1;
var loc3start = 3 * nper + 1;
start();
{
A[loc2start..#amt] = A[loc3start..#amt];
}
stop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment