Skip to content

test: convert testsuite to be function based - #5725

Closed
hzhou wants to merge 28 commits into
pmodels:mainfrom
hzhou:2111_mpitests
Closed

hzhou wants to merge 28 commits into
pmodels:mainfrom
hzhou:2111_mpitests

Conversation

@hzhou

@hzhou hzhou commented Dec 9, 2021 •

Copy link
Copy Markdown
Collaborator

Pull Request Description

The current testsuite consists of thousands of individual mpi test programs. Running the entire testsuite involves invoking process manager to spawn mpi processes and each process goes through MPI_INIT again and again. Both the process spawning and MPI initialization are very slow compared to the tested MPI operation itself. The current testsuite runs for a couple of hours and we run hundreds of them every day.

This PR attempts to convert individual tests into functions, so multiple tests can be tested within a single MPI_Init/Finalize window. I believe this can significantly reduce the CI testing time.

Design goals

  • The current testsuite workflow should still work. make target for each individual test is still maintained by linking util/run_mpitests.o, which supplies the main function. Individual test targets should work exactly as before.

  • An additional make target -- run_mpitests -- is provided by linking util/run_mpitests.o, all_mpitests.o, and all the individual test objects. run_mpitests can be invoked to run multiple tests in a single mpirun invocation. We'll invoke it separately with a different number of processes for test coverages.

  • To keep the current workflow as much as possible, run_mpitests will be driven by the Perl script runtests, thus with the same testlist management. runtests still runs the legacy tests by invoking mpirun individually; but for new tests, it will aggregate and invoke run_mpitests. The test and its argument is piped in using stdin and result piped out using stdout

Challenges

  • TIMEOUT -- use alarm()
  • Crashes -- will restart run_mpitests at the next test index
  • CVARs -- run_mpitests to accept commands to set and reset CVAR

Status

  • Only one test converted: attr/attrend, but workflow can be tested now.

Fixes #2142

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.

@hzhou hzhou changed the title test: convert testsute to be function based test: convert testsuite to be function based Dec 9, 2021
@hzhou
hzhou force-pushed the 2111_mpitests branch 2 times, most recently from 85cb76f to c959178 Compare December 17, 2021 15:07
@hzhou
hzhou force-pushed the 2111_mpitests branch 4 times, most recently from b763246 to 349003a Compare December 22, 2021 03:30
@hzhou

hzhou commented Dec 22, 2021 •

Copy link
Copy Markdown
Collaborator Author

test:mpich/ch3/tcp ✔️
test:mpich/ch4/ofi ❌

@hzhou
hzhou force-pushed the 2111_mpitests branch 3 times, most recently from 6b24080 to d730f7a Compare December 23, 2021 05:52
@hzhou

hzhou commented Dec 23, 2021 •

Copy link
Copy Markdown
Collaborator Author

test:mpich/ch3/tcp
test:mpich/ch4/ofi
✔️ Good except the ubsan catches a fix in posix release_gather code. Will fix in the next push.

Comparing the timing:

  • old ch4:ofi:
Looking in ./testlist 	[00:00:00]
Processing directory attr
Looking in ./attr/testlist 	[00:00:00]
Looking in ./attr/testlist.dtp 	[00:00:38]
Processing directory coll
Looking in ./coll/testlist 	[00:00:42]
Looking in ./coll/testlist.dtp 	[00:09:04]
Looking in ./coll/testlist.cvar 	[00:12:02]
Processing directory comm
Looking in ./comm/testlist 	[00:44:22]
...
  • new ch4:ofi:
Running tests in ./attr/testlist [20 tests - 00:00:00]
    run_mpitests np=1, 17 tests...
    run_mpitests np=2, 1 tests...
    run_mpitests np=4, 2 tests...
Running tests in ./attr/testlist.dtp [2 tests - 00:00:02]
    run_mpitests np=1, 2 tests...
Running tests in ./coll/testlist [185 tests - 00:00:03]
    run_mpitests np=1, 6 tests...
    run_mpitests np=2, 9 tests...
    run_mpitests np=4, 62 tests...
    run_mpitests np=5, 35 tests...
    run_mpitests np=6, 2 tests...
    run_mpitests np=7, 14 tests...
    run_mpitests np=8, 28 tests...
    run_mpitests np=10, 29 tests...
