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

Parallel CTest in CI #243

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Parallel CTest in CI
- added RUN_SERIAL support where appropriate
- tweaked PROCESSOR_AFFINITY for some tests
- format nccl-tests/CMakeLists.txt
  • Loading branch information
jrmadsen committed Jan 5, 2022
commit 5af6b8df87b106cb1dec3c77fd200320e2f17c9a
5 changes: 3 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ install:
conda update -y -n base conda
conda install -y -c conda-forge -c defaults matplotlib numpy pillow cython six pandas pydot multiprocess
}
$env:TIMEMORY_FILE_OUTPUT = "OFF"
$env:TIMEMORY_AUTO_OUTPUT = "ON"
mkdir "C:\Users\appveyor\CTestTemp"
$env:TEMP = "C:\Users\appveyor\CTestTemp"
$env:CTEST_PARALLEL_LEVEL = "2"
$env:TIMEMORY_FILE_OUTPUT = "OFF"
$env:TIMEMORY_AUTO_OUTPUT = "ON"

build_script:
- mkdir build-timemory
Expand Down
12 changes: 8 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ jobs:
- run:
name: build
command: >
export CONTINUOUS_INTEGRATION=true
export CONTINUOUS_INTEGRATION=true &&
export CTEST_PARALLEL_LEVEL=2 &&
export PATH="${HOME}/miniconda/bin:${PATH}" &&
source activate &&
conda activate pyctest &&
Expand Down Expand Up @@ -155,7 +156,8 @@ jobs:
- run:
name: build
command: >
export CONTINUOUS_INTEGRATION=true
export CONTINUOUS_INTEGRATION=true &&
export CTEST_PARALLEL_LEVEL=2 &&
export PATH="${HOME}/miniconda/bin:${PATH}" &&
source activate &&
conda activate pyctest &&
Expand Down Expand Up @@ -197,7 +199,8 @@ jobs:
- run:
name: build
command: >
export CONTINUOUS_INTEGRATION=true
export CONTINUOUS_INTEGRATION=true &&
export CTEST_PARALLEL_LEVEL=2 &&
export PATH="${HOME}/miniconda/bin:${PATH}" &&
source activate &&
conda activate pyctest &&
Expand Down Expand Up @@ -236,7 +239,8 @@ jobs:
- run:
name: build
command: >
export CONTINUOUS_INTEGRATION=true
export CONTINUOUS_INTEGRATION=true &&
export CTEST_PARALLEL_LEVEL=2 &&
export PATH="${HOME}/miniconda/bin:${PATH}" &&
source activate &&
conda activate pyctest &&
Expand Down
12 changes: 1 addition & 11 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ parse:
- DISCOVER_TESTS
- ADD_TESTS
- MPI
- RUN_SERIAL
kwargs:
NPROCS: '*'
TIMEOUT: '*'
Expand All @@ -45,17 +46,6 @@ parse:
COMMAND: '*'
OPTIONS: '*'
ENVIRONMENT: '*'
create_executable:
flags:
- INSTALL
- EXCLUDE_FROM_ALL
kwargs:
TARGET_NAME: '*'
HEADERS: '*'
SOURCES: '*'
PROPERTIES: '*'
LINK_LIBRARIES: '*'
INSTALL_DESTINATION: '*'
build_library:
flags:
- PIC
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ master, develop ]

env:
CTEST_PARALLEL_LEVEL: 2

jobs:
linux-ci:
runs-on: ubuntu-18.04
Expand Down
25 changes: 17 additions & 8 deletions cmake/Modules/MacroUtilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ function(ADD_TIMEMORY_GOOGLE_TEST TEST_NAME)
set(multival_args SOURCES DEPENDS PROPERTIES DEFINITIONS LINK_LIBRARIES COMMAND
OPTIONS ENVIRONMENT)
# parse args
cmake_parse_arguments(TEST "DISCOVER_TESTS;ADD_TESTS;MPI" "NPROCS;TIMEOUT;TARGET"
"${multival_args}" ${ARGN})
cmake_parse_arguments(TEST "DISCOVER_TESTS;ADD_TESTS;MPI;RUN_SERIAL"
"NPROCS;TIMEOUT;TARGET" "${multival_args}" ${ARGN})

if(NOT TARGET google-test-debug-options)
add_library(google-test-debug-options INTERFACE)
Expand All @@ -288,8 +288,7 @@ function(ADD_TIMEMORY_GOOGLE_TEST TEST_NAME)
${_OPTS}
TARGET_NAME ${TEST_TARGET} OUTPUT_NAME ${TEST_TARGET}
SOURCES ${TEST_SOURCES}
LINK_LIBRARIES timemory-google-test ${TEST_LINK_LIBRARIES}
PROPERTIES "${TEST_PROPERTIES}")
LINK_LIBRARIES timemory-google-test ${TEST_LINK_LIBRARIES})

target_compile_definitions(${TEST_TARGET} PUBLIC ${TEST_DEFINITIONS})

Expand All @@ -315,6 +314,15 @@ function(ADD_TIMEMORY_GOOGLE_TEST TEST_NAME)
set(TEST_NPROCS 2)
endif()
set(TEST_LAUNCHER ${MPIEXEC_EXECUTABLE} -n ${TEST_NPROCS})
else()
set(TEST_MPI OFF)
endif()

include(ProcessorCount)
processorcount(NUM_PROCS_REAL)

if(TEST_RUN_SERIAL OR (TEST_MPI AND NOT TEST_NPROCS LESS ${NUM_PROCS_REAL}))
list(APPEND TEST_PROPERTIES RUN_SERIAL ON)
endif()

if("${TEST_COMMAND}" STREQUAL "")
Expand Down Expand Up @@ -350,7 +358,7 @@ function(ADD_TIMEMORY_GOOGLE_TEST TEST_NAME)
${TEST_TARGET}
TEST_LIST ${TEST_NAME}_TESTS ${TEST_OPTIONS} DISCOVERY_TIMEOUT 15
WORKING_DIRECTORY ${WORKING_DIR}
PROPERTIES ENVIRONMENT "${TEST_ENVIRONMENT}"
PROPERTIES ${TEST_PROPERTIES} ENVIRONMENT "${TEST_ENVIRONMENT}"
TIMEOUT ${TEST_TIMEOUT})
elseif(TEST_ADD_TESTS)
gtest_add_tests(
Expand All @@ -359,14 +367,15 @@ function(ADD_TIMEMORY_GOOGLE_TEST TEST_NAME)
WORKING_DIRECTORY ${WORKING_DIR})
set_tests_properties(
${${TEST_NAME}_TESTS} PROPERTIES ENVIRONMENT "${TEST_ENVIRONMENT}" TIMEOUT
${TEST_TIMEOUT})
${TEST_TIMEOUT} ${TEST_PROPERTIES})
else()
add_test(
NAME ${TEST_NAME}
COMMAND ${TEST_COMMAND}
WORKING_DIRECTORY ${WORKING_DIR} ${TEST_OPTIONS})
set_tests_properties(${TEST_NAME} PROPERTIES ENVIRONMENT "${TEST_ENVIRONMENT}"
TIMEOUT ${TEST_TIMEOUT})
set_tests_properties(
${TEST_NAME} PROPERTIES ENVIRONMENT "${TEST_ENVIRONMENT}" TIMEOUT
${TEST_TIMEOUT} ${TEST_PROPERTIES})
endif()

