-
Notifications
You must be signed in to change notification settings - Fork 4
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
Run tests in parallel on CI #49
Conversation
I had to use |
tests/CMakeLists.txt
Outdated
@@ -43,5 +47,5 @@ foreach(testfile IN LISTS TESTSRC) | |||
find_package(OpenMP REQUIRED) | |||
target_link_libraries(${test_name} PRIVATE OpenMP::OpenMP_Fortran) | |||
|
|||
add_test(NAME ${test_name} COMMAND sh -c "mpirun -np 1 ${test_name}") | |||
add_test(NAME ${test_name} COMMAND sh -c "mpirun --oversubscribe -np ${CMAKE_CTEST_NPROCS} ${test_name}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allocator and reorder tests are the ones that doesn't require a parallel run. Both of them don't do any communication and even in a full simulation with multiple ranks they're always local to their own rank. Running these on multiple ranks is still a valid test but if we can avoid this easily it is better I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a good point, though I can't think of a clean way of doing it yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use a function to build the test definition, I'll see if I can dig out an example where I've done this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like the following should work
function(define_test test_name np)
add_test(NAME ${test_name} COMMAND sh -c "mpirun --oversubscribe -np ${np} ...")
endfunction()
# Make a single process test (assumes there is a test_foo target)
define_test(test_foo 1)
# Make a parallel test
define_test(test_bar ${CMAKE_CTEST_NPROCS})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment, otherwise looks good to me.
Can we specify number of ranks we want to test with somehow when building with a command line option? Or do we have to edit the relevant line in the |
Yes, you don't have to edit the |
closes #20