Running tests in ./coll/testlist.cvar [867 tests - 00:00:57]
    run_mpitests np=1, 6 tests...
    run_mpitests np=2, 6 tests...
    run_mpitests np=4, 243 tests...
    run_mpitests np=5, 138 tests...
    run_mpitests np=6, 10 tests...
    run_mpitests np=7, 67 tests...
    run_mpitests np=8, 97 tests...
    run_mpitests np=10, 300 tests...
Running tests in ./coll/testlist.dtp [12 tests - 00:01:56]
    run_mpitests np=4, 6 tests...
    run_mpitests np=10, 6 tests...
Running tests in ./attr/testlist [2 tests - 00:05:28]
Running tests in ./coll/testlist [4 tests - 00:05:30]
Running tests in ./comm/testlist [45 tests - 00:06:33]

This means we shortened the testing time of (attr+coll) from 44:22 down to 6:33, nearly 7 fold. The dtp tests still takes time, that's unavoidable. But for small tests, e.g. tests in attr/, it's 38 sec -> 3 sec.

ch4:ofi-centos64 total testing time shortens from 1hr47'16" down to 1hr16'2"
ch3:tcp-centos64 total testing time shortens from 51'34" down to 31'4"

On ch3:tcp-solaris, attr+coll shortens from 1hr4'37" down to 9'37"! However, the rest of tests (with no changes) took 1 hour longer than comparison -- I guess runtime congestion played significant role on solaris.

Reference for solaris slow init: #5645 (comment)

@hzhou

hzhou commented Dec 23, 2021

Copy link
Copy Markdown
Collaborator Author

Added timeout. Experiment with setting default timeout to 10s --

~/work/pull_requests/2111_mpitests/test/mpi/coll$ make MPITEST_TIMEOUT=10 testing
../runtests -srcdir=. -tests=testlist,testlist.dtp,testlist.cvar -testdirs= \
        -mpiexec="/home/hzhou/MPI/bin/mpiexec"  -xmlfile=summary.xml \
        -tapfile=summary.tap -junitfile=summary.junit.xml
Load tests in .
Running tests in ./testlist [185 tests - 00:00:00]
    run_mpitests np=1, 6 tests...
    run_mpitests np=2, 9 tests...
    run_mpitests np=4, 62 tests...
    run_mpitests np=5, 35 tests...
    run_mpitests np=6, 2 tests...
    run_mpitests np=7, 14 tests...
    run_mpitests np=8, 28 tests...
    run_mpitests np=10, 29 tests...
run_mpitests exited unexpectedly [coll/nonblocking3]
    Failed test: coll/nonblocking3

===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 834322 RUNNING AT Tiger
=   EXIT CODE: 14
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Alarm clock (signal 14)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions
    run_mpitests np=10, 29 tests, continue at 25...
Running tests in ./testlist.cvar [867 tests - 00:00:25]
    run_mpitests np=1, 6 tests...
    run_mpitests np=2, 6 tests...
    run_mpitests np=4, 243 tests...
    run_mpitests np=5, 138 tests...
    run_mpitests np=6, 10 tests...
    run_mpitests np=7, 67 tests...
    run_mpitests np=8, 97 tests...
    run_mpitests np=10, 300 tests...
Running tests in ./testlist.dtp [12 tests - 00:00:39]
    run_mpitests np=4, 6 tests...
    run_mpitests np=10, 6 tests...
Running tests in ./testlist [3 tests - 00:03:04]
1 tests failed out of 1067 (total runtime: 3 min 6 sec)
Details in /home/hzhou/work/pull_requests/2111_mpitests/test/mpi/coll/summary.xml
TAP formatted results in /home/hzhou/work/pull_requests/2111_mpitests/test/mpi/coll/summary.tap
JUNIT formatted results in /home/hzhou/work/pull_requests/2111_mpitests/test/mpi/coll/summary.junit.xml

The dtp tests didn't timeout because most of them have per-test timeout.

@hzhou
hzhou force-pushed the 2111_mpitests branch 2 times, most recently from d072a18 to 98d744c Compare December 28, 2021 01:45
@hzhou

hzhou commented Dec 28, 2021 •

Copy link
Copy Markdown
Collaborator Author

test:mpich/ch3/tcp ❌
test:mpich/ch4/ofi ✔️

With ch3-tcp:
5 failures on freebsd64:

