Skip to content

Commit 696f1ce

Browse files
committed
build and run old examples with new UMF
1 parent a71bec9 commit 696f1ce

File tree

1 file changed

+181
-79
lines changed

1 file changed

+181
-79
lines changed

.github/workflows/reusable_compatibility.yml

Lines changed: 181 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install apt packages
2424
run: |
2525
sudo apt-get update
26-
sudo apt-get install -y clang cmake libnuma-dev libtbb-dev
26+
sudo apt-get install -y clang cmake hwloc libnuma-dev libtbb-dev
2727
2828
- name: Checkout "tag" UMF version
2929
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -36,61 +36,66 @@ jobs:
3636
working-directory: ${{github.workspace}}/tag_version
3737
run: .github/scripts/install_hwloc.sh
3838

39-
- name: Configure "tag" UMF build
40-
working-directory: ${{github.workspace}}/tag_version
39+
- name: Checkout latest UMF version
40+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
41+
with:
42+
fetch-depth: 0
43+
path: ${{github.workspace}}/latest_version
44+
45+
- name: Configure latest UMF build
46+
working-directory: ${{github.workspace}}/latest_version
4147
run: >
4248
cmake
43-
-B ${{github.workspace}}/tag_version/build
49+
-B ${{github.workspace}}/latest_version/build
50+
-DCMAKE_INSTALL_PREFIX=_install
4451
-DCMAKE_BUILD_TYPE=Debug
4552
-DUMF_BUILD_SHARED_LIBRARY=ON
4653
-DCMAKE_C_COMPILER=gcc
4754
-DCMAKE_CXX_COMPILER=g++
48-
-DUMF_BUILD_TESTS=ON
49-
-DUMF_BUILD_EXAMPLES=ON
55+
-DUMF_BUILD_TESTS=OFF
5056
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
5157
-DUMF_BUILD_CUDA_PROVIDER=ON
5258
-DUMF_FORMAT_CODE_STYLE=OFF
5359
-DUMF_DEVELOPER_MODE=ON
5460
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
55-
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
56-
-DUMF_TESTS_FAIL_ON_SKIP=ON
57-
58-
- name: Build "tag" UMF
59-
working-directory: ${{github.workspace}}/tag_version
60-
run: |
61-
cmake --build ${{github.workspace}}/tag_version/build -j $(nproc)
6261
63-
- name: Run "tag" UMF tests
64-
working-directory: ${{github.workspace}}/tag_version/build
62+
- name: Build latest UMF
63+
working-directory: ${{github.workspace}}/latest_version
6564
run: |
66-
LD_LIBRARY_PATH=${{github.workspace}}/tag_version/build/lib/ ctest --output-on-failure
67-
68-
- name: Checkout latest UMF version
69-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
70-
with:
71-
fetch-depth: 0
72-
path: ${{github.workspace}}/latest_version
65+
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
7366
74-
- name: Configure latest UMF build
67+
- name: Install latest UMF
7568
working-directory: ${{github.workspace}}/latest_version
69+
run: sudo cmake --install ${{github.workspace}}/latest_version/build --config Debug
70+
71+
- name: Configure "tag" UMF build
72+
working-directory: ${{github.workspace}}/tag_version
7673
run: >
7774
cmake
78-
-B ${{github.workspace}}/latest_version/build
75+
-B ${{github.workspace}}/tag_version/build
7976
-DCMAKE_BUILD_TYPE=Debug
8077
-DUMF_BUILD_SHARED_LIBRARY=ON
8178
-DCMAKE_C_COMPILER=gcc
8279
-DCMAKE_CXX_COMPILER=g++
83-
-DUMF_BUILD_TESTS=OFF
80+
-DUMF_BUILD_TESTS=ON
81+
-DUMF_BUILD_EXAMPLES=ON
8482
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
8583
-DUMF_BUILD_CUDA_PROVIDER=ON
8684
-DUMF_FORMAT_CODE_STYLE=OFF
8785
-DUMF_DEVELOPER_MODE=ON
8886
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
87+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
88+
-DUMF_TESTS_FAIL_ON_SKIP=ON
8989
90-
- name: Build latest UMF
91-
working-directory: ${{github.workspace}}/latest_version
90+
- name: Build "tag" UMF
91+
working-directory: ${{github.workspace}}/tag_version
9292
run: |
93-
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
93+
cmake --build ${{github.workspace}}/tag_version/build -j $(nproc)
94+
95+
- name: Run "tag" UMF tests
96+
working-directory: ${{github.workspace}}/tag_version/build
97+
run: |
98+
LD_LIBRARY_PATH=${{github.workspace}}/tag_version/build/lib/ ctest --output-on-failure
9499
95100
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
96101
working-directory: ${{github.workspace}}/tag_version/build
@@ -103,10 +108,31 @@ jobs:
103108
GTEST_FILTER="-*umfIpcTest.GetPoolByOpenedHandle*"
104109
ctest --verbose -E "umf-mempolicy"
105110
111+
# Browse all folders in the examples directory, build them using the
112+
# latest UMF version, and run them, excluding those in the exclude list.
113+
- name: Build and run "tag" examples using the latest UMF libraries
114+
working-directory: ${{github.workspace}}/tag_version
115+
run: |
116+
EXAMPLES_EXCLUDE_LIST="cmake|common|hmat|level_zero|cuda"
117+
rm -rf build
118+
rm -rf include
119+
mkdir _examples
120+
cd _examples
121+
EXAMPLES_LIST=$(find ${{github.workspace}}/tag_version/examples -maxdepth 1 -mindepth 1 -type d | grep -Ev $EXAMPLES_EXCLUDE_LIST | xargs -n 1 basename)
122+
for EXAMPLE_NAME in $EXAMPLES_LIST; do
123+
cd ${{github.workspace}}/tag_version
124+
mkdir -p _examples/$EXAMPLE_NAME;
125+
cd _examples/$EXAMPLE_NAME;
126+
CMAKE_PREFIX_PATH=${{github.workspace}}/latest_version/_install cmake ${{github.workspace}}/tag_version/examples/$EXAMPLE_NAME;
127+
make;
128+
find . -maxdepth 1 -type f -executable -exec {} \;
129+
done
130+
106131
windows:
107132
name: Windows
108133
env:
109134
VCPKG_PATH: "${{github.workspace}}/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/vcpkg/packages/jemalloc_x64-windows"
135+
VCPKG_BIN_PATH: "${{github.workspace}}/vcpkg/packages/hwloc_x64-windows/bin;${{github.workspace}}/vcpkg/packages/tbb_x64-windows/bin;${{github.workspace}}/vcpkg/packages/jemalloc_x64-windows/bin"
110136
runs-on: "windows-2022"
111137

