From 41a285fa8f2c0cb7449d96db2b4686cbbb5e01e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Thu, 14 Oct 2021 20:56:34 +0200 Subject: [PATCH 1/5] CI: optimized tags for build jobs --- .gitlab-ci.yml | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad6baa05f..7a06cadb3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,13 +36,6 @@ stages: WITH_OPENMP: "yes" WITH_MPI: "yes" -.cuda_openmp_mpi: - extends: .openmp_mpi - # tags are overridden, not merged... - tags: - - docker - - nvidia - # base for Clang builds .clang: stage: build:clang @@ -71,6 +64,10 @@ stages: # running as root does not matter inside Docker containers - export OMPI_ALLOW_RUN_AS_ROOT=1 - export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + # fall back to arch 7.0 when the builder has no GPU to avoid building for all GPU architectures + - if ! nvidia-smi --list-gpus > /dev/null; then + WITH_CUDA_ARCH=7.0; + fi - mkdir -p "./builddir/$CI_JOB_NAME" - pushd "./builddir/$CI_JOB_NAME" - cmake ../.. @@ -180,9 +177,6 @@ cuda_matrix_tests_Release: cuda_nontests_Debug: extends: .build_template stage: build:cuda - tags: - - docker - - nvidia variables: <<: *default_cmake_flags WITH_CUDA: "yes" @@ -195,9 +189,6 @@ cuda_nontests_Debug: cuda_nontests_Release: extends: .build_template stage: build:cuda - tags: - - docker - - nvidia variables: <<: *default_cmake_flags WITH_CUDA: "yes" @@ -211,32 +202,32 @@ cuda_nontests_Release: cuda_mpi_tests_Debug: extends: - cuda_tests_Debug - - .cuda_openmp_mpi + - .openmp_mpi cuda_mpi_tests_Release: extends: - cuda_tests_Release - - .cuda_openmp_mpi + - .openmp_mpi cuda_mpi_matrix_tests_Debug: extends: - cuda_matrix_tests_Debug - - .cuda_openmp_mpi + - .openmp_mpi cuda_mpi_matrix_tests_Release: extends: - cuda_matrix_tests_Release - - .cuda_openmp_mpi + - .openmp_mpi cuda_mpi_nontests_Debug: extends: - cuda_nontests_Debug - - .cuda_openmp_mpi + - .openmp_mpi cuda_mpi_nontests_Release: extends: - cuda_nontests_Release - - .cuda_openmp_mpi + - .openmp_mpi -- GitLab From d09d3be59c05e604b50c8289840dc638cc461edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Fri, 15 Oct 2021 18:58:36 +0200 Subject: [PATCH 2/5] CI: updated build script template to avoid unnecessary pushd/popd --- .gitlab-ci.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a06cadb3..85b56388b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -68,12 +68,9 @@ stages: - if ! nvidia-smi --list-gpus > /dev/null; then WITH_CUDA_ARCH=7.0; fi - - mkdir -p "./builddir/$CI_JOB_NAME" - - pushd "./builddir/$CI_JOB_NAME" - - cmake ../.. - -G Ninja + - cmake -B "./builddir/$CI_JOB_NAME" -S . -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX="$(pwd)/${BUILD_TYPE}_install_prefix" + -DCMAKE_INSTALL_PREFIX="$(pwd)/install_prefix/$CI_JOB_NAME" -DWITH_OPENMP=${WITH_OPENMP} -DWITH_MPI=${WITH_MPI} -DWITH_CUDA=${WITH_CUDA} @@ -88,11 +85,10 @@ stages: -DBUILD_PYTHON=${BUILD_PYTHON} -DWITH_CI_FLAGS=yes # "install" implies the "all" target - - ninja ${NINJAFLAGS} install + - ninja -C "./builddir/$CI_JOB_NAME" ${NINJAFLAGS} install - if [[ ${BUILD_TESTS} == "yes" ]] || [[ ${BUILD_MATRIX_TESTS} == "yes" ]]; then - ninja test; + ninja -C "./builddir/$CI_JOB_NAME" test; fi - - popd variables: <<: *default_cmake_flags BUILD_TYPE: Debug -- GitLab From 122a92fe9c008a30d4979b6475297235ce2b1b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Fri, 15 Oct 2021 19:44:45 +0200 Subject: [PATCH 3/5] Removed unused script --- Documentation/fetch-outputs | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100755 Documentation/fetch-outputs diff --git a/Documentation/fetch-outputs b/Documentation/fetch-outputs deleted file mode 100755 index bb1a669b5..000000000 --- a/Documentation/fetch-outputs +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -OUTPUTS_PATH=../Release/src/Examples - -DOC_ROOT_DIR=`pwd` - -echo $DOC_ROOT_DIR - -mkdir Outputs - -find $OUTPUTS_PATH -name "*.out" -exec echo '{}' Outputs/'{}' \; - -- GitLab From 37b54df6e1c5dab59afa3731f5bedd65aa15ed82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Fri, 15 Oct 2021 19:49:32 +0200 Subject: [PATCH 4/5] build script: reorganized output directories The build directory for all build types is grouped under a top-level build directory called "builddir", i.e. "builddir/Release" etc. --- .gitignore | 20 ++++++++++++-------- build | 16 ++++++---------- scripts/make_coverage_report | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index b0decb2aa..14140a23b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,10 @@ -/nbproject -/Debug -/Release -/RelWithDebInfo -/Testing +# build/output directories +/builddir /Documentation/html/ /Documentation/output_snippets/ -/CMakeLists.txt.user -/Build -/coverage_report + +# Netbeans project stuff +/nbproject # Eclipse project stuff /.settings @@ -25,3 +22,10 @@ # GDB .gdb_history + +# old/deprecated directories (can be removed later, they are not used anymore) +/Debug +/Release +/RelWithDebInfo +/Testing +/Build diff --git a/build b/build index aa764ae81..8b802038f 100755 --- a/build +++ b/build @@ -145,10 +145,6 @@ if [[ ! "Release Debug RelWithDebInfo" =~ "$BUILD" ]]; then echo "Unknown build type: $BUILD. The available build types are: Release, Debug, RelWithDebInfo." >&2 exit 1 fi -if [[ ! -d "$BUILD" ]]; then - mkdir "$BUILD" -fi -pushd "$BUILD" >/dev/null # handle targets for target in "$@"; do @@ -209,9 +205,9 @@ else check_file="Makefile" fi +BUILD_DIR="builddir/$BUILD" cmake_command=( - ${CMAKE} ${ROOT_DIR} - -G "${generator}" + ${CMAKE} -B "$BUILD_DIR" -S "$ROOT_DIR" -G "$generator" -DCMAKE_BUILD_TYPE=${BUILD} -DCMAKE_INSTALL_PREFIX=${PREFIX} -DDCMTK_DIR=${DCMTK_DIR} @@ -238,14 +234,14 @@ cmake_command=( # The build system (e.g. make) will call it automatically if necessary (e.g. # when some CMakeLists.txt changes). if [[ -f ".cmake_command" ]]; then - last_cmake_command=$(cat ".cmake_command" 2>/dev/null) + last_cmake_command=$(cat "$BUILD_DIR/.cmake_command" 2>/dev/null) else last_cmake_command="" fi if [[ ! -f "$check_file" ]] || [[ "$last_cmake_command" != "${cmake_command[@]}" ]]; then echo "Configuring ${BUILD} TNL ..." "${cmake_command[@]}" - echo -n "${cmake_command[@]}" > ".cmake_command" + echo -n "${cmake_command[@]}" > "$BUILD_DIR/.cmake_command" fi if [[ ${CMAKE_ONLY} == "yes" ]]; then @@ -294,7 +290,7 @@ if [[ "$make" != "make" ]] && [[ "$VERBOSE" ]]; then VERBOSE="-v" fi -if ! $make ${VERBOSE} $make_target; then +if ! $make -C "$BUILD_DIR" ${VERBOSE} $make_target; then exit 1 fi @@ -304,6 +300,6 @@ fi if [[ ${BUILD_TESTS} == "yes" ]] || [[ ${BUILD_MATRIX_TESTS} == "yes" ]]; then if [[ ${RUN_TESTS} == "yes" ]]; then - OMP_NUM_THREADS=${TESTS_JOBS} CTEST_PARALLEL_LEVEL=${TESTS_JOBS} CTEST_OUTPUT_ON_FAILURE=1 $make test + OMP_NUM_THREADS=${TESTS_JOBS} CTEST_PARALLEL_LEVEL=${TESTS_JOBS} CTEST_OUTPUT_ON_FAILURE=1 $make -C "$BUILD_DIR" test fi fi diff --git a/scripts/make_coverage_report b/scripts/make_coverage_report index e0c9f1820..645158a30 100755 --- a/scripts/make_coverage_report +++ b/scripts/make_coverage_report @@ -80,4 +80,4 @@ tests=( ) # run the programs and create coverage reports -./scripts/code_coverage/coverage.py -b Debug -o coverage_report/ --ignore-filename-regex="^\/tmp\/tmpxft_.*" "${tests[@]}" +./scripts/code_coverage/coverage.py -b builddir/Debug -o builddir/coverage_report/ --ignore-filename-regex="^\/tmp\/tmpxft_.*" "${tests[@]}" -- GitLab From 18d89c3ecc69642577b0c1962675faf2df58219f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Fri, 15 Oct 2021 20:05:06 +0200 Subject: [PATCH 5/5] build script: added command to remove old build directories --- build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build b/build index 8b802038f..1850c1758 100755 --- a/build +++ b/build @@ -205,6 +205,10 @@ else check_file="Makefile" fi +# remove old build directories that were used before the unified top-level "builddir" +# (TODO: this code be removed later) +rm -rf ./Release ./Debug ./RelWithDebInfo ./Testing ./Build + BUILD_DIR="builddir/$BUILD" cmake_command=( ${CMAKE} -B "$BUILD_DIR" -S "$ROOT_DIR" -G "$generator" -- GitLab