|
1 | 1 | # This workflow builds and tests providers using GPU memory. It requires properly |
2 | 2 | # labelled self-hosted runners on systems with the correct GPU and drivers. |
| 3 | +# |
| 4 | +# It starts jobs for both Windows and Linux runners - it's only a thin wrapper for |
| 5 | +# the OS-specific workflows. It's better to call them twice here, instead of |
| 6 | +# duplicating two workflow calls in the PR/push workflow, for each tested device. |
| 7 | +# |
3 | 8 | name: GPU |
4 | 9 |
|
5 | 10 | on: |
|
13 | 18 | description: Runner name (without 'DSS-' prefix) |
14 | 19 | type: string |
15 | 20 | required: true |
16 | | - os: |
17 | | - description: A list of OSes |
18 | | - type: string |
19 | | - default: "['Ubuntu', 'Windows']" |
20 | 21 | shared_lib: |
21 | 22 | description: A list of options for building shared library |
22 | 23 | type: string |
|
25 | 26 | permissions: |
26 | 27 | contents: read |
27 | 28 |
|
28 | | -env: |
29 | | - BUILD_DEBUG_DIR : "${{github.workspace}}/debug/build" |
30 | | - BUILD_RELEASE_DIR : "${{github.workspace}}/release/build" |
31 | | - INSTL_DEBUG_DIR : "${{github.workspace}}/debug/install-dir" |
32 | | - INSTL_RELEASE_DIR : "${{github.workspace}}/release/install-dir" |
33 | | - COVERAGE_DIR : "${{github.workspace}}/coverage" |
34 | | - |
35 | 29 | jobs: |
36 | | - gpu: |
37 | | - env: |
38 | | - VCPKG_PATH: "${{github.workspace}}/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/vcpkg/packages/jemalloc_x64-windows;" |
39 | | - COVERAGE_NAME : "exports-coverage-${{inputs.provider}}-${{inputs.runner}}" |
| 30 | + win: |
40 | 31 | # run only on upstream; forks will not have the HW |
41 | 32 | if: github.repository == 'oneapi-src/unified-memory-framework' |
42 | | - strategy: |
43 | | - fail-fast: false |
44 | | - matrix: |
45 | | - shared_library: ${{ fromJSON(inputs.shared_lib)}} |
46 | | - os: ${{ fromJSON(inputs.os)}} |
47 | | - name: GPU (${{matrix.os}}, shared=${{matrix.shared_library}}) |
48 | | - runs-on: ["DSS-${{inputs.runner}}", "DSS-${{matrix.os}}"] |
49 | | - |
50 | | - steps: |
51 | | - # Set various build params based on OS |
52 | | - - name: "[Win] Establish build params" |
53 | | - if : ${{ matrix.os == 'Windows' }} |
54 | | - run: | |
55 | | - echo "C_COMPILER=cl" >> $env:GITHUB_ENV |
56 | | - echo "CXX_COMPILER=cl" >> $env:GITHUB_ENV |
57 | | - echo "PROCS=$Env:NUMBER_OF_PROCESSORS" >> $env:GITHUB_ENV |
58 | | - echo "EXTRA_CMAKE_PATH=$Env:CUDA_PATH" >> $env:GITHUB_ENV |
59 | | -
|
60 | | - - name: "[Lin] Establish build params" |
61 | | - if : ${{ matrix.os == 'Ubuntu' }} |
62 | | - run: | |
63 | | - echo "C_COMPILER=gcc" >> $GITHUB_ENV |
64 | | - echo "CXX_COMPILER=g++" >> $GITHUB_ENV |
65 | | - echo "PROCS=$(nproc)" >> $GITHUB_ENV |
66 | | -
|
67 | | - - name: Checkout |
68 | | - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
69 | | - with: |
70 | | - fetch-depth: 0 |
71 | | - |
72 | | - - name: "[Lin] Get information about platform" |
73 | | - if: matrix.os == 'Ubuntu' |
74 | | - run: .github/scripts/get_system_info.sh |
75 | | - |
76 | | - - name: "[Win] Restore vcpkg cache" |
77 | | - if: matrix.os == 'Windows' |
78 | | - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
79 | | - id: cache |
80 | | - with: |
81 | | - path: vcpkg_pkgs_cache.zip |
82 | | - key: vcpkg-gpu-${{inputs.runner}}-windows-${{ hashFiles('vcpkg.json') }} |
83 | | - |
84 | | - - name: "[Win] Unpack vcpkg cache" |
85 | | - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit == 'true' |
86 | | - run: | |
87 | | - Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{github.workspace}}/vcpkg -Force |
88 | | -
|
89 | | - - name: "[Win] Initialize vcpkg" |
90 | | - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' |
91 | | - uses: lukka/run-vcpkg@b1a0dd252f06b9e25b3c022a9a03bd7a427fb6a2 # v11.6 |
92 | | - with: |
93 | | - vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 |
94 | | - vcpkgDirectory: ${{github.workspace}}/vcpkg |
95 | | - vcpkgJsonGlob: '**/vcpkg.json' |
96 | | - |
97 | | - - name: "[Win] Install dependencies" |
98 | | - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' |
99 | | - env: |
100 | | - VCPKG_BINARY_SOURCES: clear |
101 | | - run: vcpkg install --triplet x64-windows |
102 | | - |
103 | | - # note: disable all providers except the one being tested |
104 | | - # '-DCMAKE_SUPPRESS_REGENERATION=ON' is the WA for the error: "CUSTOMBUILD : CMake error : Cannot restore timestamp" |
105 | | - - name: Configure build (Debug) |
106 | | - run: > |
107 | | - cmake |
108 | | - -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}};${{env.EXTRA_CMAKE_PATH}}" |
109 | | - -B ${{env.BUILD_DEBUG_DIR}} |
110 | | - -DCMAKE_INSTALL_PREFIX="${{env.INSTL_DEBUG_DIR}}" |
111 | | - -DCMAKE_BUILD_TYPE=Debug |
112 | | - -DCMAKE_C_COMPILER=${{env.C_COMPILER}} |
113 | | - -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} |
114 | | - -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} |
115 | | - -DUMF_BUILD_BENCHMARKS=ON |
116 | | - -DUMF_BUILD_BENCHMARKS_MT=ON |
117 | | - -DUMF_BUILD_TESTS=ON |
118 | | - -DUMF_BUILD_GPU_TESTS=ON |
119 | | - -DUMF_BUILD_GPU_EXAMPLES=ON |
120 | | - -DUMF_DEVELOPER_MODE=ON |
121 | | - -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON |
122 | | - -DUMF_BUILD_CUDA_PROVIDER=OFF |
123 | | - -DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF |
124 | | - -DUMF_BUILD_${{inputs.provider}}_PROVIDER=ON |
125 | | - -DUMF_TESTS_FAIL_ON_SKIP=ON |
126 | | - ${{ matrix.os == 'Ubuntu' && '-DUMF_USE_COVERAGE=ON' || '' }} |
127 | | - ${{ matrix.os == 'Windows' && '-DCMAKE_SUPPRESS_REGENERATION=ON' || '' }} |
128 | | -
|
129 | | - - name: Build UMF (Debug) |
130 | | - run: cmake --build ${{env.BUILD_DEBUG_DIR}} --config Debug -j ${{env.PROCS}} |
131 | | - |
132 | | - - name: Run tests (Debug) |
133 | | - working-directory: ${{env.BUILD_DEBUG_DIR}} |
134 | | - run: ctest -C Debug --output-on-failure --test-dir test |
135 | | - |
136 | | - - name: Run examples (Debug) |
137 | | - working-directory: ${{env.BUILD_DEBUG_DIR}} |
138 | | - run: ctest --output-on-failure --test-dir examples -C Debug |
139 | | - |
140 | | - - name: Configure build (Release) |
141 | | - run: > |
142 | | - cmake |
143 | | - -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}};${{env.EXTRA_CMAKE_PATH}}" |
144 | | - -B ${{env.BUILD_RELEASE_DIR}} |
145 | | - -DCMAKE_INSTALL_PREFIX="${{env.INSTL_RELEASE_DIR}}" |
146 | | - -DCMAKE_BUILD_TYPE=Release |
147 | | - -DCMAKE_C_COMPILER=${{env.C_COMPILER}} |
148 | | - -DCMAKE_CXX_COMPILER=${{env.CXX_COMPILER}} |
149 | | - -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} |
150 | | - -DUMF_BUILD_BENCHMARKS=ON |
151 | | - -DUMF_BUILD_BENCHMARKS_MT=ON |
152 | | - -DUMF_BUILD_TESTS=ON |
153 | | - -DUMF_BUILD_GPU_TESTS=ON |
154 | | - -DUMF_BUILD_GPU_EXAMPLES=ON |
155 | | - -DUMF_DEVELOPER_MODE=ON |
156 | | - -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON |
157 | | - -DUMF_BUILD_CUDA_PROVIDER=OFF |
158 | | - -DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF |
159 | | - -DUMF_BUILD_${{inputs.provider}}_PROVIDER=ON |
160 | | - -DUMF_TESTS_FAIL_ON_SKIP=ON |
161 | | - ${{ matrix.os == 'Windows' && '-DCMAKE_SUPPRESS_REGENERATION=ON' || '' }} |
162 | | -
|
163 | | - - name: Build UMF (Release) |
164 | | - run: cmake --build ${{env.BUILD_RELEASE_DIR}} --config Release -j ${{env.PROCS}} |
165 | | - |
166 | | - - name: Run tests (Release) |
167 | | - working-directory: ${{env.BUILD_RELEASE_DIR}} |
168 | | - run: ctest -C Release --output-on-failure --test-dir test |
169 | | - |
170 | | - - name: Run examples (Release) |
171 | | - working-directory: ${{env.BUILD_RELEASE_DIR}} |
172 | | - run: ctest --output-on-failure --test-dir examples -C Release |
173 | | - |
174 | | - - name: Run benchmarks (Release) |
175 | | - working-directory: ${{env.BUILD_RELEASE_DIR}} |
176 | | - run: ctest --output-on-failure --test-dir benchmark -C Release --exclude-regex umf-multithreaded |
177 | | - |
178 | | - - name: "[Lin] Check coverage (Debug)" |
179 | | - if: ${{ matrix.os == 'Ubuntu' }} |
180 | | - working-directory: ${{env.BUILD_DEBUG_DIR}} |
181 | | - run: | |
182 | | - export COVERAGE_FILE_NAME=${{env.COVERAGE_NAME}}-shared-${{matrix.shared_library}} |
183 | | - echo "COVERAGE_FILE_NAME: $COVERAGE_FILE_NAME" |
184 | | - ${{github.workspace}}/scripts/coverage/coverage_capture.sh $COVERAGE_FILE_NAME |
185 | | - mkdir -p ${{env.COVERAGE_DIR}} |
186 | | - mv ./$COVERAGE_FILE_NAME ${{env.COVERAGE_DIR}} |
187 | | -
|
188 | | - - name: "[Lin] Upload coverage" |
189 | | - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
190 | | - if: ${{ matrix.os == 'Ubuntu' }} |
191 | | - with: |
192 | | - name: ${{env.COVERAGE_NAME}}-shared-${{matrix.shared_library}} |
193 | | - path: ${{env.COVERAGE_DIR}} |
194 | | - |
195 | | - - name: "[Win] Prepare vcpkg cache" |
196 | | - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' |
197 | | - run: | |
198 | | - Compress-Archive -Path ${{github.workspace}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest |
199 | | -
|
200 | | - - name: "[Win] Save vcpkg cache" |
201 | | - if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' |
202 | | - uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
203 | | - with: |
204 | | - path: ${{github.workspace}}/vcpkg_pkgs_cache.zip |
205 | | - key: ${{ steps.cache.outputs.cache-primary-key }} |
| 33 | + uses: ./.github/workflows/reusable_gpu_win.yml |
| 34 | + with: |
| 35 | + provider: ${{ inputs.provider }} |
| 36 | + runner: ${{ inputs.runner }} |
| 37 | + shared_lib: ${{ inputs.shared_lib }} |
| 38 | + lin: |
| 39 | + # run only on upstream; forks will not have the HW |
| 40 | + if: github.repository == 'oneapi-src/unified-memory-framework' |
| 41 | + uses: ./.github/workflows/reusable_gpu_lin.yml |
| 42 | + with: |
| 43 | + provider: ${{ inputs.provider }} |
| 44 | + runner: ${{ inputs.runner }} |
| 45 | + shared_lib: ${{ inputs.shared_lib }} |
0 commit comments