build.yml 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204
  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/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m']
  13. pull_request:
  14. types: [opened, synchronize, reopened]
  15. paths: ['**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m']
  16. concurrency:
  17. group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  18. cancel-in-progress: true
  19. env:
  20. BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
  21. GGML_NLOOP: 3
  22. GGML_N_THREADS: 1
  23. jobs:
  24. macOS-latest-cmake-arm64:
  25. runs-on: macos-14
  26. steps:
  27. - name: Clone
  28. id: checkout
  29. uses: actions/checkout@v4
  30. with:
  31. fetch-depth: 0
  32. - name: Dependencies
  33. id: depends
  34. continue-on-error: true
  35. run: |
  36. brew update
  37. - name: Build
  38. id: cmake_build
  39. run: |
  40. sysctl -a
  41. mkdir build
  42. cd build
  43. cmake -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_METAL_EMBED_LIBRARY=ON -DLLAMA_CURL=ON ..
  44. cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
  45. - name: Test
  46. id: cmake_test
  47. run: |
  48. cd build
  49. ctest -L 'main|curl' --verbose --timeout 900
  50. - name: Determine tag name
  51. id: tag
  52. shell: bash
  53. run: |
  54. BUILD_NUMBER="$(git rev-list --count HEAD)"
  55. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  56. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  57. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  58. else
  59. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  60. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  61. fi
  62. - name: Pack artifacts
  63. id: pack_artifacts
  64. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  65. run: |
  66. cp LICENSE ./build/bin/
  67. zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip ./build/bin/*
  68. - name: Upload artifacts
  69. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  70. uses: actions/upload-artifact@v4
  71. with:
  72. path: llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip
  73. name: llama-bin-macos-arm64.zip
  74. macOS-latest-cmake-x64:
  75. runs-on: macos-latest
  76. steps:
  77. - name: Clone
  78. id: checkout
  79. uses: actions/checkout@v4
  80. with:
  81. fetch-depth: 0
  82. - name: Dependencies
  83. id: depends
  84. continue-on-error: true
  85. run: |
  86. brew update
  87. - name: Build
  88. id: cmake_build
  89. run: |
  90. sysctl -a
  91. mkdir build
  92. cd build
  93. # Metal is disabled due to intermittent failures with Github runners not having a GPU:
  94. # https://github.com/ggerganov/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
  95. cmake -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_METAL=OFF -DLLAMA_CURL=ON ..
  96. cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
  97. - name: Test
  98. id: cmake_test
  99. run: |
  100. cd build
  101. ctest -L main --verbose --timeout 900
  102. - name: Determine tag name
  103. id: tag
  104. shell: bash
  105. run: |
  106. BUILD_NUMBER="$(git rev-list --count HEAD)"
  107. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  108. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  109. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  110. else
  111. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  112. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  113. fi
  114. - name: Pack artifacts
  115. id: pack_artifacts
  116. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  117. run: |
  118. cp LICENSE ./build/bin/
  119. zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip ./build/bin/*
  120. - name: Upload artifacts
  121. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  122. uses: actions/upload-artifact@v4
  123. with:
  124. path: llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip
  125. name: llama-bin-macos-x64.zip
  126. ubuntu-focal-make:
  127. runs-on: ubuntu-20.04
  128. env:
  129. LLAMA_NODE_AVAILABLE: true
  130. LLAMA_PYTHON_AVAILABLE: true
  131. steps:
  132. - name: Clone
  133. id: checkout
  134. uses: actions/checkout@v4
  135. - name: Dependencies
  136. id: depends
  137. run: |
  138. sudo apt-get update
  139. sudo apt-get install build-essential gcc-8
  140. - uses: actions/setup-node@v4
  141. with:
  142. node-version: "20"
  143. - uses: actions/setup-python@v5
  144. with:
  145. python-version: "3.11"
  146. - name: Build
  147. id: make_build
  148. env:
  149. LLAMA_FATAL_WARNINGS: 1
  150. run: |
  151. CC=gcc-8 make -j $(nproc)
  152. - name: Test
  153. id: make_test
  154. run: |
  155. CC=gcc-8 make tests -j $(nproc)
  156. make test -j $(nproc)
  157. ubuntu-focal-make-curl:
  158. runs-on: ubuntu-20.04
  159. steps:
  160. - name: Clone
  161. id: checkout
  162. uses: actions/checkout@v4
  163. - name: Dependencies
  164. id: depends
  165. run: |
  166. sudo apt-get update
  167. sudo apt-get install build-essential gcc-8 libcurl4-openssl-dev
  168. - name: Build
  169. id: make_build
  170. env:
  171. LLAMA_FATAL_WARNINGS: 1
  172. LLAMA_CURL: 1
  173. run: |
  174. CC=gcc-8 make -j $(nproc)
  175. ubuntu-latest-cmake:
  176. runs-on: ubuntu-latest
  177. steps:
  178. - name: Clone
  179. id: checkout
  180. uses: actions/checkout@v4
  181. with:
  182. fetch-depth: 0
  183. - name: Dependencies
  184. id: depends
  185. run: |
  186. sudo apt-get update
  187. sudo apt-get install build-essential libcurl4-openssl-dev
  188. - name: Build
  189. id: cmake_build
  190. run: |
  191. mkdir build
  192. cd build
  193. cmake .. -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_CURL=ON
  194. cmake --build . --config Release -j $(nproc)
  195. - name: Test
  196. id: cmake_test
  197. run: |
  198. cd build
  199. ctest -L 'main|curl' --verbose --timeout 900
  200. - name: Test llama2c conversion
  201. id: llama2c_test
  202. run: |
  203. cd build
  204. echo "Fetch tokenizer"
  205. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  206. echo "Fetch llama2c model"
  207. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  208. ./bin/convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  209. ./bin/main -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  210. - name: Determine tag name
  211. id: tag
  212. shell: bash
  213. run: |
  214. BUILD_NUMBER="$(git rev-list --count HEAD)"
  215. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  216. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  217. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  218. else
  219. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  220. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  221. fi
  222. - name: Pack artifacts
  223. id: pack_artifacts
  224. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  225. run: |
  226. cp LICENSE ./build/bin/
  227. zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip ./build/bin/*
  228. - name: Upload artifacts
  229. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  230. uses: actions/upload-artifact@v4
  231. with:
  232. path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip
  233. name: llama-bin-ubuntu-x64.zip
  234. # ubuntu-latest-cmake-sanitizer:
  235. # runs-on: ubuntu-latest
  236. #
  237. # continue-on-error: true
  238. #
  239. # strategy:
  240. # matrix:
  241. # sanitizer: [ADDRESS, THREAD, UNDEFINED]
  242. # build_type: [Debug, Release]
  243. #
  244. # steps:
  245. # - name: Clone
  246. # id: checkout
  247. # uses: actions/checkout@v4
  248. #
  249. # - name: Dependencies
  250. # id: depends
  251. # run: |
  252. # sudo apt-get update
  253. # sudo apt-get install build-essential
  254. #
  255. # - name: Build
  256. # id: cmake_build
  257. # run: |
  258. # mkdir build
  259. # cd build
  260. # cmake .. -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
  261. # cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
  262. #
  263. # - name: Test
  264. # id: cmake_test
  265. # run: |
  266. # cd build
  267. # ctest -L main --verbose --timeout 900
  268. ubuntu-latest-cmake-mpi:
  269. runs-on: ubuntu-latest
  270. continue-on-error: true
  271. strategy:
  272. matrix:
  273. mpi_library: [mpich, libopenmpi-dev]
  274. steps:
  275. - name: Clone
  276. id: checkout
  277. uses: actions/checkout@v4
  278. - name: Dependencies
  279. id: depends
  280. run: |
  281. sudo apt-get update
  282. sudo apt-get install build-essential ${{ matrix.mpi_library }}
  283. - name: Build
  284. id: cmake_build
  285. run: |
  286. mkdir build
  287. cd build
  288. cmake -DLLAMA_MPI=ON ..
  289. cmake --build . --config Release -j $(nproc)
  290. - name: Test
  291. id: cmake_test
  292. run: |
  293. cd build
  294. ctest -L main --verbose
  295. ubuntu-22-cmake-vulkan:
  296. runs-on: ubuntu-22.04
  297. steps:
  298. - name: Clone
  299. id: checkout
  300. uses: actions/checkout@v4
  301. - name: Dependencies
  302. id: depends
  303. run: |
  304. sudo apt-get update
  305. sudo apt-get install build-essential libvulkan-dev
  306. - name: Build
  307. id: cmake_build
  308. run: |
  309. mkdir build
  310. cd build
  311. cmake -DLLAMA_VULKAN=ON ..
  312. cmake --build . --config Release -j $(nproc)
  313. ubuntu-22-cmake-sycl:
  314. runs-on: ubuntu-22.04
  315. continue-on-error: true
  316. steps:
  317. - uses: actions/checkout@v2
  318. - name: add oneAPI to apt
  319. shell: bash
  320. run: |
  321. cd /tmp
  322. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  323. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  324. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  325. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  326. - name: install oneAPI dpcpp compiler
  327. shell: bash
  328. run: |
  329. sudo apt update
  330. sudo apt install intel-oneapi-compiler-dpcpp-cpp
  331. - name: install oneAPI MKL library
  332. shell: bash
  333. run: |
  334. sudo apt install intel-oneapi-mkl-devel
  335. - name: Clone
  336. id: checkout
  337. uses: actions/checkout@v4
  338. - name: Build
  339. id: cmake_build
  340. run: |
  341. source /opt/intel/oneapi/setvars.sh
  342. mkdir build
  343. cd build
  344. cmake -DLLAMA_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
  345. cmake --build . --config Release -j $(nproc)
  346. ubuntu-22-cmake-sycl-fp16:
  347. runs-on: ubuntu-22.04
  348. continue-on-error: true
  349. steps:
  350. - uses: actions/checkout@v2
  351. - name: add oneAPI to apt
  352. shell: bash
  353. run: |
  354. cd /tmp
  355. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  356. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  357. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  358. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  359. - name: install oneAPI dpcpp compiler
  360. shell: bash
  361. run: |
  362. sudo apt update
  363. sudo apt install intel-oneapi-compiler-dpcpp-cpp
  364. - name: install oneAPI MKL library
  365. shell: bash
  366. run: |
  367. sudo apt install intel-oneapi-mkl-devel
  368. - name: Clone
  369. id: checkout
  370. uses: actions/checkout@v4
  371. - name: Build
  372. id: cmake_build
  373. run: |
  374. source /opt/intel/oneapi/setvars.sh
  375. mkdir build
  376. cd build
  377. cmake -DLLAMA_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DLLAMA_SYCL_F16=ON ..
  378. cmake --build . --config Release -j $(nproc)
  379. # TODO: build with LLAMA_NO_METAL because test-backend-ops fail on "Apple Paravirtual device" and I don't know
  380. # how to debug it.
  381. # ref: https://github.com/ggerganov/llama.cpp/actions/runs/7131777249/job/19420981052#step:5:1124
  382. macOS-latest-make:
  383. runs-on: macos-latest
  384. steps:
  385. - name: Clone
  386. id: checkout
  387. uses: actions/checkout@v4
  388. - name: Dependencies
  389. id: depends
  390. continue-on-error: true
  391. run: |
  392. brew update
  393. - name: Build
  394. id: make_build
  395. env:
  396. LLAMA_FATAL_WARNINGS: 1
  397. run: |
  398. LLAMA_NO_METAL=1 make -j $(sysctl -n hw.logicalcpu)
  399. - name: Test
  400. id: make_test
  401. run: |
  402. LLAMA_NO_METAL=1 make tests -j $(sysctl -n hw.logicalcpu)
  403. LLAMA_NO_METAL=1 make test -j $(sysctl -n hw.logicalcpu)
  404. # TODO: build with LLAMA_METAL=OFF because test-backend-ops fail on "Apple Paravirtual device" and I don't know
  405. # how to debug it.
  406. # ref: https://github.com/ggerganov/llama.cpp/actions/runs/7132125951/job/19422043567?pr=4359#step:5:6584
  407. # would be great if we fix these
  408. macOS-latest-cmake:
  409. runs-on: macos-latest
  410. steps:
  411. - name: Clone
  412. id: checkout
  413. uses: actions/checkout@v4
  414. - name: Dependencies
  415. id: depends
  416. continue-on-error: true
  417. run: |
  418. brew update
  419. - name: Build
  420. id: cmake_build
  421. run: |
  422. sysctl -a
  423. mkdir build
  424. cd build
  425. cmake -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_METAL=OFF ..
  426. cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
  427. - name: Test
  428. id: cmake_test
  429. run: |
  430. cd build
  431. ctest -L main --verbose --timeout 900
  432. macOS-latest-cmake-ios:
  433. runs-on: macos-latest
  434. steps:
  435. - name: Clone
  436. id: checkout
  437. uses: actions/checkout@v1
  438. - name: Dependencies
  439. id: depends
  440. continue-on-error: true
  441. run: |
  442. brew update
  443. - name: Build
  444. id: cmake_build
  445. run: |
  446. sysctl -a
  447. mkdir build
  448. cd build
  449. cmake -G Xcode .. \
  450. -DLLAMA_METAL_EMBED_LIBRARY=ON \
  451. -DLLAMA_BUILD_EXAMPLES=OFF \
  452. -DLLAMA_BUILD_TESTS=OFF \
  453. -DLLAMA_BUILD_SERVER=OFF \
  454. -DCMAKE_SYSTEM_NAME=iOS \
  455. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0
  456. cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
  457. macOS-latest-cmake-tvos:
  458. runs-on: macos-latest
  459. steps:
  460. - name: Clone
  461. id: checkout
  462. uses: actions/checkout@v1
  463. - name: Dependencies
  464. id: depends
  465. continue-on-error: true
  466. run: |
  467. brew update
  468. - name: Build
  469. id: cmake_build
  470. run: |
  471. sysctl -a
  472. mkdir build
  473. cd build
  474. cmake -G Xcode .. \
  475. -DLLAMA_METAL_EMBED_LIBRARY=ON \
  476. -DLLAMA_BUILD_EXAMPLES=OFF \
  477. -DLLAMA_BUILD_TESTS=OFF \
  478. -DLLAMA_BUILD_SERVER=OFF \
  479. -DCMAKE_SYSTEM_NAME=tvOS \
  480. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0
  481. cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
  482. macOS-latest-swift:
  483. runs-on: macos-latest
  484. strategy:
  485. matrix:
  486. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  487. steps:
  488. - name: Clone
  489. id: checkout
  490. uses: actions/checkout@v1
  491. - name: Dependencies
  492. id: depends
  493. continue-on-error: true
  494. run: |
  495. brew update
  496. - name: xcodebuild for swift package
  497. id: xcodebuild
  498. run: |
  499. xcodebuild -scheme llama -destination "${{ matrix.destination }}"
  500. - name: Build Swift Example
  501. id: make_build_swift_example
  502. run: |
  503. make swift
  504. windows-latest-cmake:
  505. runs-on: windows-latest
  506. env:
  507. OPENBLAS_VERSION: 0.3.23
  508. OPENCL_VERSION: 2023.04.17
  509. CLBLAST_VERSION: 1.6.0
  510. SDE_VERSION: 9.33.0-2024-01-07
  511. VULKAN_VERSION: 1.3.261.1
  512. strategy:
  513. matrix:
  514. include:
  515. - build: 'noavx'
  516. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DBUILD_SHARED_LIBS=ON'
  517. - build: 'avx2'
  518. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
  519. - build: 'avx'
  520. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX2=OFF -DBUILD_SHARED_LIBS=ON'
  521. - build: 'avx512'
  522. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX512=ON -DBUILD_SHARED_LIBS=ON'
  523. - build: 'clblast'
  524. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CLBLAST=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/clblast"'
  525. - build: 'openblas'
  526. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'
  527. - build: 'kompute'
  528. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_KOMPUTE=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON -DBUILD_SHARED_LIBS=ON'
  529. - build: 'vulkan'
  530. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_VULKAN=ON -DBUILD_SHARED_LIBS=ON'
  531. - build: 'arm64'
  532. defines: '-A ARM64 -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
  533. steps:
  534. - name: Clone
  535. id: checkout
  536. uses: actions/checkout@v4
  537. with:
  538. fetch-depth: 0
  539. - name: Clone Kompute submodule
  540. id: clone_kompute
  541. if: ${{ matrix.build == 'kompute' }}
  542. run: |
  543. git submodule update --init kompute
  544. - name: Download OpenCL SDK
  545. id: get_opencl
  546. if: ${{ matrix.build == 'clblast' }}
  547. run: |
  548. curl.exe -o $env:RUNNER_TEMP/opencl.zip -L "https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v${env:OPENCL_VERSION}/OpenCL-SDK-v${env:OPENCL_VERSION}-Win-x64.zip"
  549. mkdir $env:RUNNER_TEMP/opencl
  550. tar.exe -xvf $env:RUNNER_TEMP/opencl.zip --strip-components=1 -C $env:RUNNER_TEMP/opencl
  551. - name: Download CLBlast
  552. id: get_clblast
  553. if: ${{ matrix.build == 'clblast' }}
  554. run: |
  555. curl.exe -o $env:RUNNER_TEMP/clblast.7z -L "https://github.com/CNugteren/CLBlast/releases/download/${env:CLBLAST_VERSION}/CLBlast-${env:CLBLAST_VERSION}-windows-x64.7z"
  556. curl.exe -o $env:RUNNER_TEMP/CLBlast.LICENSE.txt -L "https://github.com/CNugteren/CLBlast/raw/${env:CLBLAST_VERSION}/LICENSE"
  557. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/clblast.7z
  558. rename-item $env:RUNNER_TEMP/CLBlast-${env:CLBLAST_VERSION}-windows-x64 clblast
  559. foreach ($f in (gci -Recurse -Path "$env:RUNNER_TEMP/clblast" -Filter '*.cmake')) {
  560. $txt = Get-Content -Path $f -Raw
  561. $txt.Replace('C:/vcpkg/packages/opencl_x64-windows/', "$($env:RUNNER_TEMP.Replace('\','/'))/opencl/") | Set-Content -Path $f -Encoding UTF8
  562. }
  563. - name: Download OpenBLAS
  564. id: get_openblas
  565. if: ${{ matrix.build == 'openblas' }}
  566. run: |
  567. 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"
  568. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  569. mkdir $env:RUNNER_TEMP/openblas
  570. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  571. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  572. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  573. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  574. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  575. - name: Install Vulkan SDK
  576. id: get_vulkan
  577. if: ${{ matrix.build == 'kompute' || matrix.build == 'vulkan' }}
  578. run: |
  579. 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"
  580. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  581. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  582. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  583. - name: Build
  584. id: cmake_build
  585. run: |
  586. mkdir build
  587. cd build
  588. cmake .. ${{ matrix.defines }}
  589. cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
  590. - name: Add clblast.dll
  591. id: add_clblast_dll
  592. if: ${{ matrix.build == 'clblast' }}
  593. run: |
  594. cp $env:RUNNER_TEMP/clblast/lib/clblast.dll ./build/bin/Release
  595. cp $env:RUNNER_TEMP/CLBlast.LICENSE.txt ./build/bin/Release/CLBlast-${env:CLBLAST_VERSION}.txt
  596. - name: Add libopenblas.dll
  597. id: add_libopenblas_dll
  598. if: ${{ matrix.build == 'openblas' }}
  599. run: |
  600. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  601. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  602. - name: Check AVX512F support
  603. id: check_avx512f
  604. if: ${{ matrix.build == 'avx512' }}
  605. continue-on-error: true
  606. run: |
  607. cd build
  608. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  609. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  610. $cl = $(join-path $msvc 'bin\Hostx64\x64\cl.exe')
  611. echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c
  612. & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
  613. .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
  614. - name: Test
  615. id: cmake_test
  616. # not all machines have native AVX-512
  617. if: ${{ matrix.build != 'arm64' && matrix.build != 'clblast' && matrix.build != 'kompute' && matrix.build != 'vulkan' && (matrix.build != 'avx512' || env.HAS_AVX512F == '1') }}
  618. run: |
  619. cd build
  620. ctest -L main -C Release --verbose --timeout 900
  621. - name: Test (Intel SDE)
  622. id: cmake_test_sde
  623. if: ${{ matrix.build == 'avx512' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  624. run: |
  625. curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  626. # for some weird reason windows tar doesn't like sde tar.xz
  627. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  628. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  629. $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  630. cd build
  631. & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  632. - name: Determine tag name
  633. id: tag
  634. shell: bash
  635. run: |
  636. BUILD_NUMBER="$(git rev-list --count HEAD)"
  637. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  638. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  639. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  640. else
  641. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  642. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  643. fi
  644. - name: Pack artifacts
  645. id: pack_artifacts
  646. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  647. run: |
  648. Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
  649. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip .\build\bin\Release\*
  650. - name: Upload artifacts
  651. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  652. uses: actions/upload-artifact@v4
  653. with:
  654. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip
  655. name: llama-bin-win-${{ matrix.build }}-x64.zip
  656. windows-latest-cmake-cuda:
  657. runs-on: windows-latest
  658. strategy:
  659. matrix:
  660. cuda: ['12.2.0', '11.7.1']
  661. build: ['cuda']
  662. steps:
  663. - name: Clone
  664. id: checkout
  665. uses: actions/checkout@v4
  666. with:
  667. fetch-depth: 0
  668. - uses: Jimver/cuda-toolkit@v0.2.11
  669. id: cuda-toolkit
  670. with:
  671. cuda: ${{ matrix.cuda }}
  672. method: 'network'
  673. sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
  674. - name: Build
  675. id: cmake_build
  676. run: |
  677. mkdir build
  678. cd build
  679. cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUDA=ON -DBUILD_SHARED_LIBS=ON
  680. cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
  681. - name: Determine tag name
  682. id: tag
  683. shell: bash
  684. run: |
  685. BUILD_NUMBER="$(git rev-list --count HEAD)"
  686. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  687. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  688. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  689. else
  690. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  691. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  692. fi
  693. - name: Pack artifacts
  694. id: pack_artifacts
  695. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  696. run: |
  697. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
  698. - name: Upload artifacts
  699. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  700. uses: actions/upload-artifact@v4
  701. with:
  702. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
  703. name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  704. - name: Copy and pack Cuda runtime
  705. run: |
  706. echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
  707. $dst='.\build\bin\cudart\'
  708. robocopy "${{steps.cuda-toolkit.outputs.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  709. 7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
  710. - name: Upload Cuda runtime
  711. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  712. uses: actions/upload-artifact@v4
  713. with:
  714. path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  715. name: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  716. windows-latest-cmake-sycl:
  717. runs-on: windows-latest
  718. defaults:
  719. run:
  720. shell: bash
  721. env:
  722. WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/62641e01-1e8d-4ace-91d6-ae03f7f8a71f/w_BaseKit_p_2024.0.0.49563_offline.exe
  723. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel
  724. steps:
  725. - name: Clone
  726. id: checkout
  727. uses: actions/checkout@v4
  728. with:
  729. fetch-depth: 0
  730. - name: Install
  731. run: scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  732. - name: Build
  733. id: cmake_build
  734. run: examples/sycl/win-build-sycl.bat
  735. - name: Determine tag name
  736. id: tag
  737. shell: bash
  738. run: |
  739. BUILD_NUMBER="$(git rev-list --count HEAD)"
  740. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  741. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  742. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  743. else
  744. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  745. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  746. fi
  747. - name: Pack artifacts
  748. id: pack_artifacts
  749. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  750. run: |
  751. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*
  752. - name: Upload artifacts
  753. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  754. uses: actions/upload-artifact@v4
  755. with:
  756. path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip
  757. name: llama-bin-win-sycl-x64.zip
  758. ios-xcode-build:
  759. runs-on: macos-latest
  760. steps:
  761. - name: Checkout code
  762. uses: actions/checkout@v4
  763. - name: Build Xcode project
  764. 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
  765. android-build:
  766. runs-on: ubuntu-latest
  767. steps:
  768. - name: Clone
  769. uses: actions/checkout@v4
  770. - name: Set up JDK
  771. uses: actions/setup-java@v3
  772. with:
  773. java-version: 17
  774. distribution: zulu
  775. - name: Setup Android SDK
  776. uses: android-actions/setup-android@v3
  777. with:
  778. log-accepted-android-sdk-licenses: false
  779. - name: Build
  780. run: |
  781. cd examples/llama.android
  782. ./gradlew build --no-daemon
  783. # freeBSD-latest:
  784. # runs-on: macos-12
  785. # steps:
  786. # - name: Clone
  787. # uses: actions/checkout@v4
  788. #
  789. # - name: Build
  790. # uses: cross-platform-actions/action@v0.19.0
  791. # with:
  792. # operating_system: freebsd
  793. # version: '13.2'
  794. # hypervisor: 'qemu'
  795. # run: |
  796. # sudo pkg update
  797. # sudo pkg install -y gmake automake autoconf pkgconf llvm15 clinfo clover opencl clblast openblas
  798. # gmake CC=/usr/local/bin/clang15 CXX=/usr/local/bin/clang++15 -j `sysctl -n hw.ncpu`
  799. release:
  800. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  801. runs-on: ubuntu-latest
  802. needs:
  803. - ubuntu-focal-make
  804. - ubuntu-latest-cmake
  805. - macOS-latest-make
  806. - macOS-latest-cmake
  807. - windows-latest-cmake
  808. - windows-latest-cmake-cuda
  809. - macOS-latest-cmake-arm64
  810. - macOS-latest-cmake-x64
  811. steps:
  812. - name: Clone
  813. id: checkout
  814. uses: actions/checkout@v4
  815. with:
  816. fetch-depth: 0
  817. - name: Determine tag name
  818. id: tag
  819. shell: bash
  820. run: |
  821. BUILD_NUMBER="$(git rev-list --count HEAD)"
  822. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  823. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  824. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  825. else
  826. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  827. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  828. fi
  829. - name: Download artifacts
  830. id: download-artifact
  831. uses: actions/download-artifact@v4
  832. with:
  833. path: ./artifact
  834. - name: Move artifacts
  835. id: move_artifacts
  836. run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
  837. - name: Create release
  838. id: create_release
  839. uses: anzz1/action-create-release@v1
  840. env:
  841. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  842. with:
  843. tag_name: ${{ steps.tag.outputs.name }}
  844. - name: Upload release
  845. id: upload_release
  846. uses: actions/github-script@v3
  847. with:
  848. github-token: ${{secrets.GITHUB_TOKEN}}
  849. script: |
  850. const path = require('path');
  851. const fs = require('fs');
  852. const release_id = '${{ steps.create_release.outputs.id }}';
  853. for (let file of await fs.readdirSync('./artifact/release')) {
  854. if (path.extname(file) === '.zip') {
  855. console.log('uploadReleaseAsset', file);
  856. await github.repos.uploadReleaseAsset({
  857. owner: context.repo.owner,
  858. repo: context.repo.repo,
  859. release_id: release_id,
  860. name: file,
  861. data: await fs.readFileSync(`./artifact/release/${file}`)
  862. });
  863. }
  864. }
  865. # ubuntu-latest-gcc:
  866. # runs-on: ubuntu-latest
  867. #
  868. # strategy:
  869. # matrix:
  870. # build: [Debug, Release]
  871. #
  872. # steps:
  873. # - name: Clone
  874. # uses: actions/checkout@v4
  875. #
  876. # - name: Dependencies
  877. # run: |
  878. # sudo apt-get update
  879. # sudo apt-get install build-essential
  880. # sudo apt-get install cmake
  881. #
  882. # - name: Configure
  883. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  884. #
  885. # - name: Build
  886. # run: |
  887. # make
  888. #
  889. # ubuntu-latest-clang:
  890. # runs-on: ubuntu-latest
  891. #
  892. # strategy:
  893. # matrix:
  894. # build: [Debug, Release]
  895. #
  896. # steps:
  897. # - name: Clone
  898. # uses: actions/checkout@v4
  899. #
  900. # - name: Dependencies
  901. # run: |
  902. # sudo apt-get update
  903. # sudo apt-get install build-essential
  904. # sudo apt-get install cmake
  905. #
  906. # - name: Configure
  907. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
  908. #
  909. # - name: Build
  910. # run: |
  911. # make
  912. #
  913. # ubuntu-latest-gcc-sanitized:
  914. # runs-on: ubuntu-latest
  915. #
  916. # strategy:
  917. # matrix:
  918. # sanitizer: [ADDRESS, THREAD, UNDEFINED]
  919. #
  920. # steps:
  921. # - name: Clone
  922. # uses: actions/checkout@v4
  923. #
  924. # - name: Dependencies
  925. # run: |
  926. # sudo apt-get update
  927. # sudo apt-get install build-essential
  928. # sudo apt-get install cmake
  929. #
  930. # - name: Configure
  931. # run: cmake . -DCMAKE_BUILD_TYPE=Debug -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON
  932. #
  933. # - name: Build
  934. # run: |
  935. # make
  936. #
  937. # windows:
  938. # runs-on: windows-latest
  939. #
  940. # strategy:
  941. # matrix:
  942. # build: [Release]
  943. # arch: [Win32, x64]
  944. # include:
  945. # - arch: Win32
  946. # s2arc: x86
  947. # - arch: x64
  948. # s2arc: x64
  949. #
  950. # steps:
  951. # - name: Clone
  952. # uses: actions/checkout@v4
  953. #
  954. # - name: Add msbuild to PATH
  955. # uses: microsoft/setup-msbuild@v1
  956. #
  957. # - name: Configure
  958. # run: >
  959. # cmake -S . -B ./build -A ${{ matrix.arch }}
  960. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  961. #
  962. # - name: Build
  963. # run: |
  964. # cd ./build
  965. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  966. #
  967. # - name: Upload binaries
  968. # uses: actions/upload-artifact@v4
  969. # with:
  970. # name: llama-bin-${{ matrix.arch }}
  971. # path: build/bin/${{ matrix.build }}
  972. #
  973. # windows-blas:
  974. # runs-on: windows-latest
  975. #
  976. # strategy:
  977. # matrix:
  978. # build: [Release]
  979. # arch: [Win32, x64]
  980. # blas: [ON]
  981. # include:
  982. # - arch: Win32
  983. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x86.zip
  984. # s2arc: x86
  985. # - arch: x64
  986. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
  987. # s2arc: x64
  988. #
  989. # steps:
  990. # - name: Clone
  991. # uses: actions/checkout@v4
  992. #
  993. # - name: Add msbuild to PATH
  994. # uses: microsoft/setup-msbuild@v1
  995. #
  996. # - name: Fetch OpenBLAS
  997. # if: matrix.blas == 'ON'
  998. # run: |
  999. # C:/msys64/usr/bin/wget.exe -qO blas.zip ${{ matrix.obzip }}
  1000. # 7z x blas.zip -oblas -y
  1001. # copy blas/include/cblas.h .
  1002. # copy blas/include/openblas_config.h .
  1003. # echo "blasdir=$env:GITHUB_WORKSPACE/blas" >> $env:GITHUB_ENV
  1004. #
  1005. # - name: Configure
  1006. # run: >
  1007. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1008. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1009. # -DLLAMA_SUPPORT_OPENBLAS=${{ matrix.blas }}
  1010. # -DCMAKE_LIBRARY_PATH="$env:blasdir/lib"
  1011. #
  1012. # - name: Build
  1013. # run: |
  1014. # cd ./build
  1015. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1016. #
  1017. # - name: Copy libopenblas.dll
  1018. # if: matrix.blas == 'ON'
  1019. # run: copy "$env:blasdir/bin/libopenblas.dll" build/bin/${{ matrix.build }}
  1020. #
  1021. # - name: Upload binaries
  1022. # if: matrix.blas == 'ON'
  1023. # uses: actions/upload-artifact@v4
  1024. # with:
  1025. # name: llama-blas-bin-${{ matrix.arch }}
  1026. # path: build/bin/${{ matrix.build }}
  1027. #
  1028. # emscripten:
  1029. # runs-on: ubuntu-latest
  1030. #
  1031. # strategy:
  1032. # matrix:
  1033. # build: [Release]
  1034. #
  1035. # steps:
  1036. # - name: Clone
  1037. # uses: actions/checkout@v4
  1038. #
  1039. # - name: Dependencies
  1040. # run: |
  1041. # wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
  1042. # tar -xvf master.tar.gz
  1043. # emsdk-master/emsdk update
  1044. # emsdk-master/emsdk install latest
  1045. # emsdk-master/emsdk activate latest
  1046. #
  1047. # - name: Configure
  1048. # run: echo "tmp"
  1049. #
  1050. # - name: Build
  1051. # run: |
  1052. # pushd emsdk-master
  1053. # source ./emsdk_env.sh
  1054. # popd
  1055. # emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1056. # make