Skip to content

Commit

Permalink
Fix sporadic Oct23Tutorial failures (chapel-lang#23727)
Browse files Browse the repository at this point in the history
Fix a couple of sporadic failures on Oct23tutorial tests:

* Fix a sporadic failure in `exercises/Oct2023tutorial/parfilekmer.chpl`
due to output order being non-deterministic. A prediff is added to sort
the output.
* Fix a sporadic timeout in
`exercises/Oct2023tutorial/04-atomic-type.chpl`. With the original
implementation, task 1 reset the barrier before other tasks finished
waiting causing them to wait indefinitely. (Also lowers the amount of
time spent sleeping to speed up test.) The test is no longer timing out
- testing with 1000 trials.

[ trivial - not reviewed ]
  • Loading branch information
jeremiah-corrado authored Oct 27, 2023
2 parents c0512b5 + 6f59c63 commit 72e1ae6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 3 additions & 4 deletions test/exercises/Oct2023tutorial/04-atomic-type.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ proc barrier(numTasks) {
// the shortest, will not be past the barrier until all other tasks are done.
const numTasks = 10;
coforall i in 1..numTasks {
sleep(i);
sleep(i/100.0);
barrier(numTasks);


if i==1 {
writeln("All tasks done sleeping");
// reset the barrier
count.write(0); done.write(false);
count.write(0);
}

// all tasks waiting for task 1 to finish resetting the barrier count
count.waitFor(0);

Expand All @@ -55,4 +55,3 @@ writeln();
bucketCount[i % m].add(1);
writeln("bucketCount = ", bucketCount, ", 'ref' intent is also the default for atomic");
}

4 changes: 2 additions & 2 deletions test/exercises/Oct2023tutorial/parfilekmer.good
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Number of unique k-mers in DataDir/kmer_large_input_half.txt is 252

Number of unique k-mers in DataDir/kmer_large_input.txt is 255

Number of unique k-mers in DataDir/kmer_large_input.txt is 255
Number of unique k-mers in DataDir/kmer_large_input_half.txt is 252
7 changes: 7 additions & 0 deletions test/exercises/Oct2023tutorial/parfilekmer.prediff
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# sort output to ensure task IDs are listed in a deterministic order
outfile=$2

sort $outfile > $outfile.2
mv $outfile.2 $outfile

0 comments on commit 72e1ae6

Please sign in to comment.