112138
steps:
@@ -130,56 +156,61 @@ jobs:
130156
run: vcpkg install --triplet x64-windows
131157
shell: pwsh # Specifies PowerShell as the shell for running the script.
132158

133-
- name: Configure "tag" UMF build
134-
working-directory: ${{github.workspace}}/tag_version
159+
- name: Checkout latest UMF version
160+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
161+
with:
162+
fetch-depth: 0
163+
path: ${{github.workspace}}/latest_version
164+
165+
- name: Configure latest UMF build
166+
working-directory: ${{github.workspace}}/latest_version
135167
run: >
136168
cmake
137-
-B "${{github.workspace}}/tag_version/build"
169+
-B "${{github.workspace}}/latest_version/build"
138170
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
171+
-DCMAKE_INSTALL_PREFIX=_install
139172
-DCMAKE_C_COMPILER=cl
140173
-DCMAKE_CXX_COMPILER=cl
141174
-DUMF_BUILD_SHARED_LIBRARY=ON
142-
-DUMF_BUILD_TESTS=ON
143-
-DUMF_BUILD_EXAMPLES=ON
175+
-DUMF_BUILD_TESTS=OFF
144176
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
145177
-DUMF_BUILD_CUDA_PROVIDER=ON
146178
-DUMF_FORMAT_CODE_STYLE=OFF
147179
-DUMF_DEVELOPER_MODE=ON
148180
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
149-
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
150-
-DUMF_TESTS_FAIL_ON_SKIP=ON
151-
152-
- name: Build "tag" UMF
153-
run: cmake --build "${{github.workspace}}/tag_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
154-
155-
- name: Run "tag" UMF tests
156-
working-directory: "${{github.workspace}}/tag_version/build"
157-
run: ctest -C Debug --output-on-failure --test-dir test
158181
159-
- name: Checkout latest UMF version
160-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
161-
with:
162-
fetch-depth: 0
163-
path: ${{github.workspace}}/latest_version
182+
- name: Build latest UMF
183+
run: cmake --build "${{github.workspace}}/latest_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
164184

