diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml index 7a1e97a80e8..814bb2e33ba 100644 --- a/.github/workflows/intel.yml +++ b/.github/workflows/intel.yml @@ -21,9 +21,9 @@ jobs: fail-fast: false matrix: config: - - {compiler: "dpcpp", build_type: "Release", name: "intel/dpcpp/release/shared", mixed: "ON"} - - {compiler: "icpx", build_type: "Release", name: "intel/icpx/release/shared", mixed: "OFF"} - name: ${{ matrix.config.name }} + - { preset: "ci/sycl/dpcpp/nompi/release/singlemode" } + - { preset: "ci/sycl/icpx/nompi/release/singlemode/nomixed" } + name: ${{ matrix.config.preset }} runs-on: [gpu_intel] steps: @@ -36,8 +36,8 @@ jobs: module load intel-oneapi-compilers intel-oneapi-dpl intel-oneapi-mkl intel-oneapi-tbb cmake mkdir build cd build - cmake .. -DCMAKE_INSTALL_PREFIX=install_ginkgo -DCMAKE_CXX_FLAGS="-Wpedantic -ffp-model=precise" -DCMAKE_CXX_COMPILER=${{ matrix.config.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DGINKGO_MIXED_PRECISION=${{ matrix.config.mixed }} -DGINKGO_BUILD_CUDA=OFF -DGINKGO_BUILD_HIP=OFF -DGINKGO_BUILD_MPI=OFF -DGINKGO_DPCPP_SINGLE_MODE=ON - make -j8 + cmake -S .. -B . --preset ${{ matrix.config.preset }} -DCMAKE_INSTALL_PREFIX=install_ginkgo + cmake --build . -j8 ONEAPI_DEVICE_SELECTOR=level_zero:gpu ctest -j10 --output-on-failure - name: install diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 441be04d842..001297ea5f5 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -27,9 +27,9 @@ jobs: fail-fast: false matrix: config: - - {shared: "ON", build_type: "Debug", name: "omp/debug/shared", "mixed": "OFF"} - - {shared: "OFF", build_type: "Release", name: "omp/release/static", "mixed": "ON"} - name: ${{ matrix.config.name }} + - { preset: "ci/omp/clang/nompi/debug/nomixed" } + - { preset: "ci/omp/clang/nompi/release/static" } + name: ${{ matrix.config.preset }} runs-on: [macos-latest] steps: @@ -42,7 +42,7 @@ jobs: - name: info run: | - g++ -v + clang++ -v cmake --version - name: Debug over SSH (tmate) @@ -55,12 +55,12 @@ jobs: mkdir install export INSTALL_PREFIX=`pwd`/install cd build - cmake .. -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp/ -DCMAKE_CXX_FLAGS=-Wpedantic -DBUILD_SHARED_LIBS=${{ matrix.config.shared }} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DGINKGO_MIXED_PRECISION=${{ matrix.config.mixed }} - make -j8 + cmake -S .. -B . --preset ${{ matrix.config.preset }} -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp/ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} + cmake --build . -j8 ctest -j10 --output-on-failure - name: install run: | cd build - make install - make test_install + cmake --install . + cmake --build . --target test_install diff --git a/.github/workflows/windows-mingw.yml b/.github/workflows/windows-mingw.yml index 1c859661562..31adbba8a4d 100644 --- a/.github/workflows/windows-mingw.yml +++ b/.github/workflows/windows-mingw.yml @@ -28,8 +28,8 @@ jobs: fail-fast: false matrix: config: - - {shared: "OFF", build_type: "Release", name: "omp/release/static", cflags: ""} - name: mingw/${{ matrix.config.name }} + - { preset: "ci/omp/mingwgcc/nompi/release/static" } + name: ${{ matrix.config.preset }} runs-on: [windows-latest] steps: - name: Checkout the latest code (shallow clone) @@ -50,7 +50,7 @@ jobs: set PATH=C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin;%PATH% mkdir build cd build - cmake -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=${{ matrix.config.shared }} -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_CXX_FLAGS=${{ matrix.config.cflags }} .. + cmake -S .. -B . --preset ${{ matrix.config.preset }} cmake --build . -j4 shell: cmd diff --git a/.github/workflows/windows-msvc-cuda.yml b/.github/workflows/windows-msvc-cuda.yml index efa637b2bf9..5f7f8db984b 100644 --- a/.github/workflows/windows-msvc-cuda.yml +++ b/.github/workflows/windows-msvc-cuda.yml @@ -28,10 +28,13 @@ jobs: fail-fast: false matrix: config: - - {version: "latest", name: "cuda-latest/release/shared", "mixed": "ON"} - name: msvc/${{ matrix.config.name }} (only compile) + - {version: "latest", preset: "ci/cuda/msvc/nompi/release"} + name: ${{ matrix.config.preset }} (only compile) runs-on: [windows-2019] + env: + CUDA_ARCH: "60" + steps: - name: Checkout the latest code (shallow clone) uses: actions/checkout@v4 @@ -58,5 +61,5 @@ jobs: refreshenv mkdir build cd build - cmake -DGINKGO_BUILD_CUDA=ON -DGINKGO_BUILD_OMP=OFF -DGINKGO_MIXED_PRECISION=${{ matrix.config.mixed }} -DGINKGO_CUDA_ARCHITECTURES=60 .. + cmake -S .. -B . --preset ${{ matrix.config.preset }} cmake --build . -j4 --config Release diff --git a/.github/workflows/windows-msvc-ref.yml b/.github/workflows/windows-msvc-ref.yml index 60a811bb99b..308af1aa1b0 100644 --- a/.github/workflows/windows-msvc-ref.yml +++ b/.github/workflows/windows-msvc-ref.yml @@ -30,11 +30,11 @@ jobs: config: # Debug shared exceeds symbol limit # - {shared: "ON", build_type: "Debug", name: "reference/debug/shared"} - - {shared: "OFF", build_type: "Release", name: "reference/release/static"} - - {shared: "ON", build_type: "Release", name: "reference/release/shared"} + - { preset: "ci/ref/msvc/nompi/release/static" } + - { preset: "ci/ref/msvc/nompi/release" } # Debug static needs too much storage # - {shared: "OFF", build_type: "Debug", name: "reference/debug/static"} - name: msvc/${{ matrix.config.name }} + name: ${{ matrix.config.preset }} runs-on: [windows-latest] steps: - name: Checkout the latest code (shallow clone) @@ -50,13 +50,13 @@ jobs: run: | mkdir build cd build - cmake -DBUILD_SHARED_LIBS=${{ matrix.config.shared }} -DCMAKE_CXX_FLAGS_DEBUG='/MDd /Zi /Ob1 /O1 /Od /RTC1' -DGINKGO_BUILD_CUDA=OFF -DGINKGO_BUILD_OMP=OFF .. - cmake --build . -j4 --config ${{ matrix.config.build_type }} - ctest . -C ${{ matrix.config.build_type }} --output-on-failure + cmake -S .. -B . --preset ${{ matrix.config.preset }} + cmake --build . -j4 + ctest . --output-on-failure - name: install run: | $env:PATH="$env:PATH;C:\Program Files (x86)\Ginkgo\bin" cd build - cmake --install . --config ${{ matrix.config.build_type }} - cmake --build . --target test_install --config ${{ matrix.config.build_type }} + cmake --install . + cmake --build . --target test_install diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f8e3a892a5..05861872d37 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ stages: - init-status - sync - trigger_pipeline + - configure - build - test - code_quality @@ -90,6 +91,27 @@ trigger_pipeline: echo "Can not find the corresponding Pull Request" fi +configure/cmake-3.16: + extends: + - .quick_test_condition + - .configure_template + - .use_gko-rocm45-nompi-gnu8-llvm8 + variables: + BUILD_CUDA: "OFF" + BUILD_HIP: "ON" + BUILD_SYCL: "OFF" + BUILD_MPI: "ON" + +configure/cmake-3.18: + extends: + - .quick_test_condition + - .configure_template + - .use_gko-cuda102-nompi-gnu8-llvm8-intel2019 + variables: + BUILD_CUDA: "ON" + BUILD_HIP: "OFF" + BUILD_SYCL: "OFF" + BUILD_MPI: "OFF" # Build jobs # Job with example runs. @@ -101,12 +123,7 @@ build/cuda110/mvapich2/gcc/cuda/debug/shared: - .quick_test_condition - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_MPI: "ON" - BUILD_TYPE: "Debug" - FAST_TESTS: "ON" - NONDEFAULT_STREAM: "ON" + CI_CMAKE_PRESET: "ci/cuda+omp/gcc/mpi/debug/fasttest/nondefault_stream" CUDA_ARCH: 80 USE_NAME: "cuda110-mvapich2-gcc-${CI_PIPELINE_ID}" KEEP_CONTAINER: "ON" @@ -134,11 +151,7 @@ build/cuda110/nompi/clang/cuda/release/static: - .full_test_condition - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_TYPE: "Release" - BUILD_SHARED_LIBS: "OFF" + CI_CMAKE_PRESET: "ci/cuda+omp/clang/nompi/release/static" CUDA_ARCH: 80 USE_NAME: "cuda110-nompi-clang-${CI_PIPELINE_ID}" KEEP_CONTAINER: "ON" @@ -157,7 +170,7 @@ test/cuda110/nompi/clang/cuda/release/static: SLURM_TIME: "01:30:00" dependencies: null needs: [ "build/cuda110/nompi/clang/cuda/release/static" ] - + build/cuda110/nompi/clang/cuda/release/shared: extends: @@ -166,14 +179,8 @@ build/cuda110/nompi/clang/cuda/release/shared: - .quick_test_condition - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: - CXX_COMPILER: "clang++" + CI_CMAKE_PRESET: "ci/cuda+omp/clang/nompi/release/fasttest/shared" CUDA_ARCH: 52 - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_TYPE: "Release" - FAST_TESTS: "ON" - # disable spurious unused argument warning - EXTRA_CMAKE_FLAGS: "-DCMAKE_CUDA_FLAGS=-diag-suppress=177" # cuda 11.4 and friends @@ -184,14 +191,7 @@ build/cuda114/nompi/gcc/cuda/debug/shared: - .quick_test_condition - .use_gko_cuda114-openmpi-gnu10-llvm12 variables: - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_TYPE: "Debug" - FAST_TESTS: "ON" - # fix gtest issue https://github.com/google/googletest/issues/3514 - CXX_FLAGS: "-Wno-error=maybe-uninitialized" - # disable spurious unused argument warning - EXTRA_CMAKE_FLAGS: "-DCMAKE_CUDA_FLAGS=-diag-suppress=177" + CI_CMAKE_PRESET: "ci/cuda+omp/gcc/nompi/debug/fasttest" # nvhpc and friends @@ -202,17 +202,7 @@ build/nvhpc233/cuda120/nompi/nvcpp/release/static: - .quick_test_condition - .use_gko_nvhpc233-cuda120-openmpi-gnu12-llvm16 variables: - CXX_COMPILER: "nvc++" - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_MPI: "OFF" - BUILD_TYPE: "Release" - FAST_TESTS: "ON" - BUILD_SHARED_LIBS: "OFF" - # disable common gflags warnings - CXX_FLAGS: "--diag_suppress=useless_using_declaration,declared_but_not_referenced" - # disable spurious unused argument warning - EXTRA_CMAKE_FLAGS: "-DCMAKE_CUDA_FLAGS=-diag-suppress=177" + CI_CMAKE_PRESET: "ci/cuda+omp/nvhpc/nompi/release/static/fasttest" build/nvhpc227/cuda117/nompi/nvcpp/debug/shared: extends: @@ -221,16 +211,7 @@ build/nvhpc227/cuda117/nompi/nvcpp/debug/shared: - .quick_test_condition - .use_gko_nvhpc227-cuda117-openmpi-gnu11-llvm14 variables: - CXX_COMPILER: "nvc++" - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_MPI: "OFF" - BUILD_TYPE: "Debug" - FAST_TESTS: "ON" - # disable common gflags warnings - CXX_FLAGS: "--diag_suppress=useless_using_declaration,declared_but_not_referenced" - # disable spurious unused argument warning - EXTRA_CMAKE_FLAGS: "-DCMAKE_CUDA_FLAGS=-diag-suppress=177" + CI_CMAKE_PRESET: "ci/cuda+omp/nvhpc/nompi/debug/fasttest" # ROCm 4.5 and friends build/amd/nompi/gcc/rocm45/release/shared: @@ -240,11 +221,7 @@ build/amd/nompi/gcc/rocm45/release/shared: - .quick_test_condition - .use_gko-rocm45-nompi-gnu8-llvm8 variables: - BUILD_OMP: "ON" - BUILD_HIP: "ON" - NONDEFAULT_STREAM: "ON" - BUILD_TYPE: "Release" - BUILD_HWLOC: "OFF" + CI_CMAKE_PRESET: "ci/hip+omp/gcc/nompi/release/fasttest/nondefault_stream" build/amd/nompi/clang/rocm45/release/static: extends: @@ -253,11 +230,7 @@ build/amd/nompi/clang/rocm45/release/static: - .full_test_condition - .use_gko-rocm45-nompi-gnu8-llvm8 variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - BUILD_HIP: "ON" - BUILD_TYPE: "Release" - BUILD_SHARED_LIBS: "OFF" + CI_CMAKE_PRESET: "ci/hip+omp/clang/nompi/release/static" build/amd/nompi/clang/rocm45/debug/shared: extends: @@ -266,10 +239,7 @@ build/amd/nompi/clang/rocm45/debug/shared: - .quick_test_condition - .use_gko-rocm45-nompi-gnu8-llvm8 variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - BUILD_HIP: "ON" - BUILD_TYPE: "Debug" + CI_CMAKE_PRESET: "ci/hip+omp/clang/nompi/debug" # ROCm 5.1.4 and friends build/amd/nompi/gcc/rocm514/debug/static: @@ -279,10 +249,7 @@ build/amd/nompi/gcc/rocm514/debug/static: - .full_test_condition - .use_gko-rocm514-nompi-gnu11-llvm11 variables: - BUILD_OMP: "ON" - BUILD_HIP: "ON" - BUILD_TYPE: "Debug" - BUILD_SHARED_LIBS: "OFF" + CI_CMAKE_PRESET: "ci/hip+omp/gcc/nompi/debug/static" build/amd/nompi/clang/rocm514/release/shared: extends: @@ -291,10 +258,7 @@ build/amd/nompi/clang/rocm514/release/shared: - .quick_test_condition - .use_gko-rocm514-nompi-gnu11-llvm11 variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - BUILD_HIP: "ON" - BUILD_TYPE: "Release" + CI_CMAKE_PRESET: "ci/hip+omp/clang/nompi/release" # without omp build/amd/nompi/gcc/rocm514_wo_omp/release/shared: @@ -304,10 +268,7 @@ build/amd/nompi/gcc/rocm514_wo_omp/release/shared: - .full_test_condition - .use_gko-rocm514-nompi-gnu11-llvm11 variables: - BUILD_OMP: "OFF" - BUILD_MPI: "OFF" - BUILD_HIP: "ON" - BUILD_TYPE: "Release" + CI_CMAKE_PRESET: "ci/hip/gcc/nompi/release" # no cuda but latest gcc and clang build/nocuda/nompi/gcc/core/debug/static: @@ -317,10 +278,7 @@ build/nocuda/nompi/gcc/core/debug/static: - .quick_test_condition - .use_gko-nocuda-nompi-gnu9-llvm8 variables: - BUILD_TYPE: "Debug" - FAST_TESTS: "ON" - BUILD_SHARED_LIBS: "OFF" - BUILD_HWLOC: "OFF" + CI_CMAKE_PRESET: "ci/ref/gcc/nompi/debug/static/fasttest" build/nocuda/nompi/clang/core/release/shared: extends: @@ -329,8 +287,7 @@ build/nocuda/nompi/clang/core/release/shared: - .quick_test_condition - .use_gko-nocuda-nompi-gnu9-llvm8 variables: - CXX_COMPILER: "clang++" - BUILD_TYPE: "Release" + CI_CMAKE_PRESET: "ci/ref/clang/nompi/release" build/nocuda/nompi/gcc/omp/release/shared: extends: @@ -339,8 +296,7 @@ build/nocuda/nompi/gcc/omp/release/shared: - .quick_test_condition - .use_gko-nocuda-nompi-gnu9-llvm8 variables: - BUILD_OMP: "ON" - BUILD_TYPE: "Release" + CI_CMAKE_PRESET: "ci/omp/gcc/nompi/release" build/nocuda/openmpi/clang/omp/debug/static: extends: @@ -349,13 +305,7 @@ build/nocuda/openmpi/clang/omp/debug/static: - .full_test_condition - .use_gko-nocuda-openmpi-gnu9-llvm8 variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - MPI_AS_ROOT: "ON" - BUILD_MPI: "ON" - BUILD_TYPE: "Debug" - FAST_TESTS: "ON" - BUILD_SHARED_LIBS: "OFF" + CI_CMAKE_PRESET: "ci/omp/clang/mpi/debug/static/fasttest" build/nocuda/openmpi/clang/omp/glibcxx-debug-release/shared: extends: @@ -364,13 +314,7 @@ build/nocuda/openmpi/clang/omp/glibcxx-debug-release/shared: - .quick_test_condition - .use_gko-nocuda-nompi-gnu9-llvm8 variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - MPI_AS_ROOT: "ON" - BUILD_MPI: "ON" - CXX_FLAGS: "-Wpedantic -D_GLIBCXX_DEBUG=1" - # The tests are prohibitively slow in Debug - BUILD_TYPE: "Release" + CI_CMAKE_PRESET: "ci/omp/clang/mpi/glibcxx+debug/release" # nocuda with old compiler build/nocuda/nompi/gcc/omp/release/static: @@ -380,9 +324,7 @@ build/nocuda/nompi/gcc/omp/release/static: - .quick_test_condition - .use_gko-nocuda-nompi-gnu9-llvm8 variables: - BUILD_OMP: "ON" - BUILD_TYPE: "Release" - BUILD_SHARED_LIBS: "OFF" + CI_CMAKE_PRESET: "ci/omp/gcc/nompi/release/static" build/nocuda-nomixed/nompi/clang/omp/release/static: extends: @@ -391,11 +333,7 @@ build/nocuda-nomixed/nompi/clang/omp/release/static: - .full_test_condition - .use_gko-nocuda-nompi-gnu9-llvm8 variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - BUILD_TYPE: "Release" - BUILD_SHARED_LIBS: "OFF" - MIXED_PRECISION: "OFF" + CI_CMAKE_PRESET: "ci/omp/clang/nompi/release/static/nomixed" build/nocuda-nomixed/openmpi/gcc/omp/release/shared: extends: @@ -404,11 +342,7 @@ build/nocuda-nomixed/openmpi/gcc/omp/release/shared: - .quick_test_condition - .use_gko-nocuda-nompi-gnu9-llvm8 variables: - BUILD_MPI: "ON" - MPI_AS_ROOT: "ON" - BUILD_OMP: "ON" - BUILD_TYPE: "Release" - MIXED_PRECISION: "OFF" + CI_CMAKE_PRESET: "ci/omp/gcc/mpi/release/nomixed" build/nocuda-nomixed/nompi/clang/omp/debug/static: extends: @@ -417,11 +351,7 @@ build/nocuda-nomixed/nompi/clang/omp/debug/static: - .full_test_condition - .use_gko-nocuda-nompi-gnu9-llvm8 variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - BUILD_TYPE: "Debug" - BUILD_SHARED_LIBS: "OFF" - MIXED_PRECISION: "OFF" + CI_CMAKE_PRESET: "ci/omp/clang/nompi/debug/static/nomixed" # spack oneapi 2023.1 build/icpx20231/igpu/release/shared: @@ -431,14 +361,8 @@ build/icpx20231/igpu/release/shared: - .quick_test_condition - .use_gko-oneapi20231-igpu variables: - CXX_COMPILER: "icpx" - CXX_FLAGS: "-Wpedantic -ffp-model=precise" - BUILD_SYCL: "ON" - BUILD_TYPE: "Release" - BUILD_SHARED_LIBS: "ON" - DPCPP_SINGLE_MODE: "ON" + CI_CMAKE_PRESET: "ci/sycl/icpx/nompi/release/shared/singlemode" ONEAPI_DEVICE_SELECTOR: "opencl:gpu" - BUILD_HWLOC: "OFF" # TODO: Enable when debug shared library size issues are fixed # build/dpcpp/level_zero_igpu/debug/shared: @@ -464,14 +388,8 @@ build/icpx/igpu/release/static: - .full_test_condition - .use_gko-oneapi-igpu variables: - CXX_COMPILER: "dpcpp" - CXX_FLAGS: "-Wpedantic -ffp-model=precise" - BUILD_SYCL: "ON" - BUILD_TYPE: "Release" - BUILD_SHARED_LIBS: "OF" - DPCPP_SINGLE_MODE: "ON" + CI_CMAKE_PRESET: "ci/sycl/dpcpp/nompi/release/static/singlemode" ONEAPI_DEVICE_SELECTOR: "*:gpu" - BUILD_HWLOC: "OFF" # windows jobs # Note that this is using Powershell, not bash @@ -484,7 +402,7 @@ build/windows-cuda/release/shared: - if (Test-Path install) { rm -r -fo install } - mkdir build - mkdir install - - cmake -B build -DBUILD_SHARED_LIBS=ON -DGINKGO_BUILD_CUDA=ON "-DCMAKE_INSTALL_PREFIX=$pwd\install" . + - cmake -B build --preset "ci/cuda/msvc/nompi/release/shared" "-DCMAKE_INSTALL_PREFIX=$pwd\install" . - cmake --build build --config Release -j16 # we disable these tests until the triangular solver issues are resolved # - ctest --test-dir build -C Release --no-tests=error --output-on-failure @@ -503,7 +421,7 @@ build/windows/release/shared: - if (Test-Path install) { rm -r -fo install } - mkdir build - mkdir install - - cmake -B build -DBUILD_SHARED_LIBS=ON -DGINKGO_BUILD_CUDA=OFF "-DCMAKE_INSTALL_PREFIX=$pwd\install" . + - cmake -B build --preset "ci/ref/msvc/nompi/release" "-DCMAKE_INSTALL_PREFIX=$pwd\install" . - cmake --build build --config Release -j16 - ctest --test-dir build -C Release --no-tests=error --output-on-failure -j16 - $env:PATH+=";$pwd/install/bin" @@ -521,9 +439,7 @@ warnings: - .full_test_condition - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - CXX_FLAGS: "-Werror=pedantic -pedantic-errors" + CI_CMAKE_PRESET: "ci/warnings" allow_failure: yes # Ensure kernel modules do not depend on core @@ -535,9 +451,7 @@ no-circular-deps: - .quick_test_condition - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - EXTRA_CMAKE_FLAGS: '-DGINKGO_CHECK_CIRCULAR_DEPS=on' + CI_CMAKE_PRESET: "ci/no_circular_deps" allow_failure: no # Ensure Ginkgo builds from a subdirectory @@ -549,8 +463,7 @@ subdir-build: - .full_test_condition - .use_gko-nocuda-nompi-gnu9-llvm8 variables: - BUILD_OMP: "ON" - CI_PROJECT_PATH_SUFFIX: "/test_subdir" + CI_CMAKE_PRESET: "ci/subdir_build" allow_failure: no # Run clang-tidy and iwyu @@ -562,9 +475,7 @@ clang-tidy: - .full_test_condition - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - EXTRA_CMAKE_FLAGS: '-DGINKGO_WITH_CLANG_TIDY=ON' + CI_CMAKE_PRESET: "ci/clang_tidy" allow_failure: yes iwyu: @@ -575,9 +486,7 @@ iwyu: - .full_test_condition - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - EXTRA_CMAKE_FLAGS: '-DGINKGO_WITH_IWYU=ON' + CI_CMAKE_PRESET: "ci/iwyu" allow_failure: yes # Code analysis, coverage and reporting tool @@ -769,12 +678,7 @@ benchmark-cuda-spmv-build: - .benchmark-spmv-cuda-rules stage: benchmark-build variables: - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_MPI: "ON" - MPI_AS_ROOT: "ON" - BUILD_HIP: "OFF" - BUILD_TYPE: "Release" + CI_CMAKE_PRESET: "ci/cuda+omp/gcc/mpi/release/shared" CUDA_ARCH: 80 USE_NAME: "benchmark-cuda-spmv-${CI_PIPELINE_ID}" KEEP_CONTAINER: "ON" diff --git a/.gitlab/scripts.yml b/.gitlab/scripts.yml index dda127ff535..cd00478ee3e 100644 --- a/.gitlab/scripts.yml +++ b/.gitlab/scripts.yml @@ -15,6 +15,43 @@ - git config --global user.name "${BOT_USER}" - git config --global user.email "${BOT_EMAIL}" +.environment_script: &environment_script + - | + # extracts the value of the given CMake cache variable + function get_cache_val() { + cmake -S ${CI_PROJECT_DIR}${CI_PROJECT_DIR_SUFFIX} -B . -L -N | grep $1 | sed -e 's/.*=//' + } + - if [ -n "${CUDA_ARCH}" ]; then + export CUDA_ARCH_STR=-DGINKGO_CUDA_ARCHITECTURES=${CUDA_ARCH}; + fi + - | + export OMPI_ALLOW_RUN_AS_ROOT=1; + export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1; + - export CC=${C_COMPILER} CXX=${CXX_COMPILER} CUDAHOSTCXX=${CXX_COMPILER} CUDACXX=${CUDA_COMPILER} + + +.configure_template: + stage: configure + extends: + - .before_script_template + script: + - mkdir -p ${CI_JOB_NAME} && cd ${CI_JOB_NAME} + - *environment_script + - | + cmake -S ${CI_PROJECT_DIR}${CI_PROJECT_DIR_SUFFIX} -B . \ + -DGINKGO_BUILD_REFERENCE=ON -DGINKGO_BUILD_OMP=ON \ + -DGINKGO_BUILD_MPI=${BUILD_MPI} -DGINKGO_BUILD_CUDA=${BUILD_CUDA} \ + -DGINKGO_BUILD_HIP=${BUILD_HIP} -DGINKGO_BUILD_SYCL=${BUILD_SYCL} \ + -DGINKGO_MIXED_PRECISION=ON -DGINKGO_FORCE_GPU_AWARE_MPI=ON \ + -DGINKGO_BUILD_TESTS=ON -DGINKGO_FAST_TESTS=ON -DGINKGO_BUILD_EXTLIB_EXAMPLE=OFF \ + -DGINKGO_BUILD_BENCHMARKS=ON -DGINKGO_BENCHMARK_ENABLE_TUNING=ON \ + -DGINKGO_DEVEL_TOOLS=OFF -DGINKGO_WITH_CLANG_TIDY=ON -DGINKGO_WITH_IWYU=ON \ + -DGINKGO_CHECK_CIRCULAR_DEPS=ON -DGINKGO_WITH_CCACHE=ON \ + -DGINKGO_BUILD_PAPI_SDE=OFF -DGINKGO_BUILD_HWLOC=ON \ + -DGINKGO_BUILD_TESTS=ON -DGINKGO_BUILD_EXAMPLES=ON \ + -DGINKGO_BUILD_DOC=OFF + dependencies: [] + .build_template: stage: build extends: @@ -23,35 +60,8 @@ - mkdir -p ${CI_JOB_NAME} && cd ${CI_JOB_NAME} - mkdir install_prefix - export INSTALL_PREFIX=`pwd`/install_prefix - - if [ -n "${CUDA_ARCH}" ]; then - export CUDA_ARCH_STR=-DGINKGO_CUDA_ARCHITECTURES=${CUDA_ARCH}; - fi - - if [[ "${MPI_AS_ROOT}" == "ON" ]];then - export OMPI_ALLOW_RUN_AS_ROOT=1; - export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1; - fi - - if [[ "${BUILD_MPI}" == "ON" ]]; then - MPI_STR=-DGINKGO_MPI_EXEC_SUFFIX=${MPI_SUFFIX}; - fi - - export CXX=${CXX_COMPILER} CUDAHOSTCXX=${CXX_COMPILER} CUDACXX=${CUDA_COMPILER} - - cmake ${CI_PROJECT_DIR}${CI_PROJECT_DIR_SUFFIX} - -GNinja - -DCMAKE_BUILD_TYPE=${BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} - -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} - ${EXTRA_CMAKE_FLAGS} ${CUDA_ARCH_STR} - -DGINKGO_DEVEL_TOOLS=OFF -DGINKGO_BUILD_REFERENCE=${BUILD_REFERENCE} - -DGINKGO_BUILD_OMP=${BUILD_OMP} -DGINKGO_BUILD_CUDA=${BUILD_CUDA} - -DGINKGO_BUILD_HIP=${BUILD_HIP} -DGINKGO_BUILD_SYCL=${BUILD_SYCL} - -DGINKGO_BUILD_MPI=${BUILD_MPI} ${MPI_STR} - -DGINKGO_BUILD_HWLOC=${BUILD_HWLOC} - -DGINKGO_BUILD_PAPI_SDE=${BUILD_PAPI_SDE} - -DGINKGO_BUILD_TESTS=ON -DGINKGO_BUILD_EXAMPLES=ON - -DGINKGO_FAST_TESTS=${FAST_TESTS} - -DGINKGO_TEST_NONDEFAULT_STREAM=${NONDEFAULT_STREAM} - -DGINKGO_MIXED_PRECISION=${MIXED_PRECISION} - -DGINKGO_CONFIG_LOG_DETAILED=${CONFIG_LOG} - -DGINKGO_DPCPP_SINGLE_MODE=${DPCPP_SINGLE_MODE} + - *environment_script + - cmake -S ${CI_PROJECT_DIR}${CI_PROJECT_DIR_SUFFIX} -B . --preset ${CI_CMAKE_PRESET} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} - ninja -j${NUM_CORES} -l${CI_LOAD_LIMIT} install - awk '!/^#/ { print ($2 - $1)/1000 " " $4 }' .ninja_log | sort -nr dependencies: [] @@ -64,36 +74,8 @@ - mkdir -p ${CI_JOB_NAME} && cd ${CI_JOB_NAME} - mkdir install_prefix - export INSTALL_PREFIX=`pwd`/install_prefix - - if [ -n "${CUDA_ARCH}" ]; then - export CUDA_ARCH_STR=-DGINKGO_CUDA_ARCHITECTURES=${CUDA_ARCH}; - fi - - if [ -n "${SYCL_DEVICE_TYPE}" ]; then export SYCL_DEVICE_TYPE; fi - - if [ -n "${SYCL_DEVICE_FILTER}" ]; then export SYCL_DEVICE_FILTER; fi - - if [ -n "${ONEAPI_DEVICE_SELECTOR}" ]; then export ONEAPI_DEVICE_SELECTOR; fi - - if [[ "${MPI_AS_ROOT}" == "ON" ]];then - export OMPI_ALLOW_RUN_AS_ROOT=1; - export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1; - fi - - if [[ "${BUILD_MPI}" == "ON" ]]; then - MPI_STR=-DGINKGO_MPI_EXEC_SUFFIX=${MPI_SUFFIX}; - fi - - export CXX=${CXX_COMPILER} CUDAHOSTCXX=${CXX_COMPILER} CUDACXX=${CUDA_COMPILER} - - cmake ${CI_PROJECT_DIR}${CI_PROJECT_DIR_SUFFIX} - -GNinja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} - -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} - ${EXTRA_CMAKE_FLAGS} ${CUDA_ARCH_STR} - -DGINKGO_DEVEL_TOOLS=OFF -DGINKGO_BUILD_REFERENCE=${BUILD_REFERENCE} - -DGINKGO_BUILD_OMP=${BUILD_OMP} -DGINKGO_BUILD_CUDA=${BUILD_CUDA} - -DGINKGO_BUILD_HIP=${BUILD_HIP} -DGINKGO_BUILD_SYCL=${BUILD_SYCL} - -DGINKGO_BUILD_MPI=${BUILD_MPI} ${MPI_STR} - -DGINKGO_BUILD_HWLOC=${BUILD_HWLOC} - -DGINKGO_BUILD_PAPI_SDE=${BUILD_PAPI_SDE} - -DGINKGO_BUILD_TESTS=ON -DGINKGO_BUILD_EXAMPLES=ON - -DGINKGO_FAST_TESTS=${FAST_TESTS} - -DGINKGO_MIXED_PRECISION=${MIXED_PRECISION} - -DGINKGO_CONFIG_LOG_DETAILED=${CONFIG_LOG} - -DGINKGO_DPCPP_SINGLE_MODE=${DPCPP_SINGLE_MODE} + - *environment_script + - cmake -S ${CI_PROJECT_DIR}${CI_PROJECT_DIR_SUFFIX} -B . --preset ${CI_CMAKE_PRESET} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} - ninja -j${NUM_CORES} -l${CI_LOAD_LIMIT} install - awk '!/^#/ { print ($2 - $1)/1000 " " $4 }' .ninja_log | sort -nr - | @@ -106,7 +88,8 @@ - popd - if [ -n "${SYCL_DEVICE_TYPE}" ]; then unset SYCL_DEVICE_TYPE; fi - if [ -n "${SYCL_DEVICE_FILTER}" ]; then unset SYCL_DEVICE_FILTER; fi - - if [[ "${BUILD_SHARED_LIBS}" == "ON" || "${BUILD_HIP}" != "ON" ]]; then + - if [ "$(get_cache_val GINKGO_EXPORT_BUILD_DIR)" == "ON" ]; then ninja test_exportbuild; fi + - if [[ "$(get_cache_val BUILD_SHARED_LIBS)" == "ON" || "$(get_cache_val GINKGO_BUILD_HIP)" != "ON" ]]; then PKG_CONFIG_PATH=${INSTALL_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH LD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:$LD_LIBRARY_PATH ninja test_pkgconfig; fi dependencies: [] diff --git a/CMakeLists.txt b/CMakeLists.txt index 10f76ac9a6c..27eee6d2abb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,8 +44,9 @@ option(GINKGO_CHECK_CIRCULAR_DEPS option(GINKGO_CONFIG_LOG_DETAILED "Enable printing of detailed configuration log to screen in addition to the writing of files," OFF) option(GINKGO_BENCHMARK_ENABLE_TUNING - "Enable tuning variables in the benchmarks. For specific use cases, manual code changes could be required." + "Enable tuning variables in the benchmarks. For specific use cases, manual code changes could be required. WARNING: It is not possible to install Ginkgo with this option enabled." OFF) +mark_as_advanced(GINKGO_BENCHMARK_ENABLE_TUNING) set(GINKGO_VERBOSE_LEVEL "1" CACHE STRING "Verbosity level. Put 0 to turn off. 1 activates a few important messages.") set(GINKGO_CUDA_ARCHITECTURES "Auto" CACHE STRING @@ -70,6 +71,11 @@ option(GINKGO_EXTENSION_KOKKOS_CHECK_TYPE_ALIGNMENT "Enables mapping to Kokkos t gko_rename_cache(GINKGO_COMPILER_FLAGS CMAKE_CXX_FLAGS BOOL "Flags used by the CXX compiler during all build types.") gko_rename_cache(GINKGO_CUDA_COMPILER_FLAGS CMAKE_CUDA_FLAGS BOOL "Flags used by the CUDA compiler during all build types.") +if(NOT DEFINED BUILD_SHARED_LIBS) + message(STATUS "BUILD_SHARED_LIBS is not set, so enabling it by default.") + set(BUILD_SHARED_LIBS ON) +endif() + # load executor-specific configuration if(GINKGO_BUILD_CUDA) include(cmake/cuda.cmake) @@ -120,13 +126,6 @@ if(GINKGO_WITH_CCACHE) endif() endif() -if(GINKGO_BENCHMARK_ENABLE_TUNING) - # In this state, the tests and examples cannot be compiled without extra - # complexity/intrusiveness, so we simply disable them. - set(GINKGO_BUILD_TESTS OFF) - set(GINKGO_BUILD_EXAMPLES OFF) -endif() - if(GINKGO_BUILD_TESTS) message(STATUS "GINKGO_BUILD_TESTS is ON, enabling GINKGO_BUILD_REFERENCE") set(GINKGO_BUILD_REFERENCE ON CACHE BOOL "Compile reference CPU kernels" FORCE) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000000..e9a5aee3fc0 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,76 @@ +{ + "version": 4, + "include": ["cmake/presets/ci.json"], + "configurePresets": [ + { + "name": "base", + "hidden": true, + "binaryDir": "${sourceDir}/build-${presetName}" + }, + { + "name": "base-dev", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "GINKGO_DEVEL_TOOLS": "ON", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_COLOR_DIAGNOSTICS": "ON", + "CMAKE_LINK_DEPENDS_NO_SHARED": "ON" + }, + "warnings": { + "dev": true, + "deprecated": true + } + }, + { + "name": "base-dev-gcc-like", + "hidden": true, + "generator": "Ninja", + "cacheVariables": { + "CMAKE_CXX_FLAGS": "$env{CXXFLAGS} -g -fno-omit-frame-pointer -Wpedantic -Wall -Wextra -Wconversion -Wunused" + }, + "condition": { + "type": "notEquals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "release", + "inherits": "base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + }, + "warnings": { + "dev": false + } + }, + { + "name": "develop-gcc", + "inherits": ["base", "base-dev", "base-dev-gcc-like"], + "cacheVariables": { + "CMAKE_CXX_COMPILER": "g++" + } + }, + { + "name": "develop-clang", + "inherits": ["base", "base-dev", "base-dev-gcc-like"], + "cacheVariables": { + "CMAKE_CXX_COMPILER": "clang++" + } + }, + { + "name": "develop-msvc", + "inherits": ["base", "base-dev"], + "cacheVariables": { + "CMAKE_CXX_COMPILER": "msvc", + "CMAKE_CXX_FLAGS": "$env{CXXFLAGS} /permissive- /Oy-" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + } + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 66865585dca..4547986f3fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -568,9 +568,14 @@ files. ### Warnings -By default, the `-DCMAKE_CXX_FLAGS` should be set to `-Wpedantic` to emit -pedantic warnings by default. The CI system additionally also has a step -where it compiles for pedantic warnings to be errors. +By default, the `-Wpedantic` (or `/permissive-` on MSVC) is added to `CMAKE_CXX_FLAGS` +and hence pedantic warnings are emitted by default. Some of these warnings +are false positives and a complete list of the resolved warnings and their solutions +is listed in [Issue 174](https://github.com/ginkgo-project/ginkgo/issues/174). +Specifically, when macros are being used, we have the issue of having `extra ;` +warnings, which is resolved by adding a `static_assert()`. The CI system +additionally also has a step where it compiles for pedantic warnings to be +errors. ### Avoiding circular dependencies diff --git a/INSTALL.md b/INSTALL.md index 9719bdfb920..bab79203e93 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -89,7 +89,7 @@ Ginkgo adds the following additional switches to control what is being built: `COVERAGE`, `ASAN` (AddressSanitizer), `LSAN` (LeakSanitizer), `TSAN` (ThreadSanitizer) and `UBSAN` (undefined behavior sanitizer) types. * `-DBUILD_SHARED_LIBS={ON, OFF}` builds ginkgo as shared libraries (`OFF`) - or as dynamic libraries (`ON`), default is `ON`. + or as dynamic libraries (`ON`), default is `ON`, see https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html. * `-DGINKGO_JACOBI_FULL_OPTIMIZATIONS={ON, OFF}` use all the optimizations for the CUDA Jacobi algorithm. `OFF` by default. Setting this option to `ON` may lead to very slow compile time (>20 minutes) for the diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index de6e74d464c..78fdfcaf219 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -6,7 +6,7 @@ endif() function(ginkgo_benchmark_add_tuning_maybe name) if(GINKGO_BENCHMARK_ENABLE_TUNING) - target_sources(${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../utils/tuning_variables.cpp) + target_sources(${name} PRIVATE ${Ginkgo_SOURCE_DIR}/benchmark/utils/tuning_variables.cpp) endif() endfunction() diff --git a/benchmark/conversion/conversion.cpp b/benchmark/conversion/conversion.cpp index 59c052b11e7..c7de9a66506 100644 --- a/benchmark/conversion/conversion.cpp +++ b/benchmark/conversion/conversion.cpp @@ -23,11 +23,6 @@ #include "benchmark/utils/types.hpp" -#ifdef GINKGO_BENCHMARK_ENABLE_TUNING -#include "benchmark/utils/tuning_variables.hpp" -#endif // GINKGO_BENCHMARK_ENABLE_TUNING - - using Generator = DefaultSystemGenerator<>; diff --git a/benchmark/matrix_generator/matrix_generator.cpp b/benchmark/matrix_generator/matrix_generator.cpp index dc1cb3cc08a..895eec2325e 100644 --- a/benchmark/matrix_generator/matrix_generator.cpp +++ b/benchmark/matrix_generator/matrix_generator.cpp @@ -13,11 +13,6 @@ #include "benchmark/utils/types.hpp" -#ifdef GINKGO_BENCHMARK_ENABLE_TUNING -#include "benchmark/utils/tuning_variables.hpp" -#endif // GINKGO_BENCHMARK_ENABLE_TUNING - - namespace { std::string input_format = " [\n" diff --git a/benchmark/matrix_statistics/matrix_statistics.cpp b/benchmark/matrix_statistics/matrix_statistics.cpp index 8eb847f42f2..7ddf408d565 100644 --- a/benchmark/matrix_statistics/matrix_statistics.cpp +++ b/benchmark/matrix_statistics/matrix_statistics.cpp @@ -16,11 +16,6 @@ #include "benchmark/utils/types.hpp" -#ifdef GINKGO_BENCHMARK_ENABLE_TUNING -#include "benchmark/utils/tuning_variables.hpp" -#endif // GINKGO_BENCHMARK_ENABLE_TUNING - - // See en.wikipedia.org/wiki/Five-number_summary // Quartile computation uses Method 3 from en.wikipedia.org/wiki/Quartile void compute_summary(const std::vector& dist, json& out) diff --git a/benchmark/preconditioner/preconditioner.cpp b/benchmark/preconditioner/preconditioner.cpp index b9dfe1d8369..a1283e50535 100644 --- a/benchmark/preconditioner/preconditioner.cpp +++ b/benchmark/preconditioner/preconditioner.cpp @@ -22,11 +22,6 @@ #include "benchmark/utils/types.hpp" -#ifdef GINKGO_BENCHMARK_ENABLE_TUNING -#include "benchmark/utils/tuning_variables.hpp" -#endif // GINKGO_BENCHMARK_ENABLE_TUNING - - // preconditioner generation and application std::string encode_parameters(const char* precond_name) { diff --git a/benchmark/solver/solver_common.hpp b/benchmark/solver/solver_common.hpp index 541a9f66287..1e77e13234b 100644 --- a/benchmark/solver/solver_common.hpp +++ b/benchmark/solver/solver_common.hpp @@ -16,11 +16,6 @@ #include "benchmark/utils/runner.hpp" -#ifdef GINKGO_BENCHMARK_ENABLE_TUNING -#include "benchmark/utils/tuning_variables.hpp" -#endif // GINKGO_BENCHMARK_ENABLE_TUNING - - // Command-line arguments DEFINE_uint32(max_iters, 1000, "Maximal number of iterations the solver will be run for"); diff --git a/benchmark/spmv/spmv_common.hpp b/benchmark/spmv/spmv_common.hpp index 4ac777479b2..0c58cf30b7b 100644 --- a/benchmark/spmv/spmv_common.hpp +++ b/benchmark/spmv/spmv_common.hpp @@ -135,7 +135,6 @@ struct SpmvBenchmark : Benchmark> { // tuning run #ifdef GINKGO_BENCHMARK_ENABLE_TUNING - auto& format_case = spmv_case[format_name]; format_case["tuning"] = json::object(); auto& tuning_case = format_case["tuning"]; tuning_case["time"] = json::array(); diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index 0985f089382..eb295719758 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -115,26 +115,6 @@ macro(ginkgo_modify_flags name) string(REPLACE "\"" "\\\"" ${name}_MODIFY "${${name}}") endmacro() -# Extract the clang version from a clang executable path -function(ginkgo_extract_clang_version CLANG_COMPILER GINKGO_CLANG_VERSION) - set(CLANG_VERSION_PROG "#include \n" - "int main() {printf(\"%d.%d.%d\", __clang_major__, __clang_minor__, __clang_patchlevel__)\;" - "return 0\;}") - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/extract_clang_ver.cpp" ${CLANG_VERSION_PROG}) - execute_process(COMMAND ${CLANG_COMPILER} ${CMAKE_CURRENT_BINARY_DIR}/extract_clang_ver.cpp - -o ${CMAKE_CURRENT_BINARY_DIR}/extract_clang_ver - ERROR_VARIABLE CLANG_EXTRACT_VER_ERROR) - execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/extract_clang_ver - OUTPUT_VARIABLE FOUND_CLANG_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - - set (${GINKGO_CLANG_VERSION} "${FOUND_CLANG_VERSION}" PARENT_SCOPE) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/extract_clang_ver.cpp) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/extract_clang_ver) -endfunction() - # Extract the DPC++ version function(ginkgo_extract_dpcpp_version DPCPP_COMPILER GINKGO_DPCPP_VERSION MACRO_VAR) set(DPCPP_VERSION_PROG "#include \n#include \n" diff --git a/cmake/get_info.cmake b/cmake/get_info.cmake index 63f43c645f0..aee19cdd0c9 100644 --- a/cmake/get_info.cmake +++ b/cmake/get_info.cmake @@ -133,7 +133,7 @@ foreach(log_type ${log_types}) "GINKGO_MIXED_PRECISION;GINKGO_HAVE_GPU_AWARE_MPI") ginkgo_print_module_footer(${${log_type}} " Tests, benchmarks and examples:") ginkgo_print_foreach_variable(${${log_type}} - "GINKGO_BUILD_TESTS;GINKGO_FAST_TESTS;GINKGO_BUILD_EXAMPLES;GINKGO_EXTLIB_EXAMPLE;GINKGO_BUILD_BENCHMARKS;GINKGO_BENCHMARK_ENABLE_TUNING") + "GINKGO_BUILD_TESTS;GINKGO_FAST_TESTS;GINKGO_BUILD_EXAMPLES;GINKGO_BUILD_EXTLIB_EXAMPLE;GINKGO_BUILD_BENCHMARKS;GINKGO_BENCHMARK_ENABLE_TUNING") ginkgo_print_module_footer(${${log_type}} " Documentation:") ginkgo_print_foreach_variable(${${log_type}} "GINKGO_BUILD_DOC;GINKGO_VERBOSE_LEVEL") ginkgo_print_module_footer(${${log_type}} "") diff --git a/cmake/install_helpers.cmake b/cmake/install_helpers.cmake index 7165cad0c2b..5e7ea305c55 100644 --- a/cmake/install_helpers.cmake +++ b/cmake/install_helpers.cmake @@ -1,6 +1,13 @@ include(CMakePackageConfigHelpers) include(GNUInstallDirs) +if(GINKGO_BENCHMARK_ENABLE_TUNING) + install(CODE [=[ + message(FATAL_ERROR + "Skipping install configuration due to enabled GINKGO_BENCHMARK_ENABLE_TUNING. " + "Please deactivate that variable if you want to install Ginkgo") + ]=]) +endif() set(GINKGO_INSTALL_CONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Ginkgo") set(GINKGO_INSTALL_MODULE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Ginkgo/Modules") diff --git a/cmake/presets/ci.json b/cmake/presets/ci.json new file mode 100644 index 00000000000..f0d2c5475c1 --- /dev/null +++ b/cmake/presets/ci.json @@ -0,0 +1,575 @@ +{ + "version": 4, + "configurePresets": [ + { + "name": "base-ci", + "hidden": true, + "binaryDir": "${sourceDir}/build-${presetName}", + "generator": "Ninja", + "environment": { + "MPI_AS_ROOT": "OFF" + }, + "cacheVariables": { + "CMAKE_CXX_FLAGS": "", + "BUILD_SHARED_LIBS": "ON", + "GINKGO_BUILD_REFERENCE": "ON", + "GINKGO_BUILD_OMP": "OFF", + "GINKGO_BUILD_CUDA": "OFF", + "GINKGO_BUILD_HIP": "OFF", + "GINKGO_BUILD_SYCL": "OFF", + "GINKGO_BUILD_HWLOC": "ON", + "GINKGO_BUILD_PAPI_SDE": "OFF", + "GINKGO_BUILD_MPI": "OFF", + "GINKGO_BUILD_TESTS": "ON", + "GINKGO_CONFIG_LOG_DETAILED": "ON", + "GINKGO_DEVEL_TOOLS": "OFF", + "GINKGO_DPCPP_SINGLE_MODE": "OFF", + "GINKGO_FAST_TESTS": "OFF", + "GINKGO_MIXED_PRECISION": "ON", + "GINKGO_TEST_NONDEFAULT_STREAM": "OFF", + "GINKGO_RUN_EXAMPLES": "OFF" + } + }, + { + "name": "enable-release", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_CONFIGURATION_TYPES": "Release" + } + }, + { + "name": "enable-debug", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_CONFIGURATION_TYPES": "Debug" + } + }, + { + "name": "enable-cuda", + "hidden": true, + "cacheVariables": { + "GINKGO_BUILD_CUDA": "ON", + "CMAKE_CUDA_COMPILER": "nvcc", + "CMAKE_CUDA_ARCHITECTURES": "$env{CUDA_ARCH}" + } + }, + { + "name": "enable-sycl", + "hidden": true, + "cacheVariables": { + "GINKGO_BUILD_SYCL": "ON", + "CMAKE_CXX_FLAGS": "-Wpedantic -ffp-model=precise", + "GINKGO_DPCPP_SINGLE_MODE": "ON" + } + }, + { + "name": "enable-hip", + "hidden": true, + "cacheVariables": { + "GINKGO_BUILD_HIP": "ON" + } + }, + { + "name": "enable-openmp", + "hidden": true, + "cacheVariables": { + "GINKGO_BUILD_OMP": "ON" + } + }, + { + "name": "enable-mpi", + "hidden": true, + "environment": { + "MPI_AS_ROOT": "ON" + }, + "cacheVariables": { + "GINKGO_BUILD_MPI": "ON" + } + }, + { + "name": "enable-gcc", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "g++" + } + }, + { + "name": "enable-clang", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "clang++" + } + }, + { + "name": "enable-intel", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "icpx" + } + }, + { + "name": "enable-dpcpp", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "dpcpp" + } + }, + { + "name": "enable-nvhpc", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "nvc++", + "CMAKE_CXX_FLAGS": "--diag_suppress=useless_using_declaration,declared_but_not_referenced", + "CMAKE_CUDA_FLAGS": "-diag-suppress=177" + } + }, + { + "name": "enable-msvc", + "hidden": true, + "generator": "Visual Studio 17 2022", + "cacheVariables": { + "CMAKE_CXX_COMPILER": "msvc", + "CMAKE_CXX_FLAGS_DEBUG": "/MDd /Zi /Ob1 /O1 /Od /RTC1" + } + }, + { + "name": "ci/cuda/msvc/nompi/release", + "inherits": [ + "enable-cuda", + "enable-msvc", + "enable-release", + "base-ci" + ] + }, + { + "name": "ci/cuda+omp/gcc/mpi/release/shared", + "inherits": [ + "enable-cuda", + "enable-openmp", + "enable-gcc", + "enable-release", + "base-ci" + ] + }, + { + "name": "ci/cuda+omp/gcc/mpi/debug/fasttest/nondefault_stream", + "inherits": [ + "enable-cuda", + "enable-openmp", + "enable-gcc", + "enable-debug", + "base-ci" + ], + "cacheVariables": { + "GINKGO_FAST_TESTS": "ON", + "GINKGO_TEST_NONDEFAULT_STREAM": "ON" + } + }, + { + "name": "ci/cuda+omp/clang/nompi/release/static", + "inherits": [ + "enable-cuda", + "enable-openmp", + "enable-clang", + "enable-release", + "base-ci" + ], + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF" + } + }, + { + "name": "ci/cuda+omp/clang/nompi/release/fasttest/shared", + "inherits": [ + "enable-cuda", + "enable-openmp", + "enable-clang", + "enable-release", + "base-ci" + ], + "cacheVariables": { + "GINKGO_FAST_TESTS": "ON", + "CMAKE_CXX_FLAGS": "-Wno-error=maybe-uninitialized", + "CMAKE_CUDA_FLAGS": "-diag-suppress=177" + } + }, + { + "name": "ci/cuda+omp/gcc/nompi/debug/fasttest", + "inherits": [ + "enable-cuda", + "enable-openmp", + "enable-gcc", + "enable-debug", + "base-ci" + ], + "cacheVariables": { + "GINKGO_FAST_TESTS": "ON", + "CMAKE_CXX_FLAGS": "-Wno-error=maybe-uninitialized", + "CMAKE_CUDA_FLAGS": "-diag-suppress=177" + } + }, + { + "name": "ci/cuda+omp/nvhpc/nompi/release/static/fasttest", + "inherits": [ + "enable-cuda", + "enable-openmp", + "enable-nvhpc", + "enable-release", + "base-ci" + ], + "cacheVariables": { + "GINKGO_FAST_TESTS": "ON", + "BUILD_SHARED_LIBS": "OFF" + } + }, + { + "name": "ci/cuda+omp/nvhpc/nompi/debug/fasttest", + "inherits": [ + "enable-cuda", + "enable-openmp", + "enable-nvhpc", + "enable-debug", + "base-ci" + ], + "cacheVariables": { + "GINKGO_FAST_TESTS": "ON" + } + }, + { + "name": "ci/cuda/msvc/nompi/release/shared", + "inherits": [ + "enable-cuda", + "enable-msvc", + "enable-release", + "base-ci" + ] + }, + { + "name": "ci/hip+omp/gcc/nompi/debug/static", + "inherits": [ + "enable-hip", + "enable-openmp", + "enable-gcc", + "enable-debug", + "base-ci" + ], + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF", + "GINKGO_RUN_EXAMPLES": "ON" + } + }, + { + "name": "ci/hip+omp/gcc/nompi/release/fasttest/nondefault_stream", + "inherits": [ + "enable-hip", + "enable-openmp", + "enable-gcc", + "enable-release", + "base-ci" + ], + "cacheVariables": { + "GINKGO_FAST_TESTS": "ON", + "GINKGO_TEST_NONDEFAULT_STREAM": "ON", + "GINKGO_RUN_EXAMPLES": "ON" + } + }, + { + "name": "ci/hip+omp/clang/nompi/debug", + "inherits": [ + "enable-hip", + "enable-openmp", + "enable-clang", + "enable-debug", + "base-ci" + ], + "cacheVariables": { + "GINKGO_RUN_EXAMPLES": "ON" + } + }, + { + "name": "ci/hip+omp/clang/nompi/release", + "inherits": [ + "enable-hip", + "enable-openmp", + "enable-clang", + "enable-release", + "base-ci" + ], + "cacheVariables": { + "GINKGO_RUN_EXAMPLES": "ON" + } + }, + { + "name": "ci/hip+omp/clang/nompi/release/static", + "inherits": [ + "ci/hip+omp/clang/nompi/release" + ], + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF", + "GINKGO_RUN_EXAMPLES": "ON" + } + }, + { + "name": "ci/hip/gcc/nompi/release", + "inherits": [ + "enable-hip", + "enable-gcc", + "enable-release", + "base-ci" + ], + "cacheVariables": { + "GINKGO_RUN_EXAMPLES": "ON" + } + }, + { + "name": "ci/ref/clang/nompi/release", + "inherits": [ + "enable-clang", + "enable-release", + "base-ci" + ] + }, + { + "name": "ci/ref/gcc/nompi/debug/static/fasttest", + "inherits": [ + "enable-clang", + "enable-release", + "base-ci" + ], + "cacheVariables": { + "GINKGO_FAST_TESTS": "ON", + "BUILD_SHARED_LIBS": "OFF" + } + }, + { + "name": "ci/ref/msvc/nompi/release", + "generator": "Visual Studio 17 2022", + "inherits": [ + "enable-msvc", + "enable-release", + "base-ci" + ] + }, + { + "name": "ci/ref/msvc/nompi/release/static", + "generator": "Visual Studio 17 2022", + "inherits": [ + "ci/ref/msvc/nompi/release" + ], + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF" + } + }, + { + "name": "ci/omp/clang/mpi/debug/static/fasttest", + "inherits": [ + "enable-openmp", + "enable-clang", + "enable-mpi", + "enable-debug", + "base-ci" + ], + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF", + "GINKGO_FAST_TESTS": "ON" + } + }, + { + "name": "ci/omp/clang/mpi/glibcxx+debug/release", + "inherits": [ + "enable-openmp", + "enable-clang", + "enable-mpi", + "enable-debug", + "base-ci" + ], + "cacheVariables": { + "CMAKE_CXX_FLAGS": "-Wpedantic -D_GLIBCXX_DEBUG=1" + } + }, + { + "name": "ci/omp/clang/nompi/debug/nomixed", + "inherits": [ + "enable-openmp", + "enable-clang", + "enable-debug", + "base-ci" + ], + "generator": "Unix Makefiles", + "cacheVariables": { + "GINKGO_MIXED_PRECISION": "OFF" + } + }, + { + "name": "ci/omp/clang/nompi/debug/static/nomixed", + "inherits": [ + "ci/omp/clang/nompi/debug/nomixed" + ], + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF" + } + }, + { + "name": "ci/omp/clang/nompi/release/static", + "inherits": [ + "enable-openmp", + "enable-clang", + "enable-release", + "base-ci" + ], + "generator": "Unix Makefiles", + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF" + } + }, + { + "name": "ci/omp/clang/nompi/release/static/nomixed", + "inherits": [ + "ci/omp/clang/nompi/release/static" + ], + "cacheVariables": { + "GINKGO_MIXED_PRECISION": "OFF" + } + }, + { + "name": "ci/omp/gcc/nompi/release", + "inherits": [ + "enable-openmp", + "enable-gcc", + "enable-release", + "base-ci" + ] + }, + { + "name": "ci/omp/gcc/nompi/release/static", + "inherits": [ + "ci/omp/gcc/nompi/release" + ], + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF" + } + }, + { + "name": "ci/omp/gcc/mpi/release/nomixed", + "inherits": [ + "enable-openmp", + "enable-clang", + "enable-mpi", + "enable-release", + "base-ci" + ], + "cacheVariables": { + "GINKGO_MIXED_PRECISION": "OFF" + } + }, + { + "name": "ci/omp/mingwgcc/nompi/release/static", + "generator": "MinGW Makefiles", + "inherits": [ + "enable-openmp", + "enable-gcc", + "enable-release", + "base-ci" + ], + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF" + } + }, + { + "name": "ci/sycl/icpx/nompi/release/shared/singlemode", + "inherits": [ + "enable-sycl", + "enable-intel", + "enable-mpi", + "enable-release", + "base-ci" + ] + }, + { + "name": "ci/sycl/dpcpp/nompi/release/singlemode", + "inherits": [ + "enable-sycl", + "enable-dpcpp", + "enable-mpi", + "enable-release", + "base-ci" + ], + "generator": "Unix Makefiles" + }, + { + "name": "ci/sycl/dpcpp/nompi/release/static/singlemode", + "inherits": [ + "ci/sycl/dpcpp/nompi/release/singlemode" + ], + "cacheVariables": { + "BUILD_SHARED_LIBS": "OFF" + } + }, + { + "name": "ci/sycl/icpx/nompi/release/singlemode/nomixed", + "inherits": [ + "ci/sycl/icpx/nompi/release/shared/singlemode" + ], + "generator": "Unix Makefiles", + "cacheVariables": { + "GINKGO_MIXED_PRECISION": "OFF" + } + }, + { + "name": "ci/warnings", + "inherits": [ + "enable-cuda", + "enable-hip", + "enable-openmp", + "base-ci" + ], + "cacheVariables": { + "CMAKE_CXX_FLAGS": "-Wpedantic -Werror=pedantic -pedantic-errors" + } + }, + { + "name": "ci/no_circular_deps", + "inherits": [ + "enable-cuda", + "enable-hip", + "enable-openmp", + "base-ci" + ], + "cacheVariables": { + "GINKGO_CHECK_CIRCULAR_DEPS": "ON" + } + }, + { + "name": "ci/subdir_build", + "inherits": [ + "enable-openmp", + "base-ci" + ] + }, + { + "name": "ci/clang_tidy", + "inherits": [ + "enable-cuda", + "enable-hip", + "enable-openmp", + "base-ci" + ], + "cacheVariables": { + "GINKGO_WITH_CLANG_TIDY": "ON" + } + }, + { + "name": "ci/iwyu", + "inherits": [ + "enable-cuda", + "enable-openmp", + "base-ci" + ], + "cacheVariables": { + "GINKGO_WITH_IWYU": "ON" + } + } + ] +} diff --git a/cmake/rename.cmake b/cmake/rename.cmake index d2751bf6623..8964240cea9 100644 --- a/cmake/rename.cmake +++ b/cmake/rename.cmake @@ -2,7 +2,7 @@ macro(gko_rename_cache deprecated actual type doc_string) if(DEFINED ${deprecated}) if(DEFINED ${actual}) - message("actual ${actual} and deprecated ${deprecated}") + message(TRACE "actual ${actual} and deprecated ${deprecated}") if("${${actual}}" STREQUAL "${${deprecated}}") # They are the same, so only throw warning message(WARNING "${deprecated} was deprecated, please only use ${actual} instead. We removed the old variable.") diff --git a/cuda/CMakeLists.txt b/cuda/CMakeLists.txt index d4a94eda802..a83cf7434c3 100644 --- a/cuda/CMakeLists.txt +++ b/cuda/CMakeLists.txt @@ -31,6 +31,13 @@ target_sources(ginkgo_cuda ${GKO_UNIFIED_COMMON_SOURCES} ${GKO_CUDA_HIP_COMMON_SOURCES} ) +if(GINKGO_BENCHMARK_ENABLE_TUNING) + target_sources(ginkgo_cuda PRIVATE ${Ginkgo_SOURCE_DIR}/benchmark/utils/tuning_variables.cpp) +endif() +# override the default language mapping for the common files, set them to CUDA +foreach(source_file IN LISTS GKO_UNIFIED_COMMON_SOURCES) + set_source_files_properties(${source_file} PROPERTIES LANGUAGE CUDA) +endforeach(source_file) if(GINKGO_JACOBI_FULL_OPTIMIZATIONS) set(GKO_CUDA_JACOBI_BLOCK_SIZES) foreach(blocksize RANGE 1 32) diff --git a/cuda/components/format_conversion.cuh b/cuda/components/format_conversion.cuh index 9ece2cdffe4..9bb57079edd 100644 --- a/cuda/components/format_conversion.cuh +++ b/cuda/components/format_conversion.cuh @@ -87,7 +87,7 @@ __host__ size_type calculate_nwarps(std::shared_ptr exec, multiple = 32; } #ifdef GINKGO_BENCHMARK_ENABLE_TUNING - if (_tuning_flag) { + if (_tuning_flag && _tuned_value > 0) { multiple = _tuned_value; } #endif // GINKGO_BENCHMARK_ENABLE_TUNING diff --git a/dpcpp/CMakeLists.txt b/dpcpp/CMakeLists.txt index 851ef9a3dc6..c73d5c1c8e4 100644 --- a/dpcpp/CMakeLists.txt +++ b/dpcpp/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(MKL CONFIG REQUIRED HINTS "$ENV{MKLROOT}" "$ENV{MKL_ROOT}") find_package(oneDPL REQUIRED HINTS "$ENV{DPL_ROOT}" "$ENV{DPLROOT}") -# use the parameter from cmake +# use the parameter from cmake set(GINKGO_MKL_ROOT "${MKL_DIR}" PARENT_SCOPE) set(GINKGO_DPL_ROOT "${oneDPL_DIR}" PARENT_SCOPE) @@ -69,6 +69,9 @@ target_sources(ginkgo_dpcpp ${GKO_UNIFIED_COMMON_SOURCES} ${DENSE_INSTANTIATE} ) +if(GINKGO_BENCHMARK_ENABLE_TUNING) + target_sources(ginkgo_dpcpp PRIVATE ${Ginkgo_SOURCE_DIR}/benchmark/utils/tuning_variables.cpp) +endif() # TODO: adjust it when dpcpp jacobi supports more block size set(GKO_DPCPP_JACOBI_BLOCK_SIZES 32) diff --git a/dpcpp/components/format_conversion.dp.hpp b/dpcpp/components/format_conversion.dp.hpp index 17cf55389df..4adf706c2a5 100644 --- a/dpcpp/components/format_conversion.dp.hpp +++ b/dpcpp/components/format_conversion.dp.hpp @@ -48,7 +48,7 @@ size_type calculate_nwarps(std::shared_ptr exec, multiple = 32; } #ifdef GINKGO_BENCHMARK_ENABLE_TUNING - if (_tuning_flag) { + if (_tuning_flag && _tuned_value > 0) { multiple = _tuned_value; } #endif // GINKGO_BENCHMARK_ENABLE_TUNING diff --git a/hip/CMakeLists.txt b/hip/CMakeLists.txt index 30e675509d5..319dee6b58c 100644 --- a/hip/CMakeLists.txt +++ b/hip/CMakeLists.txt @@ -28,6 +28,9 @@ set(GINKGO_HIP_SOURCES ${GKO_UNIFIED_COMMON_SOURCES} ${GKO_CUDA_HIP_COMMON_SOURCES} ) +if(GINKGO_BENCHMARK_ENABLE_TUNING) + list(APPEND GINKGO_HIP_SOURCES ${Ginkgo_SOURCE_DIR}/benchmark/utils/tuning_variables.cpp) +endif() if(hipfft_FOUND) list(APPEND GINKGO_HIP_SOURCES matrix/fft_kernels.hip.cpp) diff --git a/hip/components/format_conversion.hip.hpp b/hip/components/format_conversion.hip.hpp index 2e6c4eb1236..c11a0364f3a 100644 --- a/hip/components/format_conversion.hip.hpp +++ b/hip/components/format_conversion.hip.hpp @@ -97,7 +97,7 @@ __host__ size_type calculate_nwarps(std::shared_ptr exec, } #endif // GINKGO_HIP_PLATFORM_NVCC #ifdef GINKGO_BENCHMARK_ENABLE_TUNING - if (_tuning_flag) { + if (_tuning_flag && _tuned_value > 0) { multiple = _tuned_value; } #endif // GINKGO_BENCHMARK_ENABLE_TUNING