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 all commits
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
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
8 changes: 4 additions & 4 deletions examples/ex-cxx-tuple/ex_cxx_tuple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
using namespace tim::stl;
using namespace tim::component;

using papi_tuple_t = papi_tuple<PAPI_TOT_CYC, PAPI_TOT_INS, PAPI_LST_INS>;
using papi_tuple_t = papi_tuple<PAPI_TOT_CYC, PAPI_TOT_INS>;

using auto_tuple_t =
tim::auto_tuple_t<wall_clock, system_clock, thread_cpu_clock, thread_cpu_util,
Expand Down Expand Up @@ -242,11 +242,11 @@ test_2_timing()
std::vector<std::thread> 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();
Expand Down
10 changes: 5 additions & 5 deletions pyctest-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
Loading