Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add p2p benchmark code #6907

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

test: add p2p benchmark code #6907

wants to merge 2 commits into from

Conversation

hzhou
Copy link
Contributor

@hzhou hzhou commented Feb 12, 2024

Pull Request Description

While OSU micro benchmarks are commonly used, they still require separate builds and its comprehensive inclusions of many options make using and tuning the benchmarks non-trivial. This PR adds simple benchmark code that can be used in CI testing. Each test consists of a single standalone C source code with minimum options, thus allowing quick testing and easy adaptations.

The PR also introduces MyDef template system. MyDef allows the construction of code in layers. However, before getting familiar, developers will likely feel the source code in MyDef to be mysterious. To start, follow the instructions to get the source code in C and read the C code.

/* Instructions: 
 *     mydef_page p2p.def  # -> p2p_latency.c p2p_bw.c
 *     mpicc p2p_latency.c && mpi_run -n 2 ./a.out
 *     mpicc p2p_bw.c      && mpi_run -n 2 ./a.out
 *
 * Reference the output C code or bench_{frame,p2p}.def.
 */

Output:

$ mydef_run p2p.def
PAGE: p2p_latency
  --> [out/p2p_latency.c]
PAGE: p2p_bw
  --> [out/p2p_bw.c]
mpicc -o out/p2p_latency out/p2p_latency.c -lm && mpirun -n 2 out/p2p_latency
# Test p2p_latency: msg-size  avg-latency  sigma  avg-bandwidth
           0      0.444  0.008       0.000
           1      0.443  0.009       2.256
           2      0.445  0.009       4.497
           4      0.445  0.009       8.986
           8      0.442  0.009      18.115
          16      0.442  0.009      36.204
          32      0.441  0.010      72.553
          64      0.622  0.187     102.827
         128      0.468  0.012     273.496
         256      0.490  0.012     522.531
         512      0.537  0.011     952.747
        1024      0.645  0.015    1587.509
        2048      0.767  0.018    2671.144
        4096      1.038  0.031    3947.612
        8192      1.512  0.044    5417.104
       16384      3.637  0.087    4505.069
       32768      4.961  0.141    6604.858
       65536      7.559  0.162    8669.735
      131072     12.808  0.269   10233.893
      262144     23.105  0.410   11345.913
      524288     45.038  1.095   11640.949
     1048576     96.002  1.704   10922.458
     2097152    199.561  2.212   10508.829
     4194304    441.534  5.100    9499.399
mpicc -o out/p2p_bw out/p2p_bw.c -lm && mpirun -n 2 out/p2p_bw
# Test p2p_bw: msg-size  avg-latency  sigma  avg-bandwidth
           1      0.201  0.005       4.983
           2      0.201  0.005       9.941
           4      0.201  0.005      19.938
           8      0.200  0.005      39.947
          16      0.201  0.005      79.500
          32      0.201  0.005     159.582
          64      0.202  0.005     316.425
         128      0.234  0.005     546.975
         256      0.242  0.005    1055.925
         512      0.260  0.007    1972.275
        1024      0.317  0.006    3232.856
        2048      0.340  0.007    6016.923
        4096      0.458  0.009    8943.106
        8192      0.667  0.013   12278.648
       16384      1.753  0.030    9346.665
       32768      3.126  0.048   10481.122
       65536      5.753  0.084   11392.225
      131072     10.972  0.134   11945.614
      262144     21.366  0.122   12269.216
      524288     42.235  0.348   12413.587
     1048576     86.507  8.334   12121.275
     2097152    163.353  0.321   12838.137
     4194304    326.663  0.433   12839.845

[skip warnings]

Author Checklist

  • Provide Description
    Particularly focus on why, not what. Reference background, issues, test failures, xfail entries, etc.
  • Commits Follow Good Practice
    Commits are self-contained and do not do two things at once.
    Commit message is of the form: module: short description
    Commit message explains what's in the commit.
  • Passes All Tests
    Whitespace checker. Warnings test. Additional tests via comments.
  • Contribution Agreement
    For non-Argonne authors, check contribution agreement.
    If necessary, request an explicit comment from your companies PR approval manager.

MyDef provides general templating facilities.
Add point-to-point benchmark code in MyDef. The tests have automatic
warm-ups and adjusts number of iterations for measurement accuracy.
It produces latency measurements with standard deviations and equivalent
bandwidths.

To run:
    mydef_page p2p.def  # -> p2p_latency.c p2p_bw.c
    mpicc p2p_latency.c && mpi_run -n 2 ./a.out
    mpicc p2p_bw.c      && mpi_run -n 2 ./a.out

Alternatively use mydef_run (uses settings from config):
    mydef_run p2p.def
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant