diff --git a/.appveyor.yml b/.appveyor.yml index 0ec1eabf6..2367bf473 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -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 diff --git a/.circleci/config.yml b/.circleci/config.yml index 7afc2ba84..d5060d0f5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 && @@ -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 && @@ -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 && @@ -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 && diff --git a/.cmake-format.yaml b/.cmake-format.yaml index bb33bc4b8..3d605597e 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -34,6 +34,7 @@ parse: - DISCOVER_TESTS - ADD_TESTS - MPI + - RUN_SERIAL kwargs: NPROCS: '*' TIMEOUT: '*' @@ -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 diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f989e108d..26fbca2cf 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ master, develop ] +env: + CTEST_PARALLEL_LEVEL: 2 + jobs: linux-ci: runs-on: ubuntu-18.04 diff --git a/cmake/Modules/MacroUtilities.cmake b/cmake/Modules/MacroUtilities.cmake index 6a037b9e5..155b6fbe9 100644 --- a/cmake/Modules/MacroUtilities.cmake +++ b/cmake/Modules/MacroUtilities.cmake @@ -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) @@ -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}) @@ -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 "") @@ -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( @@ -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) diff --git a/examples/ex-cxx-tuple/ex_cxx_tuple.cpp b/examples/ex-cxx-tuple/ex_cxx_tuple.cpp index ff1d6280a..58ec4c5a5 100644 --- a/examples/ex-cxx-tuple/ex_cxx_tuple.cpp +++ b/examples/ex-cxx-tuple/ex_cxx_tuple.cpp @@ -44,7 +44,7 @@ using namespace tim::stl; using namespace tim::component; -using papi_tuple_t = papi_tuple; +using papi_tuple_t = papi_tuple; using auto_tuple_t = tim::auto_tuple_t threads; runtime.start(); { - for(int i = 0; i < 7; ++i) + for(int i = 0; i < 3; ++i) threads.push_back(std::thread(run_fib, 35)); - threads.push_back(std::thread(run_fib, 43)); + threads.push_back(std::thread(run_fib, 40)); - run_fib(40); + run_fib(38); for(auto& itr : threads) itr.join(); diff --git a/pyctest-runner.py b/pyctest-runner.py index 54f4867be..c0e35e908 100755 --- a/pyctest-runner.py +++ b/pyctest-runner.py @@ -1260,7 +1260,7 @@ def add_timem_test(name, cmd): pyct.test( construct_name("ex-derived"), - construct_command(["./ex_derived"], args), + construct_command(["./ex_derived", "30", "5"], args), { "WORKING_DIRECTORY": pyct.BINARY_DIRECTORY, "LABELS": pyct.PROJECT_NAME, @@ -1331,7 +1331,7 @@ def add_timem_test(name, cmd): pyct.test( construct_name("ex-c-timing"), - construct_command(["./ex_c_timing"], args), + construct_command(["./ex_c_timing", "30"], args), { "WORKING_DIRECTORY": pyct.BINARY_DIRECTORY, "LABELS": pyct.PROJECT_NAME, @@ -1403,7 +1403,7 @@ def add_timem_test(name, cmd): if args.gotcha: pyct.test( construct_name("ex-gotcha"), - construct_command(["./ex_gotcha"], args), + construct_command(["./ex_gotcha", "5"], args), { "WORKING_DIRECTORY": pyct.BINARY_DIRECTORY, "LABELS": pyct.PROJECT_NAME, @@ -1424,7 +1424,7 @@ def add_timem_test(name, cmd): ) if args.mpi and dmprun is not None: - ex_gotcha_cmd = [dmprun] + dmpargs + ["./ex_gotcha_mpi"] + ex_gotcha_cmd = [dmprun] + dmpargs + ["./ex_gotcha_mpi", "5"] pyct.test( construct_name("ex-gotcha-mpi"), construct_command(ex_gotcha_cmd, args), @@ -1586,7 +1586,7 @@ def add_timem_test(name, cmd): pyct.test( construct_name("ex-statistics"), - construct_command(["./ex_cxx_statistics"], args), + construct_command(["./ex_cxx_statistics", "30", "5"], args), { "WORKING_DIRECTORY": pyct.BINARY_DIRECTORY, "LABELS": pyct.PROJECT_NAME, diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index 9d2322b76..96b3303ca 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -19,6 +19,12 @@ mark_as_advanced(TIMEMORY_SOCKET_TESTS) # include the current directory include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +# for use when environment settings + discover tests causes some issues on Windows +set(_DISCOVER_TESTS_WITH_ENVIRON DISCOVER_TESTS) +if(WIN32) + set(_DISCOVER_TESTS_WITH_ENVIRON) +endif() + set(CMAKE_UNITY_BUILD OFF) if(NOT DEFINED CTEST_TEST_TIMEOUT OR "${CTEST_TEST_TIMEOUT}" STREQUAL "") set(CTEST_TEST_TIMEOUT 180) @@ -154,7 +160,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 @@ -163,7 +169,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 @@ -172,7 +178,7 @@ 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} @@ -180,7 +186,7 @@ foreach(_LINK_TYPE shared static) 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 @@ -193,7 +199,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) @@ -209,14 +215,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) @@ -248,7 +254,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) @@ -288,11 +294,11 @@ add_timemory_google_test( LINK_LIBRARIES common-test-libs ${_LIBRARY}) add_timemory_google_test( - component_bundle_tests MPI + component_bundle_tests ${_DISCOVER_TESTS_WITH_ENVIRON} 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") @@ -313,16 +319,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}) @@ -338,19 +344,19 @@ 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}) @@ -358,7 +364,7 @@ add_timemory_google_test( 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} $<$>:test-debug-flags> @@ -388,7 +394,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}) @@ -400,14 +406,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}) @@ -482,7 +488,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 @@ -597,7 +603,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 @@ -688,7 +694,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() @@ -725,6 +731,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 diff --git a/source/tests/external/nccl-tests b/source/tests/external/nccl-tests index 2793b53ae..29d6b8882 160000 --- a/source/tests/external/nccl-tests +++ b/source/tests/external/nccl-tests @@ -1 +1 @@ -Subproject commit 2793b53ae9db2b7c31c5ed675272b4c01ece7069 +Subproject commit 29d6b88822c4d588d3d4dc15be7c53b192b3537e