Skip to content

Commit

Permalink
test/bench: add bcast bench test
Browse files Browse the repository at this point in the history
Adding bcast bench test. It will first measure the barrier overhead and
account for the barrier usage in measurement. It also runs auto-warm-up
by using bcast to synchronize all processes.
  • Loading branch information
hzhou committed Oct 2, 2024
1 parent 78efa91 commit a267916
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/mpi/bench/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*.c
/p2p_bw
/p2p_latency
/bcast
3 changes: 2 additions & 1 deletion test/mpi/bench/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ LDADD += -lm
## correctly
noinst_PROGRAMS = \
p2p_latency \
p2p_bw
p2p_bw \
bcast

.def.c:
mydef_page $<
20 changes: 20 additions & 0 deletions test/mpi/bench/bcast.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include: macros/bench_frame.def
include: macros/bench_coll.def
include: macros/mtest.def

page: bcast, bench_frame
data: buf, size, MPI_CHAR

tf_barrier = bench_barrier(comm)
$for int size = 1; size < MAX_BUFSIZE; size *= 2
&call coll_warmup, 0
MPI_Bcast($(data), 0, comm)
MPI_Barrier(comm)
&call run_stat, NUM_REPEAT, tf_latency
&call measure, iter
MPI_Bcast($(data), 0, comm)
MPI_Barrier(comm)
tf_latency = (tf_dur / iter) - tf_barrier
$if grank == 0
$call report_latency, size, 1

32 changes: 32 additions & 0 deletions test/mpi/bench/macros/bench_coll.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
subcode: coll_warmup(root)
$if grank == 0
&call warm_up, iter, tf_dur
MPI_Bcast(&iter, 1, MPI_INT, $(root), comm)
&call measure, iter
BLOCK
tn_zero = 0
MPI_Bcast(&tn_zero, 1, MPI_INT, $(root), comm)
$else
$while 1
MPI_Bcast(&iter, 1, MPI_INT, $(root), comm)
$if iter == 0
break
$for 0:iter
BLOCK

MPI_Bcast(&iter, 1, MPI_INT, $(root), comm)

fncode: bench_barrier(comm)
$local int iter
&call coll_warmup, 0
MPI_Barrier(comm)

&call run_stat, NUM_REPEAT, tf_latency
&call measure, iter
MPI_Barrier(comm)
tf_latency = (tf_dur / iter)

$if grank == 0
printf("Barrier latency %.3f +/- %.3f us\n", sum1 * 1e6, sum2 * 1e6)
return sum1

1 change: 1 addition & 0 deletions test/mpi/bench/testlist
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
p2p_latency 2 resultTest=TestBench
p2p_bw 2 resultTest=TestBench
bcast 16 resultTest=TestBench

0 comments on commit a267916

Please sign in to comment.