165-
- name: Configure latest UMF build
185+
- name: Install latest UMF
166186
working-directory: ${{github.workspace}}/latest_version
187+
run: cmake --install ${{github.workspace}}/latest_version/build --config Debug
188+
189+
- name: Configure "tag" UMF build
190+
working-directory: ${{github.workspace}}/tag_version
167191
run: >
168192
cmake
169-
-B "${{github.workspace}}/latest_version/build"
193+
-B "${{github.workspace}}/tag_version/build"
170194
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
171195
-DCMAKE_C_COMPILER=cl
172196
-DCMAKE_CXX_COMPILER=cl
173197
-DUMF_BUILD_SHARED_LIBRARY=ON
174-
-DUMF_BUILD_TESTS=OFF
198+
-DUMF_BUILD_TESTS=ON
199+
-DUMF_BUILD_EXAMPLES=ON
175200
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
176201
-DUMF_BUILD_CUDA_PROVIDER=ON
177202
-DUMF_FORMAT_CODE_STYLE=OFF
178203
-DUMF_DEVELOPER_MODE=ON
179204
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
205+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
206+
-DUMF_TESTS_FAIL_ON_SKIP=ON
180207
181-
- name: Build latest UMF
182-
run: cmake --build "${{github.workspace}}/latest_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
208+
- name: Build "tag" UMF
209+
run: cmake --build "${{github.workspace}}/tag_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
210+
211+
- name: Run "tag" UMF tests
212+
working-directory: "${{github.workspace}}/tag_version/build"
213+
run: ctest -C Debug --output-on-failure --test-dir test
183214

184215
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
185216
working-directory: ${{github.workspace}}/tag_version/build
@@ -191,6 +222,48 @@ jobs:
191222
cp ${{github.workspace}}/latest_version/build/bin/Debug/umf.dll ${{github.workspace}}/tag_version/build/bin/Debug/umf.dll
192223
ctest -C Debug --verbose
193224
225+
# Browse all folders in the examples directory, build them using the
226+
# latest UMF version, and run them, excluding those in the exclude list.
227+
- name: Build and run "tag" examples using the latest UMF libraries
228+
working-directory: ${{github.workspace}}/tag_version
229+
run: |
230+
$ErrorActionPreference = "Stop"
231+
$EXAMPLES_EXCLUDE_LIST = "cmake|common|hmat|level_zero|cuda|custom|ipc|numa"
232+
Set-Location "${{github.workspace}}/tag_version"
233+
Remove-Item -Recurse -ErrorAction Ignore -Force build, include
234+
New-Item -ItemType Directory -Path _examples
235+
Set-Location -Path _examples
236+
$EXAMPLES_LIST = Get-ChildItem -Path "${{github.workspace}}/tag_version/examples" -Directory | Where-Object { $_.Name -notmatch $EXAMPLES_EXCLUDE_LIST } | ForEach-Object { $_.Name }
237+
# NOTE: we add our paths at the beginning of the PATH variable because
238+
# there is a limit on the size of the PATH variable in Windows
239+
$env:Path = "${{github.workspace}}/latest_version/_install/bin;${{env.VCPKG_BIN_PATH}};$env:Path"
240+
foreach ($EXAMPLE_NAME in $EXAMPLES_LIST) {
241+
Set-Location -Path "${{github.workspace}}/tag_version"
242+
New-Item -ItemType Directory -Path "_examples/$EXAMPLE_NAME"
243+
Set-Location -Path "_examples/$EXAMPLE_NAME"
244+
Write-Output "`nBuilding example: $EXAMPLE_NAME"
245+
cmake -DCMAKE_PREFIX_PATH="${{github.workspace}}/latest_version/_install;${{env.VCPKG_PATH}}" "${{github.workspace}}/tag_version/examples/$EXAMPLE_NAME"
246+
cmake --build .
247+
Set-Location -Path Debug
248+
Write-Output "`nRunning example: $EXAMPLE_NAME"
249+
$exeFiles = Get-ChildItem -Filter *.exe
250+
if ($exeFiles.Count -eq 0) {
251+
Write-Error "No executable files found in the current directory."
252+
exit 1
253+
}
254+
foreach ($exeFile in $exeFiles) {
255+
Write-Output "Running: $($exeFile.FullName)"
256+
& $exeFile.FullName
257+
if ($LASTEXITCODE -ne 0) {
258+
$unsignedExitCode = [Convert]::ToInt32($LASTEXITCODE)
259+
# Format the error code as a hexadecimal string
260+
$hexErrorCode = [Convert]::ToString($unsignedExitCode, 16).ToUpper()
261+
Write-Output "error 0x$hexErrorCode"
262+
exit $LASTEXITCODE
263+
}
264+
}
265+
}
266+
194267
gpu:
195268
name: GPU Ubuntu
196269
# run only on upstream; forks will not have the HW
@@ -201,6 +274,38 @@ jobs:
201274
runs-on: ["DSS-${{matrix.provider}}", "DSS-UBUNTU"]
202275

