diff --git a/.github/workflows/pr_push.yml b/.github/workflows/pr_push.yml index fffdc7373..3881e216b 100644 --- a/.github/workflows/pr_push.yml +++ b/.github/workflows/pr_push.yml @@ -17,87 +17,90 @@ permissions: packages: read jobs: - CodeChecks: - uses: ./.github/workflows/reusable_checks.yml - FastBuild: - name: Fast builds - needs: [CodeChecks] - uses: ./.github/workflows/reusable_fast.yml - Build: - name: Basic builds - needs: [FastBuild] - uses: ./.github/workflows/reusable_basic.yml - DevDax: - needs: [FastBuild] - uses: ./.github/workflows/reusable_dax.yml - MultiNuma: - needs: [FastBuild] - uses: ./.github/workflows/reusable_multi_numa.yml + # CodeChecks: + # uses: ./.github/workflows/reusable_checks.yml + # FastBuild: + # name: Fast builds + # needs: [CodeChecks] + # uses: ./.github/workflows/reusable_fast.yml + # Build: + # name: Basic builds + # needs: [FastBuild] + # uses: ./.github/workflows/reusable_basic.yml + # DevDax: + # needs: [FastBuild] + # uses: ./.github/workflows/reusable_dax.yml + # MultiNuma: + # needs: [FastBuild] + # uses: ./.github/workflows/reusable_multi_numa.yml L0: - needs: [Build] + # needs: [Build] uses: ./.github/workflows/reusable_gpu.yml with: provider: "LEVEL_ZERO" runner: "L0" shared_lib: "['ON']" + secrets: inherit L0-BMG: - needs: [Build] + # needs: [Build] uses: ./.github/workflows/reusable_gpu.yml with: provider: "LEVEL_ZERO" runner: "L0-BMG" shared_lib: "['ON']" + secrets: inherit CUDA: - needs: [Build] + # needs: [Build] uses: ./.github/workflows/reusable_gpu.yml with: provider: "CUDA" runner: "CUDA" shared_lib: "['ON']" - Sanitizers: - needs: [FastBuild] - uses: ./.github/workflows/reusable_sanitizers.yml - QEMU: - needs: [FastBuild] - uses: ./.github/workflows/reusable_qemu.yml - with: - short_run: true - ProxyLib: - needs: [Build] - uses: ./.github/workflows/reusable_proxy_lib.yml - Valgrind: - needs: [Build] - uses: ./.github/workflows/reusable_valgrind.yml - Coverage: - # total coverage (on upstream only) - if: github.repository == 'oneapi-src/unified-memory-framework' - needs: [Build, DevDax, L0, CUDA, MultiNuma, QEMU, ProxyLib] - uses: ./.github/workflows/reusable_coverage.yml secrets: inherit - with: - trigger: "${{github.event_name}}" - Coverage_partial: - # partial coverage (on forks) - if: github.repository != 'oneapi-src/unified-memory-framework' - needs: [Build, QEMU, ProxyLib] - uses: ./.github/workflows/reusable_coverage.yml - CodeQL: - needs: [Build] - permissions: - contents: read - security-events: write - uses: ./.github/workflows/reusable_codeql.yml - Trivy: - needs: [Build] - permissions: - contents: read - security-events: write - uses: ./.github/workflows/reusable_trivy.yml - Compatibility: - needs: [Build] - uses: ./.github/workflows/reusable_compatibility.yml - strategy: - matrix: - tag: ["v1.0.1"] - with: - tag: ${{matrix.tag}} + # Sanitizers: + # needs: [FastBuild] + # uses: ./.github/workflows/reusable_sanitizers.yml + # QEMU: + # needs: [FastBuild] + # uses: ./.github/workflows/reusable_qemu.yml + # with: + # short_run: true + # ProxyLib: + # needs: [Build] + # uses: ./.github/workflows/reusable_proxy_lib.yml + # Valgrind: + # needs: [Build] + # uses: ./.github/workflows/reusable_valgrind.yml + # Coverage: + # # total coverage (on upstream only) + # if: github.repository == 'oneapi-src/unified-memory-framework' + # needs: [Build, DevDax, L0, CUDA, MultiNuma, QEMU, ProxyLib] + # uses: ./.github/workflows/reusable_coverage.yml + # secrets: inherit + # with: + # trigger: "${{github.event_name}}" + # Coverage_partial: + # # partial coverage (on forks) + # if: github.repository != 'oneapi-src/unified-memory-framework' + # needs: [Build, QEMU, ProxyLib] + # uses: ./.github/workflows/reusable_coverage.yml + # CodeQL: + # needs: [Build] + # permissions: + # contents: read + # security-events: write + # uses: ./.github/workflows/reusable_codeql.yml + # Trivy: + # needs: [Build] + # permissions: + # contents: read + # security-events: write + # uses: ./.github/workflows/reusable_trivy.yml + # Compatibility: + # needs: [Build] + # uses: ./.github/workflows/reusable_compatibility.yml + # strategy: + # matrix: + # tag: ["v1.0.1"] + # with: + # tag: ${{matrix.tag}} diff --git a/.github/workflows/reusable_gpu.yml b/.github/workflows/reusable_gpu.yml index 108347f6c..b1d60df5f 100644 --- a/.github/workflows/reusable_gpu.yml +++ b/.github/workflows/reusable_gpu.yml @@ -1,5 +1,10 @@ # This workflow builds and tests providers using GPU memory. It requires properly # labelled self-hosted runners on systems with the correct GPU and drivers. +# +# It starts jobs for both Windows and Linux runners - it's only a thin wrapper for +# the OS-specific workflows. It's better to call them twice here, instead of +# duplicating two workflow calls in the PR/push workflow, for each tested device. +# name: GPU on: @@ -13,10 +18,6 @@ on: description: Runner name (without 'DSS-' prefix) type: string required: true - os: - description: A list of OSes - type: string - default: "['Ubuntu', 'Windows']" shared_lib: description: A list of options for building shared library type: string @@ -25,181 +26,22 @@ on: permissions: contents: read -env: - BUILD_DEBUG_DIR : "${{github.workspace}}/debug/build" - BUILD_RELEASE_DIR : "${{github.workspace}}/release/build" - INSTL_DEBUG_DIR : "${{github.workspace}}/debug/install-dir" - INSTL_RELEASE_DIR : "${{github.workspace}}/release/install-dir" - COVERAGE_DIR : "${{github.workspace}}/coverage" - jobs: - gpu: - env: - VCPKG_PATH: "${{github.workspace}}/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/vcpkg/packages/jemalloc_x64-windows;" - COVERAGE_NAME : "exports-coverage-${{inputs.provider}}-${{inputs.runner}}" + win: + # run only on upstream; forks will not have the HW + # if: github.repository == 'oneapi-src/unified-memory-framework' + if: false + uses: ./.github/workflows/reusable_gpu_win.yml + with: + provider: ${{ inputs.provider }} + runner: ${{ inputs.runner }} + shared_lib: ${{ inputs.shared_lib }} + lin: # run only on upstream; forks will not have the HW if: github.repository == 'oneapi-src/unified-memory-framework' - strategy: - fail-fast: false - matrix: - shared_library: ${{ fromJSON(inputs.shared_lib)}} - os: ${{ fromJSON(inputs.os)}} - name: GPU (${{matrix.os}}, shared=${{matrix.shared_library}}) - runs-on: ["DSS-${{inputs.runner}}", "DSS-${{matrix.os}}"] - - steps: - # Set various build params based on OS - - name: "[Win] Establish build params" - if : ${{ matrix.os == 'Windows' }} - run: | - echo "C_COMPILER=cl" >> $env:GITHUB_ENV - echo "CXX_COMPILER=cl" >> $env:GITHUB_ENV - echo "PROCS=$Env:NUMBER_OF_PROCESSORS" >> $env:GITHUB_ENV - echo "EXTRA_CMAKE_PATH=$Env:CUDA_PATH" >> $env:GITHUB_ENV - - - name: "[Lin] Establish build params" - if : ${{ matrix.os == 'Ubuntu' }} - run: | - echo "C_COMPILER=gcc" >> $GITHUB_ENV - echo "CXX_COMPILER=g++" >> $GITHUB_ENV - echo "PROCS=$(nproc)" >> $GITHUB_ENV - - - name: Checkout - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - with: - fetch-depth: 0 - - - name: "[Lin] Get information about platform" - if: matrix.os == 'Ubuntu' - run: .github/scripts/get_system_info.sh - - - name: "[Win] Restore vcpkg cache" - if: matrix.os == 'Windows' - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - id: cache - with: - path: vcpkg_pkgs_cache.zip - key: vcpkg-gpu-${{inputs.runner}}-windows-${{ hashFiles('vcpkg.json') }} - - - name: "[Win] Unpack vcpkg cache" - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit == 'true' - run: | - Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{github.workspace}}/vcpkg -Force - - - name: "[Win] Initialize vcpkg" - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' - uses: lukka/run-vcpkg@b1a0dd252f06b9e25b3c022a9a03bd7a427fb6a2 # v11.6 - with: - vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 - vcpkgDirectory: ${{github.workspace}}/vcpkg - vcpkgJsonGlob: '**/vcpkg.json' - - - name: "[Win] Install dependencies" - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' - env: - VCPKG_BINARY_SOURCES: clear - run: vcpkg install --triplet x64-windows - - # note: disable all providers except the one being tested - # '-DCMAKE_SUPPRESS_REGENERATION=ON' is the WA for the error: "CUSTOMBUILD : CMake error : Cannot restore timestamp" - - name: Configure build (Debug) - run: > - cmake - -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}};${{env.EXTRA_CMAKE_PATH}}" - -B ${{env.BUILD_DEBUG_DIR}} - -DCMAKE_INSTALL_PREFIX="${{env.INSTL_DEBUG_DIR}}" - -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_C_COMPILER=${{env.C_COMPILER}} - -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} - -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} - -DUMF_BUILD_BENCHMARKS=ON - -DUMF_BUILD_BENCHMARKS_MT=ON - -DUMF_BUILD_TESTS=ON - -DUMF_BUILD_GPU_TESTS=ON - -DUMF_BUILD_GPU_EXAMPLES=ON - -DUMF_DEVELOPER_MODE=ON - -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON - -DUMF_BUILD_CUDA_PROVIDER=OFF - -DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF - -DUMF_BUILD_${{inputs.provider}}_PROVIDER=ON - -DUMF_TESTS_FAIL_ON_SKIP=ON - ${{ matrix.os == 'Ubuntu' && '-DUMF_USE_COVERAGE=ON' || '' }} - ${{ matrix.os == 'Windows' && '-DCMAKE_SUPPRESS_REGENERATION=ON' || '' }} - - - name: Build UMF (Debug) - run: cmake --build ${{env.BUILD_DEBUG_DIR}} --config Debug -j ${{env.PROCS}} - - - name: Run tests (Debug) - working-directory: ${{env.BUILD_DEBUG_DIR}} - run: ctest -C Debug --output-on-failure --test-dir test - - - name: Run examples (Debug) - working-directory: ${{env.BUILD_DEBUG_DIR}} - run: ctest --output-on-failure --test-dir examples -C Debug - - - name: Configure build (Release) - run: > - cmake - -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}};${{env.EXTRA_CMAKE_PATH}}" - -B ${{env.BUILD_RELEASE_DIR}} - -DCMAKE_INSTALL_PREFIX="${{env.INSTL_RELEASE_DIR}}" - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_C_COMPILER=${{env.C_COMPILER}} - -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} - -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} - -DUMF_BUILD_BENCHMARKS=ON - -DUMF_BUILD_BENCHMARKS_MT=ON - -DUMF_BUILD_TESTS=ON - -DUMF_BUILD_GPU_TESTS=ON - -DUMF_BUILD_GPU_EXAMPLES=ON - -DUMF_DEVELOPER_MODE=ON - -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON - -DUMF_BUILD_CUDA_PROVIDER=OFF - -DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF - -DUMF_BUILD_${{inputs.provider}}_PROVIDER=ON - -DUMF_TESTS_FAIL_ON_SKIP=ON - ${{ matrix.os == 'Windows' && '-DCMAKE_SUPPRESS_REGENERATION=ON' || '' }} - - - name: Build UMF (Release) - run: cmake --build ${{env.BUILD_RELEASE_DIR}} --config Release -j ${{env.PROCS}} - - - name: Run tests (Release) - working-directory: ${{env.BUILD_RELEASE_DIR}} - run: ctest -C Release --output-on-failure --test-dir test - - - name: Run examples (Release) - working-directory: ${{env.BUILD_RELEASE_DIR}} - run: ctest --output-on-failure --test-dir examples -C Release - - - name: Run benchmarks (Release) - working-directory: ${{env.BUILD_RELEASE_DIR}} - run: ctest --output-on-failure --test-dir benchmark -C Release --exclude-regex umf-multithreaded - - - name: "[Lin] Check coverage (Debug)" - if: ${{ matrix.os == 'Ubuntu' }} - working-directory: ${{env.BUILD_DEBUG_DIR}} - run: | - export COVERAGE_FILE_NAME=${{env.COVERAGE_NAME}}-shared-${{matrix.shared_library}} - echo "COVERAGE_FILE_NAME: $COVERAGE_FILE_NAME" - ${{github.workspace}}/scripts/coverage/coverage_capture.sh $COVERAGE_FILE_NAME - mkdir -p ${{env.COVERAGE_DIR}} - mv ./$COVERAGE_FILE_NAME ${{env.COVERAGE_DIR}} - - - name: "[Lin] Upload coverage" - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - if: ${{ matrix.os == 'Ubuntu' }} - with: - name: ${{env.COVERAGE_NAME}}-shared-${{matrix.shared_library}} - path: ${{env.COVERAGE_DIR}} - - - name: "[Win] Prepare vcpkg cache" - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' - run: | - Compress-Archive -Path ${{github.workspace}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest - - - name: "[Win] Save vcpkg cache" - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' - uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - path: ${{github.workspace}}/vcpkg_pkgs_cache.zip - key: ${{ steps.cache.outputs.cache-primary-key }} + uses: ./.github/workflows/reusable_gpu_lin.yml + with: + provider: ${{ inputs.provider }} + runner: ${{ inputs.runner }} + shared_lib: ${{ inputs.shared_lib }} + secrets: inherit diff --git a/.github/workflows/reusable_gpu_lin.yml b/.github/workflows/reusable_gpu_lin.yml new file mode 100644 index 000000000..ead27e11a --- /dev/null +++ b/.github/workflows/reusable_gpu_lin.yml @@ -0,0 +1,183 @@ +# This workflow builds and tests providers using GPU memory. It requires properly +# labelled self-hosted runners on systems with the correct GPU and drivers. +# +# Linux runners, using docker containers. +# +name: "[Lin] GPU" + +on: + workflow_call: + inputs: + provider: + description: Provider name + type: string + required: true + runner: + description: Runner name (without 'DSS-' prefix) + type: string + required: true + shared_lib: + description: A list of options for building shared library + type: string + default: "['ON', 'OFF']" + +permissions: + contents: read + +env: + BUILD_DEBUG_DIR : "${{github.workspace}}/debug/build" + BUILD_RELEASE_DIR : "${{github.workspace}}/release/build" + INSTL_DEBUG_DIR : "${{github.workspace}}/debug/install-dir" + INSTL_RELEASE_DIR : "${{github.workspace}}/release/install-dir" + COVERAGE_DIR : "${{github.workspace}}/coverage" + +jobs: + gpu: + env: + COVERAGE_NAME : "exports-coverage-${{inputs.provider}}-${{inputs.runner}}" + strategy: + fail-fast: false + matrix: + shared_library: ${{ fromJSON(inputs.shared_lib)}} + name: GPU (Lin, shared=${{matrix.shared_library}}) + runs-on: ["DSS-${{inputs.runner}}", "DSS-Ubuntu"] + container: + image: intel/oneapi:2026.1.0-devel-ubuntu26.04 # intel/oneapi:2025.3.1-0-devel-ubuntu24.04 + options: >- + --device=/dev/dri + volumes: + - ${{ github.workspace }}:${{ github.workspace }} + + steps: + - name: "Establish build params" + run: | + echo "C_COMPILER=gcc" >> $GITHUB_ENV + echo "CXX_COMPILER=g++" >> $GITHUB_ENV + echo "PROCS=$(nproc)" >> $GITHUB_ENV + + mkdir -p ${{env.BUILD_DEBUG_DIR}} ${{env.BUILD_RELEASE_DIR}} ${{env.INSTL_DEBUG_DIR}} ${{env.INSTL_RELEASE_DIR}} + + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 0 + + # add-apt-repository -y ppa:kobuk-team/intel-graphics + # apt-get update + # apt-get install -y \ + # clinfo \ + # intel-gsc \ + # intel-media-va-driver-non-free \ + # intel-metrics-discovery \ + # intel-ocloc \ + # intel-opencl-icd \ + # libmfx-gen1 \ + # libva-glx2 \ + # libvpl2 \ + # libvpl-tools \ + # libze1 \ + # libze-dev \ + # libze-intel-gpu1 \ + # software-properties-common \ + # va-driver-all \ + # vainfo + - name: Install dependencies + run: | + # extra proxy inherited to docker has to be removed + unset no_proxy + unset NO_PROXY + + apt-get update + apt-get install -y \ + automake \ + lcov \ + libnuma-dev \ + libtool + + - name: "Get information about platform" + run: .github/scripts/get_system_info.sh + + # note: disable all providers except the one being tested + - name: Configure build (Debug) + run: > + cmake + -B ${{env.BUILD_DEBUG_DIR}} + -DCMAKE_INSTALL_PREFIX="${{env.INSTL_DEBUG_DIR}}" + -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_C_COMPILER=${{env.C_COMPILER}} + -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} + -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} + -DUMF_BUILD_BENCHMARKS=ON + -DUMF_BUILD_BENCHMARKS_MT=ON + -DUMF_BUILD_TESTS=ON + -DUMF_BUILD_GPU_TESTS=ON + -DUMF_BUILD_GPU_EXAMPLES=ON + -DUMF_DEVELOPER_MODE=ON + -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON + -DUMF_BUILD_CUDA_PROVIDER=OFF + -DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF + -DUMF_BUILD_${{inputs.provider}}_PROVIDER=ON + -DUMF_TESTS_FAIL_ON_SKIP=ON + -DUMF_USE_COVERAGE=ON + + - name: Build UMF (Debug) + run: cmake --build ${{env.BUILD_DEBUG_DIR}} --config Debug -j ${{env.PROCS}} + + - name: Run tests (Debug) + working-directory: ${{env.BUILD_DEBUG_DIR}} + run: ctest -C Debug --output-on-failure --test-dir test + + - name: Run examples (Debug) + working-directory: ${{env.BUILD_DEBUG_DIR}} + run: ctest --output-on-failure --test-dir examples -C Debug + + - name: Configure build (Release) + run: > + cmake + -B ${{env.BUILD_RELEASE_DIR}} + -DCMAKE_INSTALL_PREFIX="${{env.INSTL_RELEASE_DIR}}" + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_C_COMPILER=${{env.C_COMPILER}} + -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} + -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} + -DUMF_BUILD_BENCHMARKS=ON + -DUMF_BUILD_BENCHMARKS_MT=ON + -DUMF_BUILD_TESTS=ON + -DUMF_BUILD_GPU_TESTS=ON + -DUMF_BUILD_GPU_EXAMPLES=ON + -DUMF_DEVELOPER_MODE=ON + -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON + -DUMF_BUILD_CUDA_PROVIDER=OFF + -DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF + -DUMF_BUILD_${{inputs.provider}}_PROVIDER=ON + -DUMF_TESTS_FAIL_ON_SKIP=ON + + - name: Build UMF (Release) + run: cmake --build ${{env.BUILD_RELEASE_DIR}} --config Release -j ${{env.PROCS}} + + - name: Run tests (Release) + working-directory: ${{env.BUILD_RELEASE_DIR}} + run: ctest -C Release --output-on-failure --test-dir test + + - name: Run examples (Release) + working-directory: ${{env.BUILD_RELEASE_DIR}} + run: ctest --output-on-failure --test-dir examples -C Release + + - name: Run benchmarks (Release) + working-directory: ${{env.BUILD_RELEASE_DIR}} + run: ctest --output-on-failure --test-dir benchmark -C Release --exclude-regex umf-multithreaded + + - name: "Check coverage (Debug)" + working-directory: ${{env.BUILD_DEBUG_DIR}} + run: | + export COVERAGE_FILE_NAME=${{env.COVERAGE_NAME}}-shared-${{matrix.shared_library}} + echo "COVERAGE_FILE_NAME: $COVERAGE_FILE_NAME" + ${{github.workspace}}/scripts/coverage/coverage_capture.sh $COVERAGE_FILE_NAME + mkdir -p ${{env.COVERAGE_DIR}} + mv ./$COVERAGE_FILE_NAME ${{env.COVERAGE_DIR}} + + - name: "Upload coverage" + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{env.COVERAGE_NAME}}-shared-${{matrix.shared_library}} + path: ${{env.COVERAGE_DIR}} diff --git a/.github/workflows/reusable_gpu_win.yml b/.github/workflows/reusable_gpu_win.yml new file mode 100644 index 000000000..aa5b5cf89 --- /dev/null +++ b/.github/workflows/reusable_gpu_win.yml @@ -0,0 +1,168 @@ +# This workflow builds and tests providers using GPU memory. It requires properly +# labelled self-hosted runners on systems with the correct GPU and drivers. +# +# Windows runners. +# +name: "[Win] GPU" + +on: + workflow_call: + inputs: + provider: + description: Provider name + type: string + required: true + runner: + description: Runner name (without 'DSS-' prefix) + type: string + required: true + shared_lib: + description: A list of options for building shared library + type: string + default: "['ON', 'OFF']" + +permissions: + contents: read + +env: + BUILD_DEBUG_DIR : "${{github.workspace}}/debug/build" + BUILD_RELEASE_DIR : "${{github.workspace}}/release/build" + INSTL_DEBUG_DIR : "${{github.workspace}}/debug/install-dir" + INSTL_RELEASE_DIR : "${{github.workspace}}/release/install-dir" + +jobs: + gpu: + env: + VCPKG_PATH: "${{github.workspace}}/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/vcpkg/packages/jemalloc_x64-windows;" + strategy: + fail-fast: false + matrix: + shared_library: ${{ fromJSON(inputs.shared_lib)}} + name: GPU (Win, shared=${{matrix.shared_library}}) + runs-on: ["DSS-${{inputs.runner}}", "DSS-Windows"] + + steps: + # Set various build params based on OS + - name: "Establish build params" + run: | + echo "C_COMPILER=cl" >> $env:GITHUB_ENV + echo "CXX_COMPILER=cl" >> $env:GITHUB_ENV + echo "PROCS=$Env:NUMBER_OF_PROCESSORS" >> $env:GITHUB_ENV + echo "EXTRA_CMAKE_PATH=$Env:CUDA_PATH" >> $env:GITHUB_ENV + + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 0 + + - name: "Restore vcpkg cache" + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + id: cache + with: + path: vcpkg_pkgs_cache.zip + key: vcpkg-gpu-${{inputs.runner}}-windows-${{ hashFiles('vcpkg.json') }} + + - name: "Unpack vcpkg cache" + if: steps.cache.outputs.cache-hit == 'true' + run: | + Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{github.workspace}}/vcpkg -Force + + - name: "Initialize vcpkg" + if: steps.cache.outputs.cache-hit != 'true' + uses: lukka/run-vcpkg@b1a0dd252f06b9e25b3c022a9a03bd7a427fb6a2 # v11.6 + with: + vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 + vcpkgDirectory: ${{github.workspace}}/vcpkg + vcpkgJsonGlob: '**/vcpkg.json' + + - name: "Install dependencies" + if: steps.cache.outputs.cache-hit != 'true' + env: + VCPKG_BINARY_SOURCES: clear + run: vcpkg install --triplet x64-windows + + # note: disable all providers except the one being tested + # '-DCMAKE_SUPPRESS_REGENERATION=ON' is the WA for the error: "CUSTOMBUILD : CMake error : Cannot restore timestamp" + - name: Configure build (Debug) + run: > + cmake + -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}};${{env.EXTRA_CMAKE_PATH}}" + -B ${{env.BUILD_DEBUG_DIR}} + -DCMAKE_INSTALL_PREFIX="${{env.INSTL_DEBUG_DIR}}" + -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_C_COMPILER=${{env.C_COMPILER}} + -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} + -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} + -DUMF_BUILD_BENCHMARKS=ON + -DUMF_BUILD_BENCHMARKS_MT=ON + -DUMF_BUILD_TESTS=ON + -DUMF_BUILD_GPU_TESTS=ON + -DUMF_BUILD_GPU_EXAMPLES=ON + -DUMF_DEVELOPER_MODE=ON + -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON + -DUMF_BUILD_CUDA_PROVIDER=OFF + -DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF + -DUMF_BUILD_${{inputs.provider}}_PROVIDER=ON + -DUMF_TESTS_FAIL_ON_SKIP=ON + -DCMAKE_SUPPRESS_REGENERATION=ON + + - name: Build UMF (Debug) + run: cmake --build ${{env.BUILD_DEBUG_DIR}} --config Debug -j ${{env.PROCS}} + + - name: Run tests (Debug) + working-directory: ${{env.BUILD_DEBUG_DIR}} + run: ctest -C Debug --output-on-failure --test-dir test + + - name: Run examples (Debug) + working-directory: ${{env.BUILD_DEBUG_DIR}} + run: ctest --output-on-failure --test-dir examples -C Debug + + - name: Configure build (Release) + run: > + cmake + -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}};${{env.EXTRA_CMAKE_PATH}}" + -B ${{env.BUILD_RELEASE_DIR}} + -DCMAKE_INSTALL_PREFIX="${{env.INSTL_RELEASE_DIR}}" + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_C_COMPILER=${{env.C_COMPILER}} + -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} + -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} + -DUMF_BUILD_BENCHMARKS=ON + -DUMF_BUILD_BENCHMARKS_MT=ON + -DUMF_BUILD_TESTS=ON + -DUMF_BUILD_GPU_TESTS=ON + -DUMF_BUILD_GPU_EXAMPLES=ON + -DUMF_DEVELOPER_MODE=ON + -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON + -DUMF_BUILD_CUDA_PROVIDER=OFF + -DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF + -DUMF_BUILD_${{inputs.provider}}_PROVIDER=ON + -DUMF_TESTS_FAIL_ON_SKIP=ON + -DCMAKE_SUPPRESS_REGENERATION=ON + + - name: Build UMF (Release) + run: cmake --build ${{env.BUILD_RELEASE_DIR}} --config Release -j ${{env.PROCS}} + + - name: Run tests (Release) + working-directory: ${{env.BUILD_RELEASE_DIR}} + run: ctest -C Release --output-on-failure --test-dir test + + - name: Run examples (Release) + working-directory: ${{env.BUILD_RELEASE_DIR}} + run: ctest --output-on-failure --test-dir examples -C Release + + - name: Run benchmarks (Release) + working-directory: ${{env.BUILD_RELEASE_DIR}} + run: ctest --output-on-failure --test-dir benchmark -C Release --exclude-regex umf-multithreaded + + - name: "Prepare vcpkg cache" + if: steps.cache.outputs.cache-hit != 'true' + run: | + Compress-Archive -Path ${{github.workspace}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest + + - name: "Save vcpkg cache" + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{github.workspace}}/vcpkg_pkgs_cache.zip + key: ${{ steps.cache.outputs.cache-primary-key }}