Skip to content

Commit 64b3e5d

Browse files
author
Olivier Chafik
committed
Parallel cmake builds & ctests
1 parent 5783575 commit 64b3e5d

File tree

1 file changed

+36
-50
lines changed

1 file changed

+36
-50
lines changed

.github/workflows/build.yml

Lines changed: 36 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@ jobs:
6868
-DGGML_METAL_USE_BF16=ON \
6969
-DGGML_METAL_EMBED_LIBRARY=ON \
7070
-DGGML_RPC=ON
71-
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
71+
cmake --parallel --build . --config Release -j $(sysctl -n hw.logicalcpu)
7272
7373
- name: Test
7474
id: cmake_test
75-
run: |
76-
cd build
77-
ctest -L 'main|curl' --verbose --timeout 900
75+
run: ctest --parallel --test-dir build -L 'main|curl' --verbose --timeout 900
7876

7977
- name: Determine tag name
8078
id: tag
@@ -138,13 +136,11 @@ jobs:
138136
-DLLAMA_CURL=ON \
139137
-DGGML_METAL=OFF \
140138
-DGGML_RPC=ON
141-
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
139+
cmake --parallel --build build --config Release -j $(sysctl -n hw.logicalcpu)
142140
143141
- name: Test
144142
id: cmake_test
145-
run: |
146-
cd build
147-
ctest -L main --verbose --timeout 900
143+
run: ctest --parallel --test-dir build -L main --verbose --timeout 900
148144

149145
- name: Determine tag name
150146
id: tag
@@ -205,13 +201,11 @@ jobs:
205201
-DLLAMA_FATAL_WARNINGS=ON \
206202
-DLLAMA_CURL=ON \
207203
-DGGML_RPC=ON
208-
cmake --build . --config Release -j $(nproc)
204+
cmake --parallel --build . --config Release -j $(nproc)
209205
210206
- name: Test
211207
id: cmake_test
212-
run: |
213-
cd build
214-
ctest -L 'main|curl' --verbose --timeout 900
208+
run: ctest --parallel --test-dir build -L 'main|curl' --verbose --timeout 900
215209

216210
- name: Test llama2c conversion
217211
id: llama2c_test
@@ -289,7 +283,7 @@ jobs:
289283
-DLLAMA_FATAL_WARNINGS=ON \
290284
-DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
291285
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
292-
cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
286+
cmake --parallel --build . --config ${{ matrix.build_type }} -j $(nproc)
293287
294288
- name: Build (no OpenMP)
295289
id: cmake_build_no_openmp
@@ -302,13 +296,11 @@ jobs:
302296
-DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
303297
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
304298
-DGGML_OPENMP=OFF
305-
cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
299+
cmake --parallel --build . --config ${{ matrix.build_type }} -j $(nproc)
306300
307301
- name: Test
308302
id: cmake_test
309-
run: |
310-
cd build
311-
ctest -L main --verbose --timeout 900
303+
run: ctest --parallel --test-dir build -L main --verbose --timeout 900
312304

313305
ubuntu-latest-cmake-rpc:
314306
runs-on: ubuntu-latest
@@ -339,13 +331,11 @@ jobs:
339331
cd build
340332
cmake .. \
341333
-DGGML_RPC=ON
342-
cmake --build . --config Release -j $(nproc)
334+
cmake --parallel --build . --config Release -j $(nproc)
343335
344336
- name: Test
345337
id: cmake_test
346-
run: |
347-
cd build
348-
ctest -L main --verbose
338+
run: ctest --parallel --test-dir build -L main --verbose
349339

350340
ubuntu-22-cmake-vulkan:
351341
runs-on: ubuntu-22.04
@@ -376,14 +366,12 @@ jobs:
376366
cd build
377367
cmake .. \
378368
-DGGML_VULKAN=ON
379-
cmake --build . --config Release -j $(nproc)
369+
cmake --parallel --build . --config Release -j $(nproc)
380370
381371
- name: Test
382372
id: cmake_test
383-
run: |
384-
cd build
385-
# This is using llvmpipe and runs slower than other backends
386-
ctest -L main --verbose --timeout 1800
373+
# This is using llvmpipe and runs slower than other backends
374+
run: ctest --parallel --test-dir build -L main --verbose --timeout 1800
387375

