Skip to content

Commit

Permalink
Created contended fetching AMO benchmark. (chapel-lang#24449)
Browse files Browse the repository at this point in the history
Micro-benchmark for contended fetching atomic operations.

[Reviewed by @jabraham17, thank you.]
  • Loading branch information
jhh67 authored Feb 20, 2024
2 parents db25e8d + ef5a304 commit e04b73f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/runtime/configMatters/comm/comm-ops.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ config const numTasks = here.maxTaskPar;
config const printTime = true;
config const printDiags = false;

enum OP {GET,PUT,FAMO,NFAMO,CASAMO,GETAMO,PUTAMO,FASTAM,AM};
enum OP {GET,PUT,FAMO,NFAMO,CASAMO,GETAMO,PUTAMO,FASTAM,AM,CFAMO};

var t: stopwatch;
proc startDiags() {
Expand Down Expand Up @@ -75,6 +75,7 @@ proc test(op: OP) {
ref aLoc = A.localAccess[tid].val;
ref aRem = A[tid+numTasks].val;
ref lRem = Locales[numLocales-1];
ref aRemShared = A[1].val;
select op {

// RMA
Expand All @@ -86,6 +87,7 @@ proc test(op: OP) {
when OP.CASAMO do for i in 0..<iters do aRem.compareAndSwap(i, i+1);
when OP.GETAMO do for i in 0..<iters do bLoc = aRem.read();
when OP.PUTAMO do for i in 0..<iters do aRem.write(bLoc);
when OP.CFAMO do for i in 0..<iters do aRemShared.fetchAdd(1);
// AM
when OP.FASTAM do for i in 0..<iters do on lRem do B.localAccess[tid].val = 0;
when OP.AM do for i in 0..<iters do on lRem do B.localAccess[tid].val = thwartFastOn();
Expand Down

0 comments on commit e04b73f

Please sign in to comment.