if(TEST_DEPENDS)
Expand Down
50 changes: 26 additions & 24 deletions source/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ foreach(_LINK_TYPE shared static)
if(TARGET timemory::timemory-compiler-instrument-${_LINK_TYPE})
#
add_timemory_google_test(
compiler_instrument${_EXTRA}_${_LINK_TYPE}_tests
compiler_instrument${_EXTRA}_${_LINK_TYPE}_tests RUN_SERIAL
TARGET compiler_instrument_${_LINK_TYPE}_tests
SOURCES instrumentation_tests.cpp
DEFINITIONS DISABLE_TIMEMORY
Expand All @@ -163,7 +163,7 @@ foreach(_LINK_TYPE shared static)
ENVIRONMENT ${compiler_instr_env} PROPERTIES PROCESSOR_AFFINITY ON)
#
add_timemory_google_test(
compiler_instrument_mt${_EXTRA}_${_LINK_TYPE}_tests
compiler_instrument_mt${_EXTRA}_${_LINK_TYPE}_tests RUN_SERIAL
TARGET compiler_instrument_mt_${_LINK_TYPE}_tests
SOURCES instrumentation_tests.cpp
DEFINITIONS ENABLE_MT DISABLE_TIMEMORY
Expand All @@ -172,15 +172,15 @@ foreach(_LINK_TYPE shared static)
ENVIRONMENT ${compiler_instr_env} PROPERTIES PROCESSOR_AFFINITY ON)
#
add_timemory_google_test(
compiler_instrument_timemory${_EXTRA}_${_LINK_TYPE}_tests
compiler_instrument_timemory${_EXTRA}_${_LINK_TYPE}_tests RUN_SERIAL
TARGET compiler_instrument_timemory_${_LINK_TYPE}_tests
SOURCES instrumentation_tests.cpp
LINK_LIBRARIES common-test-libs test-opt-flags ${_LIBRARY}
timemory::timemory-compiler-instrument-${_LINK_TYPE}
ENVIRONMENT ${compiler_instr_env} PROPERTIES PROCESSOR_AFFINITY ON)
#
add_timemory_google_test(
compiler_instrument_timemory_mt${_EXTRA}_${_LINK_TYPE}_tests
compiler_instrument_timemory_mt${_EXTRA}_${_LINK_TYPE}_tests RUN_SERIAL
TARGET compiler_instrument_timemory_mt_${_LINK_TYPE}_tests
SOURCES instrumentation_tests.cpp
DEFINITIONS ENABLE_MT
Expand All @@ -193,7 +193,7 @@ endforeach()

if(TARGET custom-record-functions)
add_timemory_google_test(
library_tests DISCOVER_TESTS
library_tests DISCOVER_TESTS RUN_SERIAL
SOURCES library_tests.cpp
LINK_LIBRARIES common-test-libs custom-record-functions timemory::timemory-core
PROPERTIES PROCESSOR_AFFINITY ON)
Expand All @@ -209,14 +209,14 @@ if(_LIBRARY_TARGET
list(APPEND trace_tests_env "TIMEMORY_MPI_THREAD_TYPE=funneled")

add_timemory_google_test(
trace_tests MPI NPROC 4
trace_tests RUN_SERIAL MPI NPROC 4
SOURCES trace_tests.cpp
LINK_LIBRARIES common-test-libs ${_LIBRARY_TARGET} timemory::timemory-plotting
timemory::timemory-mpip-library timemory::timemory-ompt-library
ENVIRONMENT ${trace_tests_env} PROPERTIES PROCESSOR_AFFINITY ON)

add_timemory_google_test(
throttle_tests DISCOVER_TESTS
throttle_tests DISCOVER_TESTS RUN_SERIAL
SOURCES throttle_tests.cpp
LINK_LIBRARIES common-test-libs ${_LIBRARY_TARGET} PROPERTIES PROCESSOR_AFFINITY
ON)
Expand Down Expand Up @@ -248,7 +248,7 @@ endif()

if(TIMEMORY_SOCKET_TESTS)
add_timemory_google_test(
socket_tests
socket_tests RUN_SERIAL
SOURCES socket_tests.cpp
LINK_LIBRARIES common-test-libs timemory::timemory-core test-werror-flags
TIMEOUT 15)
Expand Down Expand Up @@ -288,11 +288,11 @@ add_timemory_google_test(
LINK_LIBRARIES common-test-libs ${_LIBRARY})

add_timemory_google_test(
component_bundle_tests MPI
component_bundle_tests DISCOVER_TESTS MPI
NPROCS 2
SOURCES component_bundle_tests.cpp
LINK_LIBRARIES common-test-libs ${_LIBRARY}
ENVIRONMENT ${component_bundle_tests_env} PROPERTIES PROCESSOR_AFFINITY ON)
ENVIRONMENT ${component_bundle_tests_env})

list(APPEND kokkosp_tests_env "TIMEMORY_COLLAPSE_THREADS=ON")
list(APPEND kokkosp_tests_env "TIMEMORY_NODE_COUNT=1")
Expand All @@ -313,16 +313,16 @@ add_timemory_google_test(

add_timemory_google_test(
flat_tests DISCOVER_TESTS
SOURCES flat_tests.cpp PROPERTIES PROCESSOR_AFFINITY ON
SOURCES flat_tests.cpp
LINK_LIBRARIES common-test-libs extern-test-templates)

add_timemory_google_test(
timeline_tests DISCOVER_TESTS
SOURCES timeline_tests.cpp PROPERTIES PROCESSOR_AFFINITY ON
SOURCES timeline_tests.cpp
LINK_LIBRARIES common-test-libs extern-test-templates)

add_timemory_google_test(
data_tracker_tests DISCOVER_TESTS
data_tracker_tests DISCOVER_TESTS RUN_SERIAL
SOURCES data_tracker_tests.cpp
LINK_LIBRARIES common-test-libs timemory::timemory-plotting timemory::timemory-core
${_LIBRARY})
Expand All @@ -338,27 +338,27 @@ endif()
if(NOT WIN32)
# cache structures are designed for use on Windows
add_timemory_google_test(
cache_tests
cache_tests RUN_SERIAL
SOURCES cache_tests.cpp
LINK_LIBRARIES common-test-libs timemory::timemory-core ${_LIBRARY}
TIMEOUT 300 PROPERTIES PROCESSOR_AFFINITY ON)
endif()

add_timemory_google_test(
archive_storage_tests
archive_storage_tests RUN_SERIAL
SOURCES archive_storage_tests.cpp
LINK_LIBRARIES common-test-libs timemory::timemory-dmp ${_LIBRARY})

add_timemory_google_test(
threading_tests DISCOVER_TESTS
threading_tests DISCOVER_TESTS RUN_SERIAL
SOURCES threading_tests.cpp PROPERTIES PROCESSOR_AFFINITY ON
LINK_LIBRARIES common-test-libs timemory::timemory-plotting timemory::timemory-core
timemory::timemory-ompt ${_LIBRARY} ${_OPENMP})

if(TIMEMORY_USE_PTL OR TARGET PTL::ptl)
list(APPEND ptl_tests_env "TIMEMORY_ENABLE_PTHREAD_GOTCHA_WRAPPER=ON")
add_timemory_google_test(
ptl_tests
ptl_tests RUN_SERIAL
SOURCES ptl_tests.cpp
LINK_LIBRARIES
common-test-libs PTL::ptl ${_LIBRARY} $<$<NOT:$<BOOL:WIN32>>:test-debug-flags>
Expand Down Expand Up @@ -388,7 +388,7 @@ if(NOT WIN32)
endif()

add_timemory_google_test(
tuple_tests DISCOVER_TESTS
tuple_tests DISCOVER_TESTS RUN_SERIAL
SOURCES tuple_tests.cpp
LINK_LIBRARIES common-test-libs timemory::timemory-papi timemory::timemory-plotting
timemory::timemory-caliper ${_LIBRARY})
Expand All @@ -400,14 +400,14 @@ add_timemory_google_test(
${_LIBRARY})

add_timemory_google_test(
hybrid_tests DISCOVER_TESTS
hybrid_tests DISCOVER_TESTS RUN_SERIAL
SOURCES hybrid_tests.cpp
LINK_LIBRARIES common-test-libs ${HYBRID_COMPONENTS} timemory::timemory-plotting
timemory::timemory-core ${_LIBRARY})

add_timemory_google_test(
timing_tests DISCOVER_TESTS
SOURCES timing_tests.cpp PROPERTIES PROCESSOR_AFFINITY ON
timing_tests DISCOVER_TESTS RUN_SERIAL
SOURCES timing_tests.cpp PROPERTIES
LINK_LIBRARIES common-test-libs timemory::timemory-plotting timemory::timemory-core
${_LIBRARY})

Expand Down Expand Up @@ -482,7 +482,7 @@ endif()
if(TIMEMORY_USE_PAPI)
# roofline
add_timemory_google_test(
cpu_roofline_tests DISCOVER_TESTS
cpu_roofline_tests DISCOVER_TESTS RUN_SERIAL
SOURCES cpu_roofline_tests.cpp PROPERTIES PROCESSOR_AFFINITY ON
LINK_LIBRARIES
common-test-libs timemory::timemory-papi timemory::timemory-plotting
Expand Down Expand Up @@ -597,7 +597,7 @@ endif()

if(TIMEMORY_USE_GOTCHA)
add_timemory_google_test(
gotcha_tests DISCOVER_TESTS
gotcha_tests DISCOVER_TESTS RUN_SERIAL
SOURCES gotcha_tests.cpp
LINK_LIBRARIES
common-test-libs gotcha-tests-lib timemory::timemory-headers
Expand Down Expand Up @@ -688,7 +688,7 @@ endif()

if(TIMEMORY_BUILD_ERT)
add_timemory_google_test(
ert_tests
ert_tests RUN_SERIAL
SOURCES ert_tests.cpp PROPERTIES PROCESSOR_AFFINITY ON
LINK_LIBRARIES common-test-libs timemory::timemory-ert ${_LIBRARY})
endif()
Expand Down Expand Up @@ -725,6 +725,8 @@ if(TIMEMORY_USE_PYTHON AND PYTHON_EXECUTABLE)
NAME python_tests
COMMAND ${PYTHON_EXECUTABLE} -m timemory.test -v -v
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})

set_tests_properties(python_tests PROPERTIES RUN_SERIAL ON)
endif()

# Tests recording the symbols of each compiled library
Expand Down
2 changes: 1 addition & 1 deletion source/tests/external/nccl-tests
Submodule nccl-tests updated 1 files
+16 −18 CMakeLists.txt