build.yml 56 KB

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