203276
steps:
277+
- name: Checkout latest UMF version
278+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
279+
with:
280+
fetch-depth: 0
281+
path: ${{github.workspace}}/latest_version
282+
283+
- name: Configure latest UMF build
284+
working-directory: ${{github.workspace}}/latest_version
285+
run: >
286+
cmake
287+
-B ${{github.workspace}}/latest_version/build
288+
-DCMAKE_INSTALL_PREFIX=_install
289+
-DCMAKE_BUILD_TYPE=Debug
290+
-DUMF_BUILD_SHARED_LIBRARY=ON
291+
-DCMAKE_C_COMPILER=gcc
292+
-DCMAKE_CXX_COMPILER=g++
293+
-DUMF_BUILD_TESTS=OFF
294+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
295+
-DUMF_BUILD_CUDA_PROVIDER=ON
296+
-DUMF_FORMAT_CODE_STYLE=OFF
297+
-DUMF_DEVELOPER_MODE=ON
298+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
299+
300+
- name: Build latest UMF
301+
working-directory: ${{github.workspace}}/latest_version
302+
run: |
303+
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
304+
305+
- name: Install latest UMF
306+
working-directory: ${{github.workspace}}/latest_version
307+
run: cmake --install ${{github.workspace}}/latest_version/build --config Debug
308+
204309
- name: Checkout "tag" UMF version
205310
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
206311
with:
@@ -242,33 +347,6 @@ jobs:
242347
GTEST_FILTER="-*umfIpcTest.GetPoolByOpenedHandle*"
243348
ctest --output-on-failure
244349
245-
- name: Checkout latest UMF version
246-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
247-
with:
248-
fetch-depth: 0
249-
path: ${{github.workspace}}/latest_version
250-
251-
- name: Configure latest UMF build
252-
working-directory: ${{github.workspace}}/latest_version
253-
run: >
254-
cmake
255-
-B ${{github.workspace}}/latest_version/build
256-
-DCMAKE_BUILD_TYPE=Debug
257-
-DUMF_BUILD_SHARED_LIBRARY=ON
258-
-DCMAKE_C_COMPILER=gcc
259-
-DCMAKE_CXX_COMPILER=g++
260-
-DUMF_BUILD_TESTS=OFF
261-
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
262-
-DUMF_BUILD_CUDA_PROVIDER=ON
263-
-DUMF_FORMAT_CODE_STYLE=OFF
264-
-DUMF_DEVELOPER_MODE=ON
265-
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
266-
267-
- name: Build latest UMF
268-
working-directory: ${{github.workspace}}/latest_version
269-
run: |
270-
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
271-
272350
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
273351
working-directory: ${{github.workspace}}/tag_version/build
274352
# Disable incompatible tests:
@@ -280,3 +358,27 @@ jobs:
280358
LD_LIBRARY_PATH=${{github.workspace}}/latest_version/build/lib/
281359
GTEST_FILTER="-*umfIpcTest.GetPoolByOpenedHandle*"
282360
ctest --verbose -E "not_impl|umf-mempolicy"
361+
362+
# Browse all folders in the examples directory, build them using the
363+
# latest UMF version, and run them, excluding those in the exclude list.
364+
# NOTE: exclude cuda examples as they require linking with static disjoint
365+
# pool library
366+
- name: Build and run "tag" examples using the latest UMF libraries
367+
working-directory: ${{github.workspace}}/tag_version
368+
run: |
369+
EXAMPLES_EXCLUDE_LIST="cmake|common|hmat|cuda${{matrix.provider == 'LEVEL_ZERO' && '' || '|level_zero' }}"
370+
rm -rf build
371+
rm -rf include
372+
mkdir _examples
373+
cd _examples
374+
EXAMPLES_LIST=$(find ${{github.workspace}}/tag_version/examples -maxdepth 1 -mindepth 1 -type d | grep -Ev $EXAMPLES_EXCLUDE_LIST | xargs -n 1 basename)
375+
for EXAMPLE_NAME in $EXAMPLES_LIST; do
376+
cd ${{github.workspace}}/tag_version
377+
mkdir -p _examples/$EXAMPLE_NAME;
378+
cd _examples/$EXAMPLE_NAME;
379+
CMAKE_PREFIX_PATH=${{github.workspace}}/latest_version/_install cmake ${{github.workspace}}/tag_version/examples/$EXAMPLE_NAME;
380+
make;
381+
find . -maxdepth 1 -type f -executable -exec {} \;
382+
done
383+
384+
# TODO add GPU windows

0 commit comments

Comments
 (0)