build.yml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209
  1. name: CI
  2. on:
  3. workflow_dispatch: # allows manual triggering
  4. push:
  5. branches:
  6. - master
  7. paths: [
  8. '.github/workflows/build.yml',
  9. '.github/workflows/build-linux-cross.yml',
  10. '.github/workflows/build-cmake-pkg.yml',
  11. '**/CMakeLists.txt',
  12. '**/.cmake',
  13. '**/*.h',
  14. '**/*.hpp',
  15. '**/*.c',
  16. '**/*.cpp',
  17. '**/*.cu',
  18. '**/*.cuh',
  19. '**/*.swift',
  20. '**/*.m',
  21. '**/*.metal',
  22. '**/*.comp'
  23. ]
  24. pull_request:
  25. types: [opened, synchronize, reopened]
  26. paths: [
  27. '.github/workflows/build.yml',
  28. '.github/workflows/build-linux-cross.yml',
  29. '.github/workflows/build-cmake-pkg.yml',
  30. '**/CMakeLists.txt',
  31. '**/.cmake',
  32. '**/*.h',
  33. '**/*.hpp',
  34. '**/*.c',
  35. '**/*.cpp',
  36. '**/*.cu',
  37. '**/*.cuh',
  38. '**/*.swift',
  39. '**/*.m',
  40. '**/*.metal',
  41. '**/*.comp'
  42. ]
  43. concurrency:
  44. group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  45. cancel-in-progress: true
  46. env:
  47. GGML_NLOOP: 3
  48. GGML_N_THREADS: 1
  49. LLAMA_LOG_COLORS: 1
  50. LLAMA_LOG_PREFIX: 1
  51. LLAMA_LOG_TIMESTAMPS: 1
  52. jobs:
  53. macOS-latest-cmake-arm64:
  54. runs-on: macos-14
  55. steps:
  56. - name: Clone
  57. id: checkout
  58. uses: actions/checkout@v4
  59. - name: ccache
  60. uses: ggml-org/ccache-action@v1.2.16
  61. with:
  62. key: macOS-latest-cmake-arm64
  63. evict-old-files: 1d
  64. - name: Dependencies
  65. id: depends
  66. continue-on-error: true
  67. run: |
  68. brew update
  69. brew install curl
  70. - name: Build
  71. id: cmake_build
  72. run: |
  73. sysctl -a
  74. cmake -B build \
  75. -DCMAKE_BUILD_RPATH="@loader_path" \
  76. -DLLAMA_FATAL_WARNINGS=ON \
  77. -DGGML_METAL_USE_BF16=ON \
  78. -DGGML_METAL_EMBED_LIBRARY=OFF \
  79. -DGGML_METAL_SHADER_DEBUG=ON \
  80. -DGGML_RPC=ON
  81. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  82. - name: Test
  83. id: cmake_test
  84. run: |
  85. cd build
  86. ctest -L 'main|curl' --verbose --timeout 900
  87. macOS-latest-cmake-x64:
  88. runs-on: macos-13
  89. steps:
  90. - name: Clone
  91. id: checkout
  92. uses: actions/checkout@v4
  93. - name: ccache
  94. uses: ggml-org/ccache-action@v1.2.16
  95. with:
  96. key: macOS-latest-cmake-x64
  97. evict-old-files: 1d
  98. - name: Dependencies
  99. id: depends
  100. continue-on-error: true
  101. run: |
  102. brew update
  103. brew install curl
  104. - name: Build
  105. id: cmake_build
  106. run: |
  107. sysctl -a
  108. # Metal is disabled due to intermittent failures with Github runners not having a GPU:
  109. # https://github.com/ggml-org/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
  110. cmake -B build \
  111. -DCMAKE_BUILD_RPATH="@loader_path" \
  112. -DLLAMA_FATAL_WARNINGS=ON \
  113. -DGGML_METAL=OFF \
  114. -DGGML_RPC=ON
  115. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  116. - name: Test
  117. id: cmake_test
  118. run: |
  119. cd build
  120. ctest -L main --verbose --timeout 900
  121. macOS-latest-cmake-arm64-webgpu:
  122. runs-on: macos-14
  123. steps:
  124. - name: Clone
  125. id: checkout
  126. uses: actions/checkout@v4
  127. - name: ccache
  128. uses: ggml-org/ccache-action@v1.2.16
  129. with:
  130. key: macOS-latest-cmake-arm64-webgpu
  131. evict-old-files: 1d
  132. - name: Dependencies
  133. id: depends
  134. continue-on-error: true
  135. run: |
  136. brew update
  137. brew install curl
  138. - name: Dawn Dependency
  139. id: dawn-depends
  140. run: |
  141. DAWN_VERSION="v1.0.0"
  142. DAWN_OWNER="reeselevine"
  143. DAWN_REPO="dawn"
  144. DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-macos-latest-Release.tar.gz"
  145. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  146. curl -L -o artifact.tar.gz \
  147. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  148. mkdir dawn
  149. tar -xvf artifact.tar.gz -C dawn --strip-components=1
  150. - name: Build
  151. id: cmake_build
  152. run: |
  153. export CMAKE_PREFIX_PATH=dawn
  154. cmake -B build -DGGML_WEBGPU=ON -DGGML_METAL=OFF -DGGML_BLAS=OFF
  155. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  156. - name: Test
  157. id: cmake_test
  158. run: |
  159. cd build
  160. ctest -L main --verbose --timeout 900
  161. ubuntu-cpu-cmake:
  162. strategy:
  163. matrix:
  164. include:
  165. - build: 'x64'
  166. os: ubuntu-22.04
  167. - build: 'arm64'
  168. os: ubuntu-22.04-arm
  169. runs-on: ${{ matrix.os }}
  170. steps:
  171. - name: Clone
  172. id: checkout
  173. uses: actions/checkout@v4
  174. - name: ccache
  175. uses: ggml-org/ccache-action@v1.2.16
  176. with:
  177. key: ubuntu-cpu-cmake
  178. evict-old-files: 1d
  179. - name: Dependencies
  180. id: depends
  181. run: |
  182. sudo apt-get update
  183. sudo apt-get install build-essential libcurl4-openssl-dev
  184. - name: Build
  185. id: cmake_build
  186. run: |
  187. cmake -B build \
  188. -DLLAMA_FATAL_WARNINGS=ON \
  189. -DGGML_RPC=ON
  190. cmake --build build --config Release -j $(nproc)
  191. - name: Test
  192. id: cmake_test
  193. run: |
  194. cd build
  195. ctest -L 'main|curl' --verbose --timeout 900
  196. - name: Test llama2c conversion
  197. id: llama2c_test
  198. run: |
  199. cd build
  200. echo "Fetch tokenizer"
  201. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  202. echo "Fetch llama2c model"
  203. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  204. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  205. ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  206. ubuntu-latest-cmake-sanitizer:
  207. runs-on: ubuntu-latest
  208. continue-on-error: true
  209. strategy:
  210. matrix:
  211. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  212. build_type: [Debug]
  213. steps:
  214. - name: Clone
  215. id: checkout
  216. uses: actions/checkout@v4
  217. - name: ccache
  218. uses: ggml-org/ccache-action@v1.2.16
  219. with:
  220. key: ubuntu-latest-cmake-sanitizer-${{ matrix.sanitizer }}
  221. evict-old-files: 1d
  222. - name: Dependencies
  223. id: depends
  224. run: |
  225. sudo apt-get update
  226. sudo apt-get install build-essential libcurl4-openssl-dev
  227. - name: Build
  228. id: cmake_build
  229. if: ${{ matrix.sanitizer != 'THREAD' }}
  230. run: |
  231. cmake -B build \
  232. -DLLAMA_FATAL_WARNINGS=ON \
  233. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  234. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
  235. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  236. - name: Build (no OpenMP)
  237. id: cmake_build_no_openmp
  238. if: ${{ matrix.sanitizer == 'THREAD' }}
  239. run: |
  240. cmake -B build \
  241. -DLLAMA_FATAL_WARNINGS=ON \
  242. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  243. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  244. -DGGML_OPENMP=OFF
  245. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  246. - name: Test
  247. id: cmake_test
  248. run: |
  249. cd build
  250. ctest -L main --verbose --timeout 900
  251. ubuntu-latest-llguidance:
  252. runs-on: ubuntu-latest
  253. steps:
  254. - name: Clone
  255. id: checkout
  256. uses: actions/checkout@v4
  257. - name: Dependencies
  258. id: depends
  259. run: |
  260. sudo apt-get update
  261. sudo apt-get install build-essential libcurl4-openssl-dev
  262. - name: Build
  263. id: cmake_build
  264. run: |
  265. mkdir build
  266. cd build
  267. cmake .. \
  268. -DLLAMA_FATAL_WARNINGS=ON \
  269. -DLLAMA_LLGUIDANCE=ON
  270. cmake --build . --config Release -j $(nproc)
  271. - name: Test
  272. id: cmake_test
  273. run: |
  274. cd build
  275. ctest -L main --verbose --timeout 900
  276. ubuntu-latest-cmake-rpc:
  277. runs-on: ubuntu-latest
  278. continue-on-error: true
  279. steps:
  280. - name: Clone
  281. id: checkout
  282. uses: actions/checkout@v4
  283. - name: ccache
  284. uses: ggml-org/ccache-action@v1.2.16
  285. with:
  286. key: ubuntu-latest-cmake-rpc
  287. evict-old-files: 1d
  288. - name: Dependencies
  289. id: depends
  290. run: |
  291. sudo apt-get update
  292. sudo apt-get install build-essential libcurl4-openssl-dev
  293. - name: Build
  294. id: cmake_build
  295. run: |
  296. cmake -B build \
  297. -DGGML_RPC=ON
  298. cmake --build build --config Release -j $(nproc)
  299. - name: Test
  300. id: cmake_test
  301. run: |
  302. cd build
  303. ctest -L main --verbose
  304. ubuntu-22-cmake-vulkan:
  305. runs-on: ubuntu-22.04
  306. steps:
  307. - name: Clone
  308. id: checkout
  309. uses: actions/checkout@v4
  310. - name: ccache
  311. uses: ggml-org/ccache-action@v1.2.16
  312. with:
  313. key: ubuntu-22-cmake-vulkan
  314. evict-old-files: 1d
  315. - name: Dependencies
  316. id: depends
  317. run: |
  318. wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
  319. sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
  320. sudo apt-get update -y
  321. sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk libcurl4-openssl-dev
  322. - name: Build
  323. id: cmake_build
  324. run: |
  325. cmake -B build \
  326. -DGGML_VULKAN=ON
  327. cmake --build build --config Release -j $(nproc)
  328. - name: Test
  329. id: cmake_test
  330. run: |
  331. cd build
  332. export GGML_VK_VISIBLE_DEVICES=0
  333. # This is using llvmpipe and runs slower than other backends
  334. ctest -L main --verbose --timeout 4200
  335. ubuntu-22-cmake-webgpu:
  336. runs-on: ubuntu-22.04
  337. steps:
  338. - name: Clone
  339. id: checkout
  340. uses: actions/checkout@v4
  341. - name: ccache
  342. uses: ggml-org/ccache-action@v1.2.16
  343. with:
  344. key: ubuntu-22-cmake-webgpu
  345. evict-old-files: 1d
  346. - name: Vulkan SDK Dependencies
  347. id: vulkan-depends
  348. run: |
  349. wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
  350. sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
  351. sudo apt-get update -y
  352. sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk libcurl4-openssl-dev
  353. - name: Dawn Dependency
  354. id: dawn-depends
  355. run: |
  356. sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev libxi-dev
  357. DAWN_VERSION="v1.0.0"
  358. DAWN_OWNER="reeselevine"
  359. DAWN_REPO="dawn"
  360. DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-ubuntu-latest-Release.tar.gz"
  361. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  362. curl -L -o artifact.tar.gz \
  363. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  364. mkdir dawn
  365. tar -xvf artifact.tar.gz -C dawn --strip-components=1
  366. - name: Build
  367. id: cmake_build
  368. run: |
  369. export Dawn_DIR=dawn/lib64/cmake/Dawn
  370. cmake -B build -DGGML_WEBGPU=ON
  371. cmake --build build --config Release -j $(nproc)
  372. - name: Test
  373. id: cmake_test
  374. run: |
  375. cd build
  376. # This is using llvmpipe and runs slower than other backends
  377. ctest -L main --verbose --timeout 3600
  378. ubuntu-22-cmake-hip:
  379. runs-on: ubuntu-22.04
  380. container: rocm/dev-ubuntu-22.04:6.1.2
  381. steps:
  382. - name: Clone
  383. id: checkout
  384. uses: actions/checkout@v4
  385. - name: Dependencies
  386. id: depends
  387. run: |
  388. sudo apt-get update
  389. sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev libcurl4-openssl-dev
  390. - name: ccache
  391. uses: ggml-org/ccache-action@v1.2.16
  392. with:
  393. key: ubuntu-22-cmake-hip
  394. evict-old-files: 1d
  395. - name: Build with native CMake HIP support
  396. id: cmake_build
  397. run: |
  398. cmake -B build -S . \
  399. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
  400. -DGGML_HIP_ROCWMMA_FATTN=ON \
  401. -DGGML_HIP=ON
  402. cmake --build build --config Release -j $(nproc)
  403. ubuntu-22-cmake-musa:
  404. runs-on: ubuntu-22.04
  405. container: mthreads/musa:rc4.2.0-devel-ubuntu22.04-amd64
  406. steps:
  407. - name: Clone
  408. id: checkout
  409. uses: actions/checkout@v4
  410. - name: Dependencies
  411. id: depends
  412. run: |
  413. apt-get update
  414. apt-get install -y build-essential git cmake libcurl4-openssl-dev
  415. - name: ccache
  416. uses: ggml-org/ccache-action@v1.2.16
  417. with:
  418. key: ubuntu-22-cmake-musa
  419. evict-old-files: 1d
  420. - name: Build with native CMake MUSA support
  421. id: cmake_build
  422. run: |
  423. cmake -B build -S . \
  424. -DGGML_MUSA=ON
  425. cmake --build build --config Release -j $(nproc)
  426. ubuntu-22-cmake-sycl:
  427. runs-on: ubuntu-22.04
  428. continue-on-error: true
  429. steps:
  430. - uses: actions/checkout@v4
  431. - name: add oneAPI to apt
  432. shell: bash
  433. run: |
  434. cd /tmp
  435. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  436. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  437. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  438. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  439. - name: install oneAPI dpcpp compiler
  440. shell: bash
  441. run: |
  442. sudo apt update
  443. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  444. - name: install oneAPI MKL library
  445. shell: bash
  446. run: |
  447. sudo apt install intel-oneapi-mkl-devel
  448. - name: Clone
  449. id: checkout
  450. uses: actions/checkout@v4
  451. - name: ccache
  452. uses: ggml-org/ccache-action@v1.2.16
  453. with:
  454. key: ubuntu-22-cmake-sycl
  455. evict-old-files: 1d
  456. - name: Build
  457. id: cmake_build
  458. run: |
  459. source /opt/intel/oneapi/setvars.sh
  460. cmake -B build \
  461. -DGGML_SYCL=ON \
  462. -DCMAKE_C_COMPILER=icx \
  463. -DCMAKE_CXX_COMPILER=icpx
  464. cmake --build build --config Release -j $(nproc)
  465. ubuntu-22-cmake-sycl-fp16:
  466. runs-on: ubuntu-22.04
  467. continue-on-error: true
  468. steps:
  469. - uses: actions/checkout@v4
  470. - name: add oneAPI to apt
  471. shell: bash
  472. run: |
  473. cd /tmp
  474. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  475. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  476. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  477. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  478. - name: install oneAPI dpcpp compiler
  479. shell: bash
  480. run: |
  481. sudo apt update
  482. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  483. - name: install oneAPI MKL library
  484. shell: bash
  485. run: |
  486. sudo apt install intel-oneapi-mkl-devel
  487. - name: Clone
  488. id: checkout
  489. uses: actions/checkout@v4
  490. - name: ccache
  491. uses: ggml-org/ccache-action@v1.2.16
  492. with:
  493. key: ubuntu-22-cmake-sycl-fp16
  494. evict-old-files: 1d
  495. - name: Build
  496. id: cmake_build
  497. run: |
  498. source /opt/intel/oneapi/setvars.sh
  499. cmake -B build \
  500. -DGGML_SYCL=ON \
  501. -DCMAKE_C_COMPILER=icx \
  502. -DCMAKE_CXX_COMPILER=icpx \
  503. -DGGML_SYCL_F16=ON
  504. cmake --build build --config Release -j $(nproc)
  505. build-linux-cross:
  506. uses: ./.github/workflows/build-linux-cross.yml
  507. build-cmake-pkg:
  508. uses: ./.github/workflows/build-cmake-pkg.yml
  509. macOS-latest-cmake-ios:
  510. runs-on: macos-latest
  511. steps:
  512. - name: Clone
  513. id: checkout
  514. uses: actions/checkout@v4
  515. - name: ccache
  516. uses: ggml-org/ccache-action@v1.2.16
  517. with:
  518. key: macOS-latest-cmake-ios
  519. evict-old-files: 1d
  520. - name: Dependencies
  521. id: depends
  522. continue-on-error: true
  523. run: |
  524. brew update
  525. - name: Build
  526. id: cmake_build
  527. run: |
  528. sysctl -a
  529. cmake -B build -G Xcode \
  530. -DGGML_METAL_USE_BF16=ON \
  531. -DGGML_METAL_EMBED_LIBRARY=ON \
  532. -DLLAMA_BUILD_COMMON=OFF \
  533. -DLLAMA_BUILD_EXAMPLES=OFF \
  534. -DLLAMA_BUILD_TOOLS=OFF \
  535. -DLLAMA_BUILD_TESTS=OFF \
  536. -DLLAMA_BUILD_SERVER=OFF \
  537. -DCMAKE_SYSTEM_NAME=iOS \
  538. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  539. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  540. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  541. macOS-latest-cmake-tvos:
  542. runs-on: macos-latest
  543. steps:
  544. - name: Clone
  545. id: checkout
  546. uses: actions/checkout@v4
  547. - name: ccache
  548. uses: ggml-org/ccache-action@v1.2.16
  549. with:
  550. key: macOS-latest-cmake-tvos
  551. evict-old-files: 1d
  552. - name: Dependencies
  553. id: depends
  554. continue-on-error: true
  555. run: |
  556. brew update
  557. - name: Build
  558. id: cmake_build
  559. run: |
  560. sysctl -a
  561. cmake -B build -G Xcode \
  562. -DGGML_METAL_USE_BF16=ON \
  563. -DGGML_METAL_EMBED_LIBRARY=ON \
  564. -DLLAMA_BUILD_COMMON=OFF \
  565. -DLLAMA_BUILD_EXAMPLES=OFF \
  566. -DLLAMA_BUILD_TOOLS=OFF \
  567. -DLLAMA_BUILD_TESTS=OFF \
  568. -DLLAMA_BUILD_SERVER=OFF \
  569. -DCMAKE_SYSTEM_NAME=tvOS \
  570. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  571. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  572. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  573. macOS-latest-cmake-visionos:
  574. runs-on: macos-latest
  575. steps:
  576. - name: Clone
  577. id: checkout
  578. uses: actions/checkout@v4
  579. - name: Dependencies
  580. id: depends
  581. continue-on-error: true
  582. run: |
  583. brew update
  584. - name: Build
  585. id: cmake_build
  586. run: |
  587. sysctl -a
  588. cmake -B build -G Xcode \
  589. -DGGML_METAL_USE_BF16=ON \
  590. -DGGML_METAL_EMBED_LIBRARY=ON \
  591. -DLLAMA_BUILD_COMMON=OFF \
  592. -DLLAMA_BUILD_EXAMPLES=OFF \
  593. -DLLAMA_BUILD_TOOLS=OFF \
  594. -DLLAMA_BUILD_TESTS=OFF \
  595. -DLLAMA_BUILD_SERVER=OFF \
  596. -DCMAKE_SYSTEM_NAME=visionOS \
  597. -DCMAKE_OSX_DEPLOYMENT_TARGET=1.0 \
  598. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  599. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  600. macOS-latest-swift:
  601. runs-on: macos-latest
  602. strategy:
  603. matrix:
  604. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  605. steps:
  606. - name: Clone
  607. id: checkout
  608. uses: actions/checkout@v4
  609. - name: ccache
  610. uses: ggml-org/ccache-action@v1.2.16
  611. with:
  612. key: macOS-latest-swift
  613. evict-old-files: 1d
  614. - name: Dependencies
  615. id: depends
  616. continue-on-error: true
  617. run: |
  618. brew update
  619. - name: Build llama.cpp with CMake
  620. id: cmake_build
  621. run: |
  622. sysctl -a
  623. cmake -B build -G Xcode \
  624. -DGGML_METAL_USE_BF16=ON \
  625. -DGGML_METAL_EMBED_LIBRARY=ON \
  626. -DLLAMA_CURL=OFF \
  627. -DLLAMA_BUILD_EXAMPLES=OFF \
  628. -DLLAMA_BUILD_TOOLS=OFF \
  629. -DLLAMA_BUILD_TESTS=OFF \
  630. -DLLAMA_BUILD_SERVER=OFF \
  631. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
  632. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  633. - name: xcodebuild for swift package
  634. id: xcodebuild
  635. run: |
  636. ./build-xcframework.sh
  637. windows-msys2:
  638. runs-on: windows-2025
  639. strategy:
  640. fail-fast: false
  641. matrix:
  642. include:
  643. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  644. - { sys: CLANG64, env: clang-x86_64, build: Release }
  645. steps:
  646. - name: Clone
  647. uses: actions/checkout@v4
  648. - name: ccache
  649. uses: ggml-org/ccache-action@v1.2.16
  650. with:
  651. key: windows-msys2
  652. variant: ccache
  653. evict-old-files: 1d
  654. - name: Setup ${{ matrix.sys }}
  655. uses: msys2/setup-msys2@v2
  656. with:
  657. update: true
  658. msystem: ${{matrix.sys}}
  659. install: >-
  660. base-devel
  661. git
  662. mingw-w64-${{matrix.env}}-toolchain
  663. mingw-w64-${{matrix.env}}-cmake
  664. mingw-w64-${{matrix.env}}-openblas
  665. - name: Build using CMake
  666. shell: msys2 {0}
  667. run: |
  668. cmake -B build
  669. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  670. - name: Clean after building using CMake
  671. shell: msys2 {0}
  672. run: |
  673. rm -rf build
  674. - name: Build using CMake w/ OpenBLAS
  675. shell: msys2 {0}
  676. run: |
  677. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  678. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  679. windows-latest-cmake:
  680. runs-on: windows-2025
  681. env:
  682. OPENBLAS_VERSION: 0.3.23
  683. SDE_VERSION: 9.33.0-2024-01-07
  684. VULKAN_VERSION: 1.4.313.2
  685. strategy:
  686. matrix:
  687. include:
  688. - build: 'cpu-x64 (static)'
  689. arch: 'x64'
  690. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DBUILD_SHARED_LIBS=OFF'
  691. - build: 'openblas-x64'
  692. arch: 'x64'
  693. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_OPENMP=OFF -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'
  694. - build: 'vulkan-x64'
  695. arch: 'x64'
  696. defines: '-DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON'
  697. - build: 'llvm-arm64'
  698. arch: 'arm64'
  699. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  700. - build: 'llvm-arm64-opencl-adreno'
  701. arch: 'arm64'
  702. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" -DGGML_OPENCL=ON -DGGML_OPENCL_USE_ADRENO_KERNELS=ON'
  703. steps:
  704. - name: Clone
  705. id: checkout
  706. uses: actions/checkout@v4
  707. - name: ccache
  708. uses: ggml-org/ccache-action@v1.2.16
  709. with:
  710. key: windows-latest-cmake-${{ matrix.build }}
  711. variant: ccache
  712. evict-old-files: 1d
  713. - name: Download OpenBLAS
  714. id: get_openblas
  715. if: ${{ matrix.build == 'openblas-x64' }}
  716. run: |
  717. curl.exe -o $env:RUNNER_TEMP/openblas.zip -L "https://github.com/xianyi/OpenBLAS/releases/download/v${env:OPENBLAS_VERSION}/OpenBLAS-${env:OPENBLAS_VERSION}-x64.zip"
  718. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  719. mkdir $env:RUNNER_TEMP/openblas
  720. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  721. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  722. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  723. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  724. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  725. - name: Install Vulkan SDK
  726. id: get_vulkan
  727. if: ${{ matrix.build == 'vulkan-x64' }}
  728. run: |
  729. curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/vulkansdk-windows-X64-${env:VULKAN_VERSION}.exe"
  730. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  731. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  732. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  733. - name: Install Ninja
  734. id: install_ninja
  735. run: |
  736. choco install ninja
  737. - name: Install OpenCL Headers and Libs
  738. id: install_opencl
  739. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  740. run: |
  741. git clone https://github.com/KhronosGroup/OpenCL-Headers
  742. cd OpenCL-Headers
  743. cmake -B build `
  744. -DBUILD_TESTING=OFF `
  745. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  746. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  747. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  748. cmake --build build --target install
  749. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  750. cd OpenCL-ICD-Loader
  751. cmake -B build-arm64-release `
  752. -A arm64 `
  753. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  754. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  755. cmake --build build-arm64-release --target install --config release
  756. - name: libCURL
  757. id: get_libcurl
  758. uses: ./.github/actions/windows-setup-curl
  759. with:
  760. architecture: ${{ matrix.arch == 'x64' && 'win64' || 'win64a' }}
  761. - name: Build
  762. id: cmake_build
  763. env:
  764. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  765. run: |
  766. cmake -S . -B build ${{ matrix.defines }} `
  767. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  768. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  769. cp $env:CURL_PATH/bin/libcurl-*.dll build/bin/Release
  770. - name: Add libopenblas.dll
  771. id: add_libopenblas_dll
  772. if: ${{ matrix.build == 'openblas-x64' }}
  773. run: |
  774. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  775. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  776. - name: Test
  777. id: cmake_test
  778. if: ${{ matrix.arch == 'x64' }}
  779. run: |
  780. cd build
  781. ctest -L main -C Release --verbose --timeout 900
  782. # TODO: disabled for now, consider adding tests for all CPU variants instead
  783. # - name: Test (Intel SDE)
  784. # id: cmake_test_sde
  785. # if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  786. # run: |
  787. # curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  788. # # for some weird reason windows tar doesn't like sde tar.xz
  789. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  790. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  791. # $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  792. # cd build
  793. # $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  794. # & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  795. ubuntu-latest-cmake-cuda:
  796. runs-on: ubuntu-latest
  797. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  798. steps:
  799. - name: Clone
  800. id: checkout
  801. uses: actions/checkout@v4
  802. - name: Install dependencies
  803. env:
  804. DEBIAN_FRONTEND: noninteractive
  805. run: |
  806. apt update
  807. apt install -y cmake build-essential ninja-build libgomp1 git libcurl4-openssl-dev
  808. - name: ccache
  809. uses: ggml-org/ccache-action@v1.2.16
  810. with:
  811. key: ubuntu-latest-cmake-cuda
  812. evict-old-files: 1d
  813. - name: Build with CMake
  814. run: |
  815. cmake -S . -B build -G Ninja \
  816. -DCMAKE_BUILD_TYPE=Release \
  817. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  818. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  819. -DLLAMA_FATAL_WARNINGS=ON \
  820. -DGGML_NATIVE=OFF \
  821. -DGGML_CUDA=ON
  822. cmake --build build
  823. windows-2022-cmake-cuda:
  824. runs-on: windows-2022
  825. strategy:
  826. matrix:
  827. cuda: ['12.4']
  828. steps:
  829. - name: Clone
  830. id: checkout
  831. uses: actions/checkout@v4
  832. - name: Install ccache
  833. uses: ggml-org/ccache-action@v1.2.16
  834. with:
  835. key: windows-cuda-${{ matrix.cuda }}
  836. variant: ccache
  837. evict-old-files: 1d
  838. - name: Install Cuda Toolkit
  839. uses: ./.github/actions/windows-setup-cuda
  840. with:
  841. cuda_version: ${{ matrix.cuda }}
  842. - name: Install Ninja
  843. id: install_ninja
  844. run: |
  845. choco install ninja
  846. - name: libCURL
  847. id: get_libcurl
  848. uses: ./.github/actions/windows-setup-curl
  849. - name: Build
  850. id: cmake_build
  851. shell: cmd
  852. env:
  853. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  854. run: |
  855. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
  856. cmake -S . -B build -G "Ninja Multi-Config" ^
  857. -DLLAMA_BUILD_SERVER=ON ^
  858. -DGGML_NATIVE=OFF ^
  859. -DGGML_BACKEND_DL=ON ^
  860. -DGGML_CPU_ALL_VARIANTS=ON ^
  861. -DGGML_CUDA=ON ^
  862. -DGGML_RPC=ON ^
  863. -DCURL_LIBRARY="%CURL_PATH%/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="%CURL_PATH%/include"
  864. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  865. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  866. cmake --build build --config Release
  867. windows-latest-cmake-sycl:
  868. runs-on: windows-2022
  869. defaults:
  870. run:
  871. shell: bash
  872. env:
  873. WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7cd9bba0-7aab-4e30-b3ae-2221006a4a05/intel-oneapi-base-toolkit-2025.1.1.34_offline.exe
  874. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  875. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  876. steps:
  877. - name: Clone
  878. id: checkout
  879. uses: actions/checkout@v4
  880. - name: ccache
  881. uses: ggml-org/ccache-action@v1.2.16
  882. with:
  883. key: windows-latest-cmake-sycl
  884. variant: ccache
  885. evict-old-files: 1d
  886. - name: Install
  887. run: |
  888. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  889. # TODO: add libcurl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  890. - name: Build
  891. id: cmake_build
  892. run: examples/sycl/win-build-sycl.bat
  893. windows-latest-cmake-hip:
  894. if: ${{ github.event.inputs.create_release != 'true' }}
  895. runs-on: windows-2022
  896. steps:
  897. - name: Clone
  898. id: checkout
  899. uses: actions/checkout@v4
  900. - name: Clone rocWMMA repository
  901. id: clone_rocwmma
  902. run: |
  903. git clone https://github.com/rocm/rocwmma --branch rocm-6.2.4 --depth 1
  904. - name: Install
  905. id: depends
  906. run: |
  907. $ErrorActionPreference = "Stop"
  908. write-host "Downloading AMD HIP SDK Installer"
  909. Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-24.Q3-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"
  910. write-host "Installing AMD HIP SDK"
  911. $proc = Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -PassThru
  912. $proc.WaitForExit(600000)
  913. write-host "Completed AMD HIP SDK installation"
  914. - name: Verify ROCm
  915. id: verify
  916. run: |
  917. & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
  918. - name: Install ccache
  919. uses: ggml-org/ccache-action@v1.2.16
  920. with:
  921. key: ${{ github.job }}
  922. evict-old-files: 1d
  923. - name: libCURL
  924. id: get_libcurl
  925. uses: ./.github/actions/windows-setup-curl
  926. - name: Build
  927. id: cmake_build
  928. env:
  929. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  930. run: |
  931. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  932. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  933. cmake -G "Unix Makefiles" -B build -S . `
  934. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  935. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  936. -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/rocwmma/library/include/" `
  937. -DCMAKE_BUILD_TYPE=Release `
  938. -DGGML_HIP=ON `
  939. -DGGML_HIP_ROCWMMA_FATTN=ON `
  940. -DGGML_RPC=ON `
  941. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  942. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  943. ios-xcode-build:
  944. runs-on: macos-latest
  945. steps:
  946. - name: Checkout code
  947. uses: actions/checkout@v4
  948. - name: Setup Xcode
  949. uses: maxim-lobanov/setup-xcode@v1
  950. with:
  951. xcode-version: latest-stable
  952. - name: Build
  953. id: cmake_build
  954. run: |
  955. sysctl -a
  956. cmake -B build -G Xcode \
  957. -DGGML_METAL_USE_BF16=ON \
  958. -DGGML_METAL_EMBED_LIBRARY=ON \
  959. -DLLAMA_CURL=OFF \
  960. -DLLAMA_BUILD_EXAMPLES=OFF \
  961. -DLLAMA_BUILD_TOOLS=OFF \
  962. -DLLAMA_BUILD_TESTS=OFF \
  963. -DLLAMA_BUILD_SERVER=OFF \
  964. -DCMAKE_SYSTEM_NAME=iOS \
  965. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  966. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  967. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  968. - name: xcodebuild for swift package
  969. id: xcodebuild
  970. run: |
  971. ./build-xcframework.sh
  972. - name: Build Xcode project
  973. run: xcodebuild -project examples/llama.swiftui/llama.swiftui.xcodeproj -scheme llama.swiftui -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' FRAMEWORK_FOLDER_PATH=./build-ios build
  974. android-build:
  975. runs-on: ubuntu-latest
  976. steps:
  977. - name: Clone
  978. uses: actions/checkout@v4
  979. - name: ccache
  980. uses: ggml-org/ccache-action@v1.2.16
  981. with:
  982. key: android-build
  983. evict-old-files: 1d
  984. - name: Set up JDK
  985. uses: actions/setup-java@v3
  986. with:
  987. java-version: 17
  988. distribution: zulu
  989. - name: Setup Android SDK
  990. uses: android-actions/setup-android@v3
  991. with:
  992. log-accepted-android-sdk-licenses: false
  993. - name: Build
  994. run: |
  995. cd examples/llama.android
  996. ./gradlew build --no-daemon
  997. openEuler-latest-cmake-cann:
  998. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  999. defaults:
  1000. run:
  1001. shell: bash -el {0}
  1002. strategy:
  1003. matrix:
  1004. arch: [x86, aarch64]
  1005. cann:
  1006. - '8.1.RC1.alpha001-910b-openeuler22.03-py3.10'
  1007. device:
  1008. - 'ascend910b3'
  1009. build:
  1010. - 'Release'
  1011. runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
  1012. container: ascendai/cann:${{ matrix.cann }}
  1013. steps:
  1014. - name: Checkout
  1015. uses: actions/checkout@v4
  1016. - name: Dependencies
  1017. run: |
  1018. yum update -y
  1019. yum install -y git gcc gcc-c++ make cmake libcurl-devel
  1020. - name: Build
  1021. run: |
  1022. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1023. cmake -S . -B build \
  1024. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1025. -DGGML_CANN=on \
  1026. -DSOC_TYPE=${{ matrix.device }}
  1027. cmake --build build -j $(nproc)