build.yml 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615
  1. name: CI
  2. on:
  3. workflow_dispatch: # allows manual triggering
  4. inputs:
  5. create_release:
  6. description: 'Create new release'
  7. required: true
  8. type: boolean
  9. push:
  10. branches:
  11. - master
  12. paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal']
  13. pull_request:
  14. types: [opened, synchronize, reopened]
  15. paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal']
  16. concurrency:
  17. group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  18. cancel-in-progress: true
  19. # Fine-grant permission
  20. # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
  21. permissions:
  22. contents: write # for creating release
  23. env:
  24. BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
  25. GGML_NLOOP: 3
  26. GGML_N_THREADS: 1
  27. LLAMA_LOG_COLORS: 1
  28. LLAMA_LOG_PREFIX: 1
  29. LLAMA_LOG_TIMESTAMPS: 1
  30. jobs:
  31. macOS-latest-cmake-arm64:
  32. runs-on: macos-14
  33. steps:
  34. - name: Clone
  35. id: checkout
  36. uses: actions/checkout@v4
  37. with:
  38. fetch-depth: 0
  39. - name: ccache
  40. uses: hendrikmuhs/ccache-action@v1.2.16
  41. with:
  42. key: macOS-latest-cmake-arm64
  43. evict-old-files: 1d
  44. - name: Dependencies
  45. id: depends
  46. continue-on-error: true
  47. run: |
  48. brew update
  49. - name: Build
  50. id: cmake_build
  51. run: |
  52. sysctl -a
  53. cmake -B build \
  54. -DCMAKE_BUILD_RPATH="@loader_path" \
  55. -DLLAMA_FATAL_WARNINGS=ON \
  56. -DLLAMA_CURL=ON \
  57. -DGGML_METAL_USE_BF16=ON \
  58. -DGGML_METAL_EMBED_LIBRARY=ON \
  59. -DGGML_RPC=ON
  60. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  61. - name: Test
  62. id: cmake_test
  63. run: |
  64. cd build
  65. ctest -L 'main|curl' --verbose --timeout 900
  66. - name: Determine tag name
  67. id: tag
  68. shell: bash
  69. run: |
  70. BUILD_NUMBER="$(git rev-list --count HEAD)"
  71. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  72. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  73. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  74. else
  75. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  76. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  77. fi
  78. - name: Pack artifacts
  79. id: pack_artifacts
  80. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  81. run: |
  82. cp LICENSE ./build/bin/
  83. cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
  84. zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip ./build/bin/*
  85. - name: Upload artifacts
  86. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  87. uses: actions/upload-artifact@v4
  88. with:
  89. path: llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip
  90. name: llama-bin-macos-arm64.zip
  91. macOS-latest-cmake-x64:
  92. runs-on: macos-13
  93. steps:
  94. - name: Clone
  95. id: checkout
  96. uses: actions/checkout@v4
  97. with:
  98. fetch-depth: 0
  99. - name: ccache
  100. uses: hendrikmuhs/ccache-action@v1.2.16
  101. with:
  102. key: macOS-latest-cmake-x64
  103. evict-old-files: 1d
  104. - name: Dependencies
  105. id: depends
  106. continue-on-error: true
  107. run: |
  108. brew update
  109. - name: Build
  110. id: cmake_build
  111. run: |
  112. sysctl -a
  113. # Metal is disabled due to intermittent failures with Github runners not having a GPU:
  114. # https://github.com/ggerganov/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
  115. cmake -B build \
  116. -DCMAKE_BUILD_RPATH="@loader_path" \
  117. -DLLAMA_FATAL_WARNINGS=ON \
  118. -DLLAMA_CURL=ON \
  119. -DGGML_METAL=OFF \
  120. -DGGML_RPC=ON
  121. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  122. - name: Test
  123. id: cmake_test
  124. run: |
  125. cd build
  126. ctest -L main --verbose --timeout 900
  127. - name: Determine tag name
  128. id: tag
  129. shell: bash
  130. run: |
  131. BUILD_NUMBER="$(git rev-list --count HEAD)"
  132. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  133. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  134. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  135. else
  136. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  137. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  138. fi
  139. - name: Pack artifacts
  140. id: pack_artifacts
  141. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  142. run: |
  143. cp LICENSE ./build/bin/
  144. cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
  145. zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip ./build/bin/*
  146. - name: Upload artifacts
  147. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  148. uses: actions/upload-artifact@v4
  149. with:
  150. path: llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip
  151. name: llama-bin-macos-x64.zip
  152. ubuntu-cpu-cmake:
  153. runs-on: ubuntu-22.04
  154. steps:
  155. - name: Clone
  156. id: checkout
  157. uses: actions/checkout@v4
  158. with:
  159. fetch-depth: 0
  160. - name: ccache
  161. uses: hendrikmuhs/ccache-action@v1.2.16
  162. with:
  163. key: ubuntu-cpu-cmake
  164. evict-old-files: 1d
  165. - name: Dependencies
  166. id: depends
  167. run: |
  168. sudo apt-get update
  169. sudo apt-get install build-essential libcurl4-openssl-dev
  170. - name: Build
  171. id: cmake_build
  172. run: |
  173. cmake -B build \
  174. -DLLAMA_FATAL_WARNINGS=ON \
  175. -DLLAMA_CURL=ON \
  176. -DGGML_RPC=ON
  177. cmake --build build --config Release -j $(nproc)
  178. - name: Test
  179. id: cmake_test
  180. run: |
  181. cd build
  182. ctest -L 'main|curl' --verbose --timeout 900
  183. - name: Test llama2c conversion
  184. id: llama2c_test
  185. run: |
  186. cd build
  187. echo "Fetch tokenizer"
  188. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  189. echo "Fetch llama2c model"
  190. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  191. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  192. ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  193. - name: Determine tag name
  194. id: tag
  195. shell: bash
  196. run: |
  197. BUILD_NUMBER="$(git rev-list --count HEAD)"
  198. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  199. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  200. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  201. else
  202. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  203. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  204. fi
  205. - name: Pack artifacts
  206. id: pack_artifacts
  207. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  208. run: |
  209. cp LICENSE ./build/bin/
  210. cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
  211. zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip ./build/bin/*
  212. - name: Upload artifacts
  213. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  214. uses: actions/upload-artifact@v4
  215. with:
  216. path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip
  217. name: llama-bin-ubuntu-x64.zip
  218. ubuntu-latest-cmake-sanitizer:
  219. runs-on: ubuntu-latest
  220. continue-on-error: true
  221. strategy:
  222. matrix:
  223. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  224. build_type: [Debug]
  225. steps:
  226. - name: Clone
  227. id: checkout
  228. uses: actions/checkout@v4
  229. - name: ccache
  230. uses: hendrikmuhs/ccache-action@v1.2.16
  231. with:
  232. key: ubuntu-latest-cmake-sanitizer-${{ matrix.sanitizer }}
  233. evict-old-files: 1d
  234. - name: Dependencies
  235. id: depends
  236. run: |
  237. sudo apt-get update
  238. sudo apt-get install build-essential
  239. - name: Build
  240. id: cmake_build
  241. if: ${{ matrix.sanitizer != 'THREAD' }}
  242. run: |
  243. cmake -B build \
  244. -DLLAMA_FATAL_WARNINGS=ON \
  245. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  246. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
  247. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  248. - name: Build (no OpenMP)
  249. id: cmake_build_no_openmp
  250. if: ${{ matrix.sanitizer == 'THREAD' }}
  251. run: |
  252. cmake -B build \
  253. -DLLAMA_FATAL_WARNINGS=ON \
  254. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  255. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  256. -DGGML_OPENMP=OFF
  257. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  258. - name: Test
  259. id: cmake_test
  260. run: |
  261. cd build
  262. ctest -L main --verbose --timeout 900
  263. ubuntu-latest-cmake-rpc:
  264. runs-on: ubuntu-latest
  265. continue-on-error: true
  266. steps:
  267. - name: Clone
  268. id: checkout
  269. uses: actions/checkout@v4
  270. - name: ccache
  271. uses: hendrikmuhs/ccache-action@v1.2.16
  272. with:
  273. key: ubuntu-latest-cmake-rpc
  274. evict-old-files: 1d
  275. - name: Dependencies
  276. id: depends
  277. run: |
  278. sudo apt-get update
  279. sudo apt-get install build-essential
  280. - name: Build
  281. id: cmake_build
  282. run: |
  283. cmake -B build \
  284. -DGGML_RPC=ON
  285. cmake --build build --config Release -j $(nproc)
  286. - name: Test
  287. id: cmake_test
  288. run: |
  289. cd build
  290. ctest -L main --verbose
  291. ubuntu-22-cmake-vulkan:
  292. runs-on: ubuntu-22.04
  293. steps:
  294. - name: Clone
  295. id: checkout
  296. uses: actions/checkout@v4
  297. - name: ccache
  298. uses: hendrikmuhs/ccache-action@v1.2.16
  299. with:
  300. key: ubuntu-22-cmake-vulkan
  301. evict-old-files: 1d
  302. - name: Dependencies
  303. id: depends
  304. run: |
  305. wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
  306. sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
  307. sudo apt-get update -y
  308. sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk
  309. - name: Build
  310. id: cmake_build
  311. run: |
  312. cmake -B build \
  313. -DGGML_VULKAN=ON
  314. cmake --build build --config Release -j $(nproc)
  315. - name: Test
  316. id: cmake_test
  317. run: |
  318. cd build
  319. # This is using llvmpipe and runs slower than other backends
  320. ctest -L main --verbose --timeout 1800
  321. ubuntu-22-cmake-hip:
  322. runs-on: ubuntu-22.04
  323. container: rocm/dev-ubuntu-22.04:6.0.2
  324. steps:
  325. - name: Clone
  326. id: checkout
  327. uses: actions/checkout@v4
  328. - name: Dependencies
  329. id: depends
  330. run: |
  331. sudo apt-get update
  332. sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev
  333. - name: ccache
  334. uses: hendrikmuhs/ccache-action@v1.2.16
  335. with:
  336. key: ubuntu-22-cmake-hip
  337. evict-old-files: 1d
  338. - name: Build with native CMake HIP support
  339. id: cmake_build
  340. run: |
  341. cmake -B build -S . \
  342. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
  343. -DGGML_HIP=ON
  344. cmake --build build --config Release -j $(nproc)
  345. - name: Build with legacy HIP support
  346. id: cmake_build_legacy_hip
  347. run: |
  348. cmake -B build2 -S . \
  349. -DCMAKE_C_COMPILER=hipcc \
  350. -DCMAKE_CXX_COMPILER=hipcc \
  351. -DGGML_HIP=ON
  352. cmake --build build2 --config Release -j $(nproc)
  353. ubuntu-22-cmake-musa:
  354. runs-on: ubuntu-22.04
  355. container: mthreads/musa:rc3.1.0-devel-ubuntu22.04
  356. steps:
  357. - name: Clone
  358. id: checkout
  359. uses: actions/checkout@v4
  360. - name: Dependencies
  361. id: depends
  362. run: |
  363. apt-get update
  364. apt-get install -y build-essential git cmake libcurl4-openssl-dev
  365. - name: ccache
  366. uses: hendrikmuhs/ccache-action@v1.2.16
  367. with:
  368. key: ubuntu-22-cmake-musa
  369. evict-old-files: 1d
  370. - name: Build with native CMake MUSA support
  371. id: cmake_build
  372. run: |
  373. cmake -B build -S . \
  374. -DGGML_MUSA=ON
  375. cmake --build build --config Release -j $(nproc)
  376. ubuntu-22-cmake-sycl:
  377. runs-on: ubuntu-22.04
  378. continue-on-error: true
  379. steps:
  380. - uses: actions/checkout@v4
  381. - name: add oneAPI to apt
  382. shell: bash
  383. run: |
  384. cd /tmp
  385. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  386. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  387. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  388. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  389. - name: install oneAPI dpcpp compiler
  390. shell: bash
  391. run: |
  392. sudo apt update
  393. sudo apt install intel-oneapi-compiler-dpcpp-cpp
  394. - name: install oneAPI MKL library
  395. shell: bash
  396. run: |
  397. sudo apt install intel-oneapi-mkl-devel
  398. - name: Clone
  399. id: checkout
  400. uses: actions/checkout@v4
  401. - name: ccache
  402. uses: hendrikmuhs/ccache-action@v1.2.16
  403. with:
  404. key: ubuntu-22-cmake-sycl
  405. evict-old-files: 1d
  406. - name: Build
  407. id: cmake_build
  408. run: |
  409. source /opt/intel/oneapi/setvars.sh
  410. cmake -B build \
  411. -DGGML_SYCL=ON \
  412. -DCMAKE_C_COMPILER=icx \
  413. -DCMAKE_CXX_COMPILER=icpx
  414. cmake --build build --config Release -j $(nproc)
  415. ubuntu-22-cmake-sycl-fp16:
  416. runs-on: ubuntu-22.04
  417. continue-on-error: true
  418. steps:
  419. - uses: actions/checkout@v4
  420. - name: add oneAPI to apt
  421. shell: bash
  422. run: |
  423. cd /tmp
  424. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  425. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  426. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  427. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  428. - name: install oneAPI dpcpp compiler
  429. shell: bash
  430. run: |
  431. sudo apt update
  432. sudo apt install intel-oneapi-compiler-dpcpp-cpp
  433. - name: install oneAPI MKL library
  434. shell: bash
  435. run: |
  436. sudo apt install intel-oneapi-mkl-devel
  437. - name: Clone
  438. id: checkout
  439. uses: actions/checkout@v4
  440. - name: ccache
  441. uses: hendrikmuhs/ccache-action@v1.2.16
  442. with:
  443. key: ubuntu-22-cmake-sycl-fp16
  444. evict-old-files: 1d
  445. - name: Build
  446. id: cmake_build
  447. run: |
  448. source /opt/intel/oneapi/setvars.sh
  449. cmake -B build \
  450. -DGGML_SYCL=ON \
  451. -DCMAKE_C_COMPILER=icx \
  452. -DCMAKE_CXX_COMPILER=icpx \
  453. -DGGML_SYCL_F16=ON
  454. cmake --build build --config Release -j $(nproc)
  455. macOS-latest-cmake-ios:
  456. runs-on: macos-latest
  457. steps:
  458. - name: Clone
  459. id: checkout
  460. uses: actions/checkout@v4
  461. - name: ccache
  462. uses: hendrikmuhs/ccache-action@v1.2.16
  463. with:
  464. key: macOS-latest-cmake-ios
  465. evict-old-files: 1d
  466. - name: Dependencies
  467. id: depends
  468. continue-on-error: true
  469. run: |
  470. brew update
  471. - name: Build
  472. id: cmake_build
  473. run: |
  474. sysctl -a
  475. cmake -B build -G Xcode \
  476. -DGGML_METAL_USE_BF16=ON \
  477. -DGGML_METAL_EMBED_LIBRARY=ON \
  478. -DLLAMA_BUILD_EXAMPLES=OFF \
  479. -DLLAMA_BUILD_TESTS=OFF \
  480. -DLLAMA_BUILD_SERVER=OFF \
  481. -DCMAKE_SYSTEM_NAME=iOS \
  482. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  483. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  484. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  485. macOS-latest-cmake-tvos:
  486. runs-on: macos-latest
  487. steps:
  488. - name: Clone
  489. id: checkout
  490. uses: actions/checkout@v4
  491. - name: ccache
  492. uses: hendrikmuhs/ccache-action@v1.2.16
  493. with:
  494. key: macOS-latest-cmake-tvos
  495. evict-old-files: 1d
  496. - name: Dependencies
  497. id: depends
  498. continue-on-error: true
  499. run: |
  500. brew update
  501. - name: Build
  502. id: cmake_build
  503. run: |
  504. sysctl -a
  505. cmake -B build -G Xcode \
  506. -DGGML_METAL_USE_BF16=ON \
  507. -DGGML_METAL_EMBED_LIBRARY=ON \
  508. -DLLAMA_BUILD_EXAMPLES=OFF \
  509. -DLLAMA_BUILD_TESTS=OFF \
  510. -DLLAMA_BUILD_SERVER=OFF \
  511. -DCMAKE_SYSTEM_NAME=tvOS \
  512. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  513. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  514. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  515. macOS-latest-swift:
  516. runs-on: macos-latest
  517. strategy:
  518. matrix:
  519. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  520. steps:
  521. - name: Clone
  522. id: checkout
  523. uses: actions/checkout@v4
  524. - name: ccache
  525. uses: hendrikmuhs/ccache-action@v1.2.16
  526. with:
  527. key: macOS-latest-swift
  528. evict-old-files: 1d
  529. - name: Dependencies
  530. id: depends
  531. continue-on-error: true
  532. run: |
  533. brew update
  534. - name: Build llama.cpp with CMake
  535. id: cmake_build
  536. run: |
  537. sysctl -a
  538. cmake -B build -G Xcode \
  539. -DGGML_METAL_USE_BF16=ON \
  540. -DGGML_METAL_EMBED_LIBRARY=ON \
  541. -DLLAMA_BUILD_EXAMPLES=OFF \
  542. -DLLAMA_BUILD_TESTS=OFF \
  543. -DLLAMA_BUILD_SERVER=OFF \
  544. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
  545. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  546. sudo cmake --install build --config Release
  547. - name: xcodebuild for swift package
  548. id: xcodebuild
  549. run: |
  550. xcodebuild -scheme llama-Package -destination "${{ matrix.destination }}"
  551. windows-msys2:
  552. runs-on: windows-latest
  553. strategy:
  554. fail-fast: false
  555. matrix:
  556. include:
  557. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  558. - { sys: CLANG64, env: clang-x86_64, build: Release }
  559. steps:
  560. - name: Clone
  561. uses: actions/checkout@v4
  562. - name: ccache
  563. uses: hendrikmuhs/ccache-action@v1.2.16
  564. with:
  565. key: windows-msys2
  566. variant: sccache
  567. evict-old-files: 1d
  568. - name: Setup ${{ matrix.sys }}
  569. uses: msys2/setup-msys2@v2
  570. with:
  571. update: true
  572. msystem: ${{matrix.sys}}
  573. install: >-
  574. base-devel
  575. git
  576. mingw-w64-${{matrix.env}}-toolchain
  577. mingw-w64-${{matrix.env}}-cmake
  578. mingw-w64-${{matrix.env}}-openblas
  579. - name: Build using CMake
  580. shell: msys2 {0}
  581. run: |
  582. cmake -B build
  583. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  584. - name: Clean after building using CMake
  585. shell: msys2 {0}
  586. run: |
  587. rm -rf build
  588. - name: Build using CMake w/ OpenBLAS
  589. shell: msys2 {0}
  590. run: |
  591. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  592. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  593. windows-latest-cmake:
  594. runs-on: windows-latest
  595. env:
  596. OPENBLAS_VERSION: 0.3.23
  597. SDE_VERSION: 9.33.0-2024-01-07
  598. VULKAN_VERSION: 1.3.261.1
  599. strategy:
  600. matrix:
  601. include:
  602. - build: 'noavx-x64'
  603. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF'
  604. - build: 'avx2-x64'
  605. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON'
  606. - build: 'avx-x64'
  607. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX2=OFF'
  608. - build: 'avx512-x64'
  609. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX512=ON'
  610. - build: 'openblas-x64'
  611. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'
  612. - build: 'kompute-x64'
  613. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_KOMPUTE=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON'
  614. - build: 'vulkan-x64'
  615. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_VULKAN=ON'
  616. - build: 'llvm-arm64'
  617. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  618. - build: 'msvc-arm64'
  619. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-msvc.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  620. - build: 'llvm-arm64-opencl-adreno'
  621. 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'
  622. steps:
  623. - name: Clone
  624. id: checkout
  625. uses: actions/checkout@v4
  626. with:
  627. fetch-depth: 0
  628. - name: ccache
  629. uses: hendrikmuhs/ccache-action@v1.2.16
  630. with:
  631. key: windows-latest-cmake-${{ matrix.build }}
  632. variant: sccache
  633. evict-old-files: 1d
  634. - name: Clone Kompute submodule
  635. id: clone_kompute
  636. if: ${{ matrix.build == 'kompute-x64' }}
  637. run: |
  638. git submodule update --init ggml/src/ggml-kompute/kompute
  639. - name: Download OpenBLAS
  640. id: get_openblas
  641. if: ${{ matrix.build == 'openblas-x64' }}
  642. run: |
  643. 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"
  644. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  645. mkdir $env:RUNNER_TEMP/openblas
  646. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  647. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  648. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  649. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  650. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  651. - name: Install Vulkan SDK
  652. id: get_vulkan
  653. if: ${{ matrix.build == 'kompute-x64' || matrix.build == 'vulkan-x64' }}
  654. run: |
  655. curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanSDK-${env:VULKAN_VERSION}-Installer.exe"
  656. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  657. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  658. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  659. - name: Install Ninja
  660. id: install_ninja
  661. run: |
  662. choco install ninja
  663. - name: Install OpenCL Headers and Libs
  664. id: install_opencl
  665. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  666. run: |
  667. git clone https://github.com/KhronosGroup/OpenCL-Headers
  668. cd OpenCL-Headers
  669. cmake -B build `
  670. -DBUILD_TESTING=OFF `
  671. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  672. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  673. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  674. cmake --build build --target install
  675. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  676. cd OpenCL-ICD-Loader
  677. cmake -B build-arm64-release `
  678. -A arm64 `
  679. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  680. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  681. cmake --build build-arm64-release --target install --config release
  682. - name: Build
  683. id: cmake_build
  684. run: |
  685. cmake -S . -B build ${{ matrix.defines }}
  686. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  687. - name: Add libopenblas.dll
  688. id: add_libopenblas_dll
  689. if: ${{ matrix.build == 'openblas-x64' }}
  690. run: |
  691. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  692. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  693. - name: Check AVX512F support
  694. id: check_avx512f
  695. if: ${{ matrix.build == 'avx512-x64' }}
  696. continue-on-error: true
  697. run: |
  698. cd build
  699. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  700. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  701. $cl = $(join-path $msvc 'bin\Hostx64\x64\cl.exe')
  702. echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c
  703. & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
  704. .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
  705. - name: Test
  706. id: cmake_test
  707. # not all machines have native AVX-512
  708. 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') }}
  709. run: |
  710. cd build
  711. ctest -L main -C Release --verbose --timeout 900
  712. - name: Test (Intel SDE)
  713. id: cmake_test_sde
  714. if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  715. run: |
  716. curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  717. # for some weird reason windows tar doesn't like sde tar.xz
  718. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  719. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  720. $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  721. cd build
  722. $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  723. & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  724. - name: Determine tag name
  725. id: tag
  726. shell: bash
  727. run: |
  728. BUILD_NUMBER="$(git rev-list --count HEAD)"
  729. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  730. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  731. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  732. else
  733. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  734. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  735. fi
  736. - name: Pack artifacts
  737. id: pack_artifacts
  738. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  739. run: |
  740. Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
  741. Copy-Item .\examples\run\linenoise.cpp\LICENSE .\build\bin\Release\linenoise.cpp.txt
  742. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip .\build\bin\Release\*
  743. - name: Upload artifacts
  744. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  745. uses: actions/upload-artifact@v4
  746. with:
  747. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip
  748. name: llama-bin-win-${{ matrix.build }}.zip
  749. ubuntu-latest-cmake-cuda:
  750. runs-on: ubuntu-latest
  751. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  752. steps:
  753. - name: Clone
  754. id: checkout
  755. uses: actions/checkout@v4
  756. with:
  757. fetch-depth: 0
  758. - name: Install dependencies
  759. env:
  760. DEBIAN_FRONTEND: noninteractive
  761. run: |
  762. apt update
  763. apt install -y cmake build-essential ninja-build libgomp1 git
  764. - name: ccache
  765. uses: hendrikmuhs/ccache-action@v1.2.16
  766. with:
  767. key: ubuntu-latest-cmake-cuda
  768. evict-old-files: 1d
  769. - name: Build with CMake
  770. run: |
  771. cmake -S . -B build -G Ninja \
  772. -DCMAKE_BUILD_TYPE=Release \
  773. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  774. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  775. -DLLAMA_FATAL_WARNINGS=ON \
  776. -DGGML_NATIVE=OFF \
  777. -DGGML_CUDA=ON
  778. cmake --build build
  779. windows-2019-cmake-cuda:
  780. runs-on: windows-2019
  781. strategy:
  782. matrix:
  783. cuda: ['12.4', '11.7']
  784. build: ['cuda']
  785. steps:
  786. - name: Clone
  787. id: checkout
  788. uses: actions/checkout@v4
  789. with:
  790. fetch-depth: 0
  791. - name: Install ccache
  792. uses: hendrikmuhs/ccache-action@v1.2.16
  793. with:
  794. key: ${{ github.job }}-${{ matrix.cuda }}-${{ matrix.build }}
  795. variant: sccache
  796. evict-old-files: 1d
  797. - name: Install Cuda Toolkit 11.7
  798. if: ${{ matrix.cuda == '11.7' }}
  799. run: |
  800. mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"
  801. choco install unzip -y
  802. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cudart/windows-x86_64/cuda_cudart-windows-x86_64-11.7.99-archive.zip"
  803. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvcc/windows-x86_64/cuda_nvcc-windows-x86_64-11.7.99-archive.zip"
  804. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/windows-x86_64/cuda_nvrtc-windows-x86_64-11.7.99-archive.zip"
  805. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-11.7.4.6-archive.zip"
  806. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvtx/windows-x86_64/cuda_nvtx-windows-x86_64-11.7.91-archive.zip"
  807. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/visual_studio_integration/windows-x86_64/visual_studio_integration-windows-x86_64-11.7.91-archive.zip"
  808. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvprof/windows-x86_64/cuda_nvprof-windows-x86_64-11.7.101-archive.zip"
  809. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cccl/windows-x86_64/cuda_cccl-windows-x86_64-11.7.91-archive.zip"
  810. unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"
  811. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_cudart-windows-x86_64-11.7.99-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y
  812. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_nvcc-windows-x86_64-11.7.99-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y
  813. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_nvrtc-windows-x86_64-11.7.99-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y
  814. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libcublas-windows-x86_64-11.7.4.6-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y
  815. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_nvtx-windows-x86_64-11.7.91-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y
  816. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\visual_studio_integration-windows-x86_64-11.7.91-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y
  817. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_nvprof-windows-x86_64-11.7.101-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y
  818. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_cccl-windows-x86_64-11.7.91-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y
  819. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  820. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  821. echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  822. echo "CUDA_PATH_V11_7=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  823. - name: Install Cuda Toolkit 12.4
  824. if: ${{ matrix.cuda == '12.4' }}
  825. run: |
  826. mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"
  827. choco install unzip -y
  828. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cudart/windows-x86_64/cuda_cudart-windows-x86_64-12.4.127-archive.zip"
  829. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvcc/windows-x86_64/cuda_nvcc-windows-x86_64-12.4.131-archive.zip"
  830. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/windows-x86_64/cuda_nvrtc-windows-x86_64-12.4.127-archive.zip"
  831. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-12.4.5.8-archive.zip"
  832. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvtx/windows-x86_64/cuda_nvtx-windows-x86_64-12.4.127-archive.zip"
  833. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_profiler_api/windows-x86_64/cuda_profiler_api-windows-x86_64-12.4.127-archive.zip"
  834. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/visual_studio_integration/windows-x86_64/visual_studio_integration-windows-x86_64-12.4.127-archive.zip"
  835. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvprof/windows-x86_64/cuda_nvprof-windows-x86_64-12.4.127-archive.zip"
  836. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cccl/windows-x86_64/cuda_cccl-windows-x86_64-12.4.127-archive.zip"
  837. unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"
  838. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_cudart-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y
  839. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_nvcc-windows-x86_64-12.4.131-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y
  840. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_nvrtc-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y
  841. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\libcublas-windows-x86_64-12.4.5.8-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y
  842. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_nvtx-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y
  843. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_profiler_api-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y
  844. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\visual_studio_integration-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y
  845. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_nvprof-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y
  846. xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_cccl-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y
  847. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  848. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  849. echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  850. echo "CUDA_PATH_V12_4=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  851. - name: Install Ninja
  852. id: install_ninja
  853. run: |
  854. choco install ninja
  855. - name: Build
  856. id: cmake_build
  857. shell: cmd
  858. run: |
  859. call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
  860. cmake -S . -B build -G "Ninja Multi-Config" ^
  861. -DLLAMA_BUILD_SERVER=ON ^
  862. -DGGML_NATIVE=OFF ^
  863. -DGGML_CUDA=ON ^
  864. -DGGML_RPC=ON
  865. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  866. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  867. cmake --build build --config Release
  868. - name: Determine tag name
  869. id: tag
  870. shell: bash
  871. run: |
  872. BUILD_NUMBER="$(git rev-list --count HEAD)"
  873. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  874. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  875. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  876. else
  877. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  878. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  879. fi
  880. - name: Pack artifacts
  881. id: pack_artifacts
  882. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  883. run: |
  884. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
  885. - name: Upload artifacts
  886. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  887. uses: actions/upload-artifact@v4
  888. with:
  889. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
  890. name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  891. - name: Copy and pack Cuda runtime
  892. if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  893. run: |
  894. echo "Cuda install location: ${{ env.CUDA_PATH }}"
  895. $dst='.\build\bin\cudart\'
  896. robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  897. robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  898. 7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
  899. - name: Upload Cuda runtime
  900. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  901. uses: actions/upload-artifact@v4
  902. with:
  903. path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  904. name: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  905. windows-latest-cmake-sycl:
  906. runs-on: windows-latest
  907. defaults:
  908. run:
  909. shell: bash
  910. env:
  911. WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/b380d914-366b-4b77-a74a-05e3c38b3514/intel-oneapi-base-toolkit-2025.0.0.882_offline.exe
  912. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  913. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  914. steps:
  915. - name: Clone
  916. id: checkout
  917. uses: actions/checkout@v4
  918. with:
  919. fetch-depth: 0
  920. - name: ccache
  921. uses: hendrikmuhs/ccache-action@v1.2.16
  922. with:
  923. key: windows-latest-cmake-sycl
  924. variant: sccache
  925. evict-old-files: 1d
  926. - name: Install
  927. run: |
  928. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  929. - name: Build
  930. id: cmake_build
  931. run: examples/sycl/win-build-sycl.bat
  932. - name: Determine tag name
  933. id: tag
  934. shell: bash
  935. run: |
  936. BUILD_NUMBER="$(git rev-list --count HEAD)"
  937. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  938. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  939. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  940. else
  941. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  942. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  943. fi
  944. - name: Build the release package
  945. id: pack_artifacts
  946. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  947. run: |
  948. echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"
  949. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.5.dll" ./build/bin
  950. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_core.2.dll" ./build/bin
  951. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_tbb_thread.2.dll" ./build/bin
  952. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_level_zero.dll" ./build/bin
  953. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_opencl.dll" ./build/bin
  954. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_loader.dll" ./build/bin
  955. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_win_proxy_loader.dll" ./build/bin
  956. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl8.dll" ./build/bin
  957. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/svml_dispmd.dll" ./build/bin
  958. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libmmd.dll" ./build/bin
  959. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libiomp5md.dll" ./build/bin
  960. cp "${{ env.ONEAPI_ROOT }}/dnnl/latest/bin/dnnl.dll" ./build/bin
  961. cp "${{ env.ONEAPI_ROOT }}/tbb/latest/bin/tbb12.dll" ./build/bin
  962. echo "cp oneAPI running time dll files to ./build/bin done"
  963. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*
  964. - name: Upload the release package
  965. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  966. uses: actions/upload-artifact@v4
  967. with:
  968. path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip
  969. name: llama-bin-win-sycl-x64.zip
  970. windows-latest-cmake-hip:
  971. if: ${{ github.event.inputs.create_release != 'true' }}
  972. runs-on: windows-latest
  973. steps:
  974. - name: Clone
  975. id: checkout
  976. uses: actions/checkout@v4
  977. - name: Install
  978. id: depends
  979. run: |
  980. $ErrorActionPreference = "Stop"
  981. write-host "Downloading AMD HIP SDK Installer"
  982. 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"
  983. write-host "Installing AMD HIP SDK"
  984. Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
  985. write-host "Completed AMD HIP SDK installation"
  986. - name: Verify ROCm
  987. id: verify
  988. run: |
  989. & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
  990. - name: Install ccache
  991. uses: hendrikmuhs/ccache-action@v1.2.16
  992. with:
  993. key: ${{ github.job }}
  994. evict-old-files: 1d
  995. - name: Build
  996. id: cmake_build
  997. run: |
  998. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  999. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  1000. cmake -G "Unix Makefiles" -B build -S . `
  1001. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  1002. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  1003. -DCMAKE_BUILD_TYPE=Release `
  1004. -DGGML_HIP=ON `
  1005. -DGGML_RPC=ON
  1006. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  1007. windows-latest-cmake-hip-release:
  1008. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  1009. runs-on: windows-latest
  1010. strategy:
  1011. matrix:
  1012. gpu_target: [gfx1100, gfx1101, gfx1030]
  1013. steps:
  1014. - name: Clone
  1015. id: checkout
  1016. uses: actions/checkout@v4
  1017. with:
  1018. fetch-depth: 0
  1019. - name: ccache
  1020. uses: hendrikmuhs/ccache-action@v1.2.16
  1021. with:
  1022. key: windows-latest-cmake-hip-release
  1023. evict-old-files: 1d
  1024. - name: Install
  1025. id: depends
  1026. run: |
  1027. $ErrorActionPreference = "Stop"
  1028. write-host "Downloading AMD HIP SDK Installer"
  1029. 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"
  1030. write-host "Installing AMD HIP SDK"
  1031. Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
  1032. write-host "Completed AMD HIP SDK installation"
  1033. - name: Verify ROCm
  1034. id: verify
  1035. run: |
  1036. & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
  1037. - name: Build
  1038. id: cmake_build
  1039. run: |
  1040. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  1041. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  1042. cmake -G "Unix Makefiles" -B build -S . `
  1043. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  1044. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  1045. -DCMAKE_BUILD_TYPE=Release `
  1046. -DAMDGPU_TARGETS=${{ matrix.gpu_target }} `
  1047. -DGGML_HIP=ON `
  1048. -DGGML_RPC=ON
  1049. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  1050. md "build\bin\rocblas\library\"
  1051. cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
  1052. cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
  1053. cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
  1054. - name: Determine tag name
  1055. id: tag
  1056. shell: bash
  1057. run: |
  1058. BUILD_NUMBER="$(git rev-list --count HEAD)"
  1059. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  1060. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  1061. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  1062. else
  1063. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  1064. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  1065. fi
  1066. - name: Pack artifacts
  1067. id: pack_artifacts
  1068. run: |
  1069. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip .\build\bin\*
  1070. - name: Upload artifacts
  1071. uses: actions/upload-artifact@v4
  1072. with:
  1073. path: llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  1074. name: llama-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  1075. ios-xcode-build:
  1076. runs-on: macos-latest
  1077. steps:
  1078. - name: Checkout code
  1079. uses: actions/checkout@v4
  1080. - name: Build
  1081. id: cmake_build
  1082. run: |
  1083. sysctl -a
  1084. cmake -B build -G Xcode \
  1085. -DGGML_METAL_USE_BF16=ON \
  1086. -DGGML_METAL_EMBED_LIBRARY=ON \
  1087. -DLLAMA_BUILD_EXAMPLES=OFF \
  1088. -DLLAMA_BUILD_TESTS=OFF \
  1089. -DLLAMA_BUILD_SERVER=OFF \
  1090. -DCMAKE_SYSTEM_NAME=iOS \
  1091. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  1092. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  1093. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  1094. sudo cmake --install build --config Release
  1095. - name: xcodebuild for swift package
  1096. id: xcodebuild
  1097. run: |
  1098. xcodebuild -scheme llama-Package -destination 'generic/platform=iOS'
  1099. - name: Build Xcode project
  1100. 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' build
  1101. android-build:
  1102. runs-on: ubuntu-latest
  1103. steps:
  1104. - name: Clone
  1105. uses: actions/checkout@v4
  1106. - name: ccache
  1107. uses: hendrikmuhs/ccache-action@v1.2.16
  1108. with:
  1109. key: android-build
  1110. evict-old-files: 1d
  1111. - name: Set up JDK
  1112. uses: actions/setup-java@v3
  1113. with:
  1114. java-version: 17
  1115. distribution: zulu
  1116. - name: Setup Android SDK
  1117. uses: android-actions/setup-android@v3
  1118. with:
  1119. log-accepted-android-sdk-licenses: false
  1120. - name: Build
  1121. run: |
  1122. cd examples/llama.android
  1123. ./gradlew build --no-daemon
  1124. release:
  1125. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  1126. runs-on: ubuntu-latest
  1127. needs:
  1128. - ubuntu-cpu-cmake
  1129. - windows-latest-cmake
  1130. - windows-2019-cmake-cuda
  1131. - windows-latest-cmake-hip-release
  1132. - macOS-latest-cmake-arm64
  1133. - macOS-latest-cmake-x64
  1134. steps:
  1135. - name: Clone
  1136. id: checkout
  1137. uses: actions/checkout@v4
  1138. with:
  1139. fetch-depth: 0
  1140. - name: ccache
  1141. uses: hendrikmuhs/ccache-action@v1.2.16
  1142. with:
  1143. key: release
  1144. evict-old-files: 1d
  1145. - name: Determine tag name
  1146. id: tag
  1147. shell: bash
  1148. run: |
  1149. BUILD_NUMBER="$(git rev-list --count HEAD)"
  1150. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  1151. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  1152. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  1153. else
  1154. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  1155. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  1156. fi
  1157. - name: Download artifacts
  1158. id: download-artifact
  1159. uses: actions/download-artifact@v4
  1160. with:
  1161. path: ./artifact
  1162. - name: Move artifacts
  1163. id: move_artifacts
  1164. run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
  1165. - name: Create release
  1166. id: create_release
  1167. uses: ggml-org/action-create-release@v1
  1168. env:
  1169. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1170. with:
  1171. tag_name: ${{ steps.tag.outputs.name }}
  1172. - name: Upload release
  1173. id: upload_release
  1174. uses: actions/github-script@v3
  1175. with:
  1176. github-token: ${{secrets.GITHUB_TOKEN}}
  1177. script: |
  1178. const path = require('path');
  1179. const fs = require('fs');
  1180. const release_id = '${{ steps.create_release.outputs.id }}';
  1181. for (let file of await fs.readdirSync('./artifact/release')) {
  1182. if (path.extname(file) === '.zip') {
  1183. console.log('uploadReleaseAsset', file);
  1184. await github.repos.uploadReleaseAsset({
  1185. owner: context.repo.owner,
  1186. repo: context.repo.repo,
  1187. release_id: release_id,
  1188. name: file,
  1189. data: await fs.readFileSync(`./artifact/release/${file}`)
  1190. });
  1191. }
  1192. }
  1193. # ubuntu-latest-gcc:
  1194. # runs-on: ubuntu-latest
  1195. #
  1196. # strategy:
  1197. # matrix:
  1198. # build: [Debug, Release]
  1199. #
  1200. # steps:
  1201. # - name: Clone
  1202. # uses: actions/checkout@v4
  1203. #
  1204. # - name: Dependencies
  1205. # run: |
  1206. # sudo apt-get update
  1207. # sudo apt-get install build-essential
  1208. # sudo apt-get install cmake
  1209. #
  1210. # - name: Configure
  1211. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1212. #
  1213. # - name: Build
  1214. # run: |
  1215. # make
  1216. #
  1217. # ubuntu-latest-clang:
  1218. # runs-on: ubuntu-latest
  1219. #
  1220. # strategy:
  1221. # matrix:
  1222. # build: [Debug, Release]
  1223. #
  1224. # steps:
  1225. # - name: Clone
  1226. # uses: actions/checkout@v4
  1227. #
  1228. # - name: Dependencies
  1229. # run: |
  1230. # sudo apt-get update
  1231. # sudo apt-get install build-essential
  1232. # sudo apt-get install cmake
  1233. #
  1234. # - name: Configure
  1235. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
  1236. #
  1237. # - name: Build
  1238. # run: |
  1239. # make
  1240. #
  1241. # ubuntu-latest-gcc-sanitized:
  1242. # runs-on: ubuntu-latest
  1243. #
  1244. # strategy:
  1245. # matrix:
  1246. # sanitizer: [ADDRESS, THREAD, UNDEFINED]
  1247. #
  1248. # steps:
  1249. # - name: Clone
  1250. # uses: actions/checkout@v4
  1251. #
  1252. # - name: Dependencies
  1253. # run: |
  1254. # sudo apt-get update
  1255. # sudo apt-get install build-essential
  1256. # sudo apt-get install cmake
  1257. #
  1258. # - name: Configure
  1259. # run: cmake . -DCMAKE_BUILD_TYPE=Debug -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON
  1260. #
  1261. # - name: Build
  1262. # run: |
  1263. # make
  1264. #
  1265. # windows:
  1266. # runs-on: windows-latest
  1267. #
  1268. # strategy:
  1269. # matrix:
  1270. # build: [Release]
  1271. # arch: [Win32, x64]
  1272. # include:
  1273. # - arch: Win32
  1274. # s2arc: x86
  1275. # - arch: x64
  1276. # s2arc: x64
  1277. #
  1278. # steps:
  1279. # - name: Clone
  1280. # uses: actions/checkout@v4
  1281. #
  1282. # - name: Add msbuild to PATH
  1283. # uses: microsoft/setup-msbuild@v1
  1284. #
  1285. # - name: Configure
  1286. # run: >
  1287. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1288. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1289. #
  1290. # - name: Build
  1291. # run: |
  1292. # cd ./build
  1293. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1294. #
  1295. # - name: Upload binaries
  1296. # uses: actions/upload-artifact@v4
  1297. # with:
  1298. # name: llama-bin-${{ matrix.arch }}
  1299. # path: build/bin/${{ matrix.build }}
  1300. #
  1301. # windows-blas:
  1302. # runs-on: windows-latest
  1303. #
  1304. # strategy:
  1305. # matrix:
  1306. # build: [Release]
  1307. # arch: [Win32, x64]
  1308. # blas: [ON]
  1309. # include:
  1310. # - arch: Win32
  1311. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x86.zip
  1312. # s2arc: x86
  1313. # - arch: x64
  1314. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
  1315. # s2arc: x64
  1316. #
  1317. # steps:
  1318. # - name: Clone
  1319. # uses: actions/checkout@v4
  1320. #
  1321. # - name: Add msbuild to PATH
  1322. # uses: microsoft/setup-msbuild@v1
  1323. #
  1324. # - name: Fetch OpenBLAS
  1325. # if: matrix.blas == 'ON'
  1326. # run: |
  1327. # C:/msys64/usr/bin/wget.exe -qO blas.zip ${{ matrix.obzip }}
  1328. # 7z x blas.zip -oblas -y
  1329. # copy blas/include/cblas.h .
  1330. # copy blas/include/openblas_config.h .
  1331. # echo "blasdir=$env:GITHUB_WORKSPACE/blas" >> $env:GITHUB_ENV
  1332. #
  1333. # - name: Configure
  1334. # run: >
  1335. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1336. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1337. # -DLLAMA_SUPPORT_OPENBLAS=${{ matrix.blas }}
  1338. # -DCMAKE_LIBRARY_PATH="$env:blasdir/lib"
  1339. #
  1340. # - name: Build
  1341. # run: |
  1342. # cd ./build
  1343. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1344. #
  1345. # - name: Copy libopenblas.dll
  1346. # if: matrix.blas == 'ON'
  1347. # run: copy "$env:blasdir/bin/libopenblas.dll" build/bin/${{ matrix.build }}
  1348. #
  1349. # - name: Upload binaries
  1350. # if: matrix.blas == 'ON'
  1351. # uses: actions/upload-artifact@v4
  1352. # with:
  1353. # name: llama-blas-bin-${{ matrix.arch }}
  1354. # path: build/bin/${{ matrix.build }}
  1355. #
  1356. # emscripten:
  1357. # runs-on: ubuntu-latest
  1358. #
  1359. # strategy:
  1360. # matrix:
  1361. # build: [Release]
  1362. #
  1363. # steps:
  1364. # - name: Clone
  1365. # uses: actions/checkout@v4
  1366. #
  1367. # - name: Dependencies
  1368. # run: |
  1369. # wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
  1370. # tar -xvf master.tar.gz
  1371. # emsdk-master/emsdk update
  1372. # emsdk-master/emsdk install latest
  1373. # emsdk-master/emsdk activate latest
  1374. #
  1375. # - name: Configure
  1376. # run: echo "tmp"
  1377. #
  1378. # - name: Build
  1379. # run: |
  1380. # pushd emsdk-master
  1381. # source ./emsdk_env.sh
  1382. # popd
  1383. # emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1384. # make
  1385. openEuler-latest-cmake-cann:
  1386. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1387. defaults:
  1388. run:
  1389. shell: bash -el {0}
  1390. runs-on: ubuntu-24.04-arm
  1391. strategy:
  1392. matrix:
  1393. cann:
  1394. - '8.0.rc3.beta1-910b-openeuler22.03-py3.10'
  1395. device:
  1396. - 'ascend910b3'
  1397. build:
  1398. - 'Release'
  1399. container: ascendai/cann:${{ matrix.cann }}
  1400. steps:
  1401. - name: Checkout
  1402. uses: actions/checkout@v4
  1403. - name: Dependencies
  1404. run: |
  1405. yum update -y
  1406. yum install -y git gcc gcc-c++ make cmake
  1407. - name: Build
  1408. run: |
  1409. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1410. cmake -S . -B build \
  1411. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1412. -DGGML_CANN=on \
  1413. -DSOC_TYPE=${{ matrix.device }}
  1414. cmake --build build -j $(nproc)