388376
ubuntu-22-cmake-hip:
389377
runs-on: ubuntu-22.04
@@ -412,7 +400,7 @@ jobs:
412400
cmake -B build -S . \
413401
-DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
414402
-DGGML_HIP=ON
415-
cmake --build build --config Release -j $(nproc)
403+
cmake --parallel --build build --config Release -j $(nproc)
416404
417405
- name: Build with legacy HIP support
418406
id: cmake_build_legacy_hip
@@ -421,7 +409,7 @@ jobs:
421409
-DCMAKE_C_COMPILER=hipcc \
422410
-DCMAKE_CXX_COMPILER=hipcc \
423411
-DGGML_HIP=ON
424-
cmake --build build2 --config Release -j $(nproc)
412+
cmake --parallel --build build2 --config Release -j $(nproc)
425413
426414
ubuntu-22-cmake-musa:
427415
runs-on: ubuntu-22.04
@@ -449,7 +437,7 @@ jobs:
449437
run: |
450438
cmake -B build -S . \
451439
-DGGML_MUSA=ON
452-
cmake --build build --config Release -j $(nproc)
440+
cmake --parallel --build build --config Release -j $(nproc)
453441
454442
ubuntu-22-cmake-sycl:
455443
runs-on: ubuntu-22.04
@@ -499,7 +487,7 @@ jobs:
499487
-DGGML_SYCL=ON \
500488
-DCMAKE_C_COMPILER=icx \
501489
-DCMAKE_CXX_COMPILER=icpx
502-
cmake --build . --config Release -j $(nproc)
490+
cmake --parallel --build . --config Release -j $(nproc)
503491
504492
ubuntu-22-cmake-sycl-fp16:
505493
runs-on: ubuntu-22.04
@@ -550,7 +538,7 @@ jobs:
550538
-DCMAKE_C_COMPILER=icx \
551539
-DCMAKE_CXX_COMPILER=icpx \
552540
-DGGML_SYCL_F16=ON
553-
cmake --build . --config Release -j $(nproc)
541+
cmake --parallel --build . --config Release -j $(nproc)
554542
555543
macOS-latest-cmake-ios:
556544
runs-on: macos-latest
@@ -587,7 +575,7 @@ jobs:
587575
-DCMAKE_SYSTEM_NAME=iOS \
588576
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
589577
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
590-
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
578+
cmake --parallel --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
591579
592580
macOS-latest-cmake-tvos:
593581
runs-on: macos-latest
@@ -624,7 +612,7 @@ jobs:
624612
-DCMAKE_SYSTEM_NAME=tvOS \
625613
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
626614
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
627-
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
615+
cmake --parallel --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
628616
629617
macOS-latest-swift:
630618
runs-on: macos-latest
@@ -663,7 +651,7 @@ jobs:
663651
-DLLAMA_BUILD_TESTS=OFF \
664652
-DLLAMA_BUILD_SERVER=OFF \
665653
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
666-
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
654+
cmake --parallel --build . --config Release -j $(sysctl -n hw.logicalcpu)
667655
sudo cmake --install . --config Release
668656
669657
- name: xcodebuild for swift package
@@ -707,7 +695,7 @@ jobs:
707695
shell: msys2 {0}
708696
run: |
709697
cmake -B build
710-
cmake --build build --config ${{ matrix.build }} -j $(nproc)
698+
cmake --parallel --build build --config ${{ matrix.build }} -j $(nproc)
711699
712700
- name: Clean after building using CMake
713701
shell: msys2 {0}
@@ -718,7 +706,7 @@ jobs:
718706
shell: msys2 {0}
719707
run: |
720708
cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
721-
cmake --build build --config ${{ matrix.build }} -j $(nproc)
709+
cmake --parallel --build build --config ${{ matrix.build }} -j $(nproc)
722710
723711
windows-latest-cmake:
724712
runs-on: windows-latest
@@ -810,21 +798,21 @@ jobs:
810798
-DOPENCL_HEADERS_BUILD_TESTING=OFF `
811799
-DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
812800
-DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
813-
cmake --build . --target install
801+
cmake --parallel --build . --target install
814802
git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
815803
cd OpenCL-ICD-Loader
816804
mkdir build-arm64-release && cd build-arm64-release
817805
cmake .. `
818806
-A arm64 `
819807
-DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
820808
-DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
821-
cmake --build . --target install --config release
809+
cmake --parallel --build . --target install --config release
822810
823811
- name: Build
824812
id: cmake_build
825813
run: |
826814
cmake -S . -B build ${{ matrix.defines }}
827-
cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
815+
cmake --parallel --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
828816
829817
- name: Add libopenblas.dll
830818
id: add_libopenblas_dll
@@ -850,9 +838,7 @@ jobs:
850838
id: cmake_test
851839
# not all machines have native AVX-512
852840
if: ${{ matrix.build != 'msvc-arm64' && matrix.build != 'llvm-arm64' && matrix.build != 'llvm-arm64-opencl-adreno' && matrix.build != 'kompute-x64' && matrix.build != 'vulkan-x64' && (matrix.build != 'avx512-x64' || env.HAS_AVX512F == '1') }}
853-
run: |
854-
cd build
855-
ctest -L main -C Release --verbose --timeout 900
841+
run: ctest --parallel --test-dir build -L main -C Release --verbose --timeout 900
856842

857843
- name: Test (Intel SDE)
858844
id: cmake_test_sde
@@ -865,7 +851,7 @@ jobs:
865851
$sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
866852
cd build
867853
$env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
868-
& $sde -future -- ctest -L main -C Release --verbose --timeout 900
854+
& $sde -future -- ctest --parallel -L main -C Release --verbose --timeout 900
869855
870856
- name: Determine tag name
871857
id: tag
@@ -928,7 +914,7 @@ jobs:
928914
-DLLAMA_FATAL_WARNINGS=ON \
929915
-DGGML_NATIVE=OFF \
930916
-DGGML_CUDA=ON
931-
cmake --build build
917+
cmake --parallel --build build
932918
933919
windows-2019-cmake-cuda:
934920
runs-on: windows-2019
@@ -1023,8 +1009,8 @@ jobs:
10231009
-DGGML_CUDA=ON ^
10241010
-DGGML_RPC=ON
10251011
set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
1026-
cmake --build build --config Release -j %NINJA_JOBS% -t ggml
1027-
cmake --build build --config Release
1012+
cmake --parallel --build build --config Release -j %NINJA_JOBS% -t ggml
1013+
cmake --parallel --build build --config Release
10281014
10291015
- name: Determine tag name
10301016
id: tag
@@ -1187,7 +1173,7 @@ jobs:
11871173
-DCMAKE_BUILD_TYPE=Release `
11881174
-DGGML_HIP=ON `
11891175
-DGGML_RPC=ON
1190-
cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
1176+
cmake --parallel --build build -j ${env:NUMBER_OF_PROCESSORS}
11911177
11921178
windows-latest-cmake-hip-release:
11931179
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
@@ -1237,7 +1223,7 @@ jobs:
12371223
-DAMDGPU_TARGETS=${{ matrix.gpu_target }} `
12381224
-DGGML_HIP=ON `
12391225
-DGGML_RPC=ON
1240-
cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
1226+
cmake --parallel --build build -j ${env:NUMBER_OF_PROCESSORS}
12411227
md "build\bin\rocblas\library\"
12421228
cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
12431229
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
@@ -1289,7 +1275,7 @@ jobs:
12891275
-DCMAKE_SYSTEM_NAME=iOS \
12901276
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
12911277
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
1292-
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
1278+
cmake --parallel --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
12931279
sudo cmake --install . --config Release
12941280
12951281
- name: xcodebuild for swift package
@@ -1634,4 +1620,4 @@ jobs:
16341620
-DCMAKE_BUILD_TYPE=${{ matrix.build }} \
16351621
-DGGML_CANN=on \
16361622
-DSOC_TYPE=${{ matrix.device }}
1637-
cmake --build build -j $(nproc)
1623+
cmake --parallel --build build -j $(nproc)

0 commit comments

Comments
 (0)