Skip to content

Commit

Permalink
Add example codes from comm part of the tutorial slides (chapel-lang#…
Browse files Browse the repository at this point in the history
…23646)

This PR adds tests for:

- commTable.chpl
- verboseComm.chpl
- commOverDom.chpl

- [x] paratest
- [x] paratest gasnet
  • Loading branch information
bmcdonald3 authored Oct 13, 2023
2 parents 7c15850 + da45c5e commit c67f94f
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/exercises/Oct2023tutorial/04-commOverDom.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use BlockDist;
use CommDiagnostics;

config const size = 5;

var D = blockDist.createDomain(0..#size);

var a = 0;

startCommDiagnostics();
forall i in D with (ref a) {
a += 1; // beware! race condition!
}
stopCommDiagnostics();
printCommDiagnosticsTable();

writeln(a);
Empty file.
13 changes: 13 additions & 0 deletions test/exercises/Oct2023tutorial/04-commTable.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use CommDiagnostics;

var a = 0;

startCommDiagnostics();
on Locales[1] {
for i in 0..#5 do
a += 1;
}
stopCommDiagnostics();
printCommDiagnosticsTable();

writeln(a);
1 change: 1 addition & 0 deletions test/exercises/Oct2023tutorial/04-commTable.compopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--no-cache-remote
5 changes: 5 additions & 0 deletions test/exercises/Oct2023tutorial/04-commTable.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
| locale | get | put | execute_on |
| -----: | --: | --: | ---------: |
| 0 | 0 | 0 | 1 |
| 1 | 5 | 5 | 0 |
5
1 change: 1 addition & 0 deletions test/exercises/Oct2023tutorial/04-commTable.numlocales
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
1 change: 1 addition & 0 deletions test/exercises/Oct2023tutorial/04-commTable.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHPL_COMM==none
12 changes: 12 additions & 0 deletions test/exercises/Oct2023tutorial/04-verboseComm.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use CommDiagnostics;

var a = 0;

startVerboseComm();
on Locales[1] {
for i in 0..#5 do
a += 1;
}
stopVerboseComm();

writeln(a);
1 change: 1 addition & 0 deletions test/exercises/Oct2023tutorial/04-verboseComm.compopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--no-cache-remote
12 changes: 12 additions & 0 deletions test/exercises/Oct2023tutorial/04-verboseComm.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
0: 04-verboseComm.chpl:6: remote executeOn, node 1
1: 04-verboseComm.chpl:8: remote get, node 0, 8 bytes, commid 5
1: 04-verboseComm.chpl:8: remote put, node 0, 8 bytes, commid 6
1: 04-verboseComm.chpl:8: remote get, node 0, 8 bytes, commid 5
1: 04-verboseComm.chpl:8: remote put, node 0, 8 bytes, commid 6
1: 04-verboseComm.chpl:8: remote get, node 0, 8 bytes, commid 5
1: 04-verboseComm.chpl:8: remote put, node 0, 8 bytes, commid 6
1: 04-verboseComm.chpl:8: remote get, node 0, 8 bytes, commid 5
1: 04-verboseComm.chpl:8: remote put, node 0, 8 bytes, commid 6
1: 04-verboseComm.chpl:8: remote get, node 0, 8 bytes, commid 5
1: 04-verboseComm.chpl:8: remote put, node 0, 8 bytes, commid 6
5
1 change: 1 addition & 0 deletions test/exercises/Oct2023tutorial/04-verboseComm.numlocales
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
1 change: 1 addition & 0 deletions test/exercises/Oct2023tutorial/04-verboseComm.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHPL_COMM==none

0 comments on commit c67f94f

Please sign in to comment.