build.yml 55 KB

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