summary_junit_xml.1191 - ./rma/atomic_rmw_gacc 3 | 0.29 sec | 1
summary_junit_xml.1192 - ./rma/atomic_get 3 -pairtype=short | 1.4 sec | 1
summary_junit_xml.1194 - ./rma/atomic_get 3 -pairtype=long | 1.3 sec | 1
summary_junit_xml.1196 - ./rma/atomic_get 3 -pairtype=double | 1.3 sec | 1
summary_junit_xml.1284 - ./rma/mutex_bench 4 -use-alloc-shm -use-contig-rank | 3 min 0 sec | 1

When freebsd frees a window and recreates it, it appears that the interprocess mutex no longer work.

Dramatic speedup on Solaris. From 97 minutes down to 50 minutes. It's 23 minutes on centos

@wesbland

wesbland commented Jan 4, 2022

Copy link
Copy Markdown
Contributor

Does this change anything for the xfail system?

@hzhou

hzhou commented Jan 4, 2022 via email •

Copy link
Copy Markdown
Collaborator Author

@hzhou
hzhou force-pushed the 2111_mpitests branch 3 times, most recently from beae7c8 to c4aaca5 Compare January 10, 2022 21:42
@hzhou

hzhou commented Jan 10, 2022 •

Copy link
Copy Markdown
Collaborator Author

test:mpich/ch3/tcp
test:mpich/ch4/ofi
✔️

@hzhou
hzhou marked this pull request as ready for review January 10, 2022 21:43
hzhou added 25 commits November 15, 2023 15:05
Make -arg equivalent to -arg=1.
The tests with mpicolltest.h can be compiled with -DUSE_MTEST_NBC to
become a non-blocking test. Compile the source multiple times with macro
is inflexible to move into multi-tests framework -- run multiple tests
inside a single MPI_Init/MPI_Finalize window. Convert it to use explicit
option instead.
The new framework will allow running tests inside a single
MPI_Init/MPI_Finalize window by making each test a uniform
function interface.

Each test file defines a run function that will run the test. The test
file is linked with a stup util/run_mpitests.c to create individual test
program that should work exactly as before. In addition, all the test
files will be linked together in the binary run_mpitests, that can be
used to run multiple tests within a single MPI_Init/Finalize window.

All such functional tests are listed in test/mpi/maint/all_mpitests.txt.
During autogen, gen_all_mpitests.py will load this file and generate all
the Makefile targets.

In this commit we didn't modify runtests. All tests should still work by
running them individually. We'll add the ability to run multiple tests
in runtests in the next commits.
Filter the test list and find all tests that can be run using
run_mpitests and run them first. Tests are grouped by testlist and
number of processes.

The running of tests are controlled by runtests using the input/output
pipes, thus we still have the granular control of individual tests.

When run_mpitests abort due to e.g. segfault, restart it with next test
in the testlist. Track the number of such restart and abort in case
something systematic causing it to fail repeatedly, for example, error
in run_mpitests itself.
Instead of `echo something > .stopfile`, make `touch .stopfile` to work
as well. Refactor the code so that check stopfile once aborts all tests.
It is cleaner to split the utilities for multi-tests into its own source
file. Since it will only be used in run_mpitests.c, it is simpler to
just include the file as static code.
Use alarm() to enforce timeouts.
If any of the environment variables affects init, we need run that test
individually so its settings does not affect the rest of the tests.
Only test in attr folder that is not converted is attrend2 since that
test tests MPI_Finalize behaviors.
Convert all tests used in testlist.cvar to mpitests framework.
Remaining not converted:
    gather_big
    bcast
    bcast_comm_world
    uoplong
    uoplong_large
The remaining unconverted tests are
    sendrecv2
    probe_unexp
    probenull
    mprobe
    huge_underflow
    precv_anysrc
All these tests are tested with CVARs. They remain as individual tests
for now to avoid complications.
These tests were compiled multiple times with different macros defined
in the make rules. Convert them into functions that accept argument
instead.

Tests with type parameters -
    atomic_get
    fetch_and_op
    get_accumulate
Tests with -op=xxx -
    wrma_flush_get
    win_shared_rma_flush_load
    overlap_wins_rma
    win_dynamic_rma_flush_get
Tests with -collattach -
    win_dynamic_acc
    window_attach
    aint
The tests uses -use-win-allocate option.
Convert rma/mutex_bench to test function.

Merge the source mcs_mutex.h and mcs_mutex.c into mutex_bench for
easiler manipulation.

Convert macros into command line options.
@hzhou

hzhou commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #8042

@hzhou hzhou closed this Oct 20, 2026
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.

RMA test fails to respect --disable-long-double option

2 participants