build.yml 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  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-msys2:
  505. runs-on: windows-latest
  506. strategy:
  507. fail-fast: false
  508. matrix:
  509. include:
  510. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  511. - { sys: CLANG64, env: clang-x86_64, build: Release }
  512. steps:
  513. - name: Clone
  514. uses: actions/checkout@v4
  515. - name: Setup ${{ matrix.sys }}
  516. uses: msys2/setup-msys2@v2
  517. with:
  518. update: true
  519. msystem: ${{matrix.sys}}
  520. install: >-
  521. base-devel
  522. mingw-w64-${{matrix.env}}-toolchain
  523. mingw-w64-${{matrix.env}}-cmake
  524. mingw-w64-${{matrix.env}}-openblas
  525. - name: Build using make
  526. shell: msys2 {0}
  527. run: |
  528. make -j $(nproc)
  529. - name: Clean after building using make
  530. shell: msys2 {0}
  531. run: |
  532. make clean
  533. - name: Build using make w/ OpenBLAS
  534. shell: msys2 {0}
  535. run: |
  536. make LLAMA_OPENBLAS=1 -j $(nproc)
  537. - name: Build using CMake
  538. shell: msys2 {0}
  539. run: |
  540. cmake -B build
  541. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  542. - name: Clean after building using CMake
  543. shell: msys2 {0}
  544. run: |
  545. rm -rf build
  546. - name: Build using CMake w/ OpenBLAS
  547. shell: msys2 {0}
  548. run: |
  549. cmake -B build -DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS
  550. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  551. windows-latest-cmake:
  552. runs-on: windows-latest
  553. env:
  554. OPENBLAS_VERSION: 0.3.23
  555. OPENCL_VERSION: 2023.04.17
  556. CLBLAST_VERSION: 1.6.0
  557. SDE_VERSION: 9.33.0-2024-01-07
  558. VULKAN_VERSION: 1.3.261.1
  559. strategy:
  560. matrix:
  561. include:
  562. - build: 'noavx'
  563. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DBUILD_SHARED_LIBS=ON'
  564. - build: 'avx2'
  565. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
  566. - build: 'avx'
  567. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX2=OFF -DBUILD_SHARED_LIBS=ON'
  568. - build: 'avx512'
  569. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX512=ON -DBUILD_SHARED_LIBS=ON'
  570. - build: 'clblast'
  571. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CLBLAST=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/clblast"'
  572. - build: 'openblas'
  573. 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"'
  574. - build: 'kompute'
  575. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_KOMPUTE=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON -DBUILD_SHARED_LIBS=ON'
  576. - build: 'vulkan'
  577. defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_VULKAN=ON -DBUILD_SHARED_LIBS=ON'
  578. - build: 'arm64'
  579. defines: '-A ARM64 -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
  580. steps:
  581. - name: Clone
  582. id: checkout
  583. uses: actions/checkout@v4
  584. with:
  585. fetch-depth: 0
  586. - name: Clone Kompute submodule
  587. id: clone_kompute
  588. if: ${{ matrix.build == 'kompute' }}
  589. run: |
  590. git submodule update --init kompute
  591. - name: Download OpenCL SDK
  592. id: get_opencl
  593. if: ${{ matrix.build == 'clblast' }}
  594. run: |
  595. 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"
  596. mkdir $env:RUNNER_TEMP/opencl
  597. tar.exe -xvf $env:RUNNER_TEMP/opencl.zip --strip-components=1 -C $env:RUNNER_TEMP/opencl
  598. - name: Download CLBlast
  599. id: get_clblast
  600. if: ${{ matrix.build == 'clblast' }}
  601. run: |
  602. 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"
  603. curl.exe -o $env:RUNNER_TEMP/CLBlast.LICENSE.txt -L "https://github.com/CNugteren/CLBlast/raw/${env:CLBLAST_VERSION}/LICENSE"
  604. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/clblast.7z
  605. rename-item $env:RUNNER_TEMP/CLBlast-${env:CLBLAST_VERSION}-windows-x64 clblast
  606. foreach ($f in (gci -Recurse -Path "$env:RUNNER_TEMP/clblast" -Filter '*.cmake')) {
  607. $txt = Get-Content -Path $f -Raw
  608. $txt.Replace('C:/vcpkg/packages/opencl_x64-windows/', "$($env:RUNNER_TEMP.Replace('\','/'))/opencl/") | Set-Content -Path $f -Encoding UTF8
  609. }
  610. - name: Download OpenBLAS
  611. id: get_openblas
  612. if: ${{ matrix.build == 'openblas' }}
  613. run: |
  614. 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"
  615. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  616. mkdir $env:RUNNER_TEMP/openblas
  617. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  618. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  619. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  620. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  621. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  622. - name: Install Vulkan SDK
  623. id: get_vulkan
  624. if: ${{ matrix.build == 'kompute' || matrix.build == 'vulkan' }}
  625. run: |
  626. 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"
  627. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  628. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  629. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  630. - name: Build
  631. id: cmake_build
  632. run: |
  633. mkdir build
  634. cd build
  635. cmake .. ${{ matrix.defines }}
  636. cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
  637. - name: Add clblast.dll
  638. id: add_clblast_dll
  639. if: ${{ matrix.build == 'clblast' }}
  640. run: |
  641. cp $env:RUNNER_TEMP/clblast/lib/clblast.dll ./build/bin/Release
  642. cp $env:RUNNER_TEMP/CLBlast.LICENSE.txt ./build/bin/Release/CLBlast-${env:CLBLAST_VERSION}.txt
  643. - name: Add libopenblas.dll
  644. id: add_libopenblas_dll
  645. if: ${{ matrix.build == 'openblas' }}
  646. run: |
  647. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  648. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  649. - name: Check AVX512F support
  650. id: check_avx512f
  651. if: ${{ matrix.build == 'avx512' }}
  652. continue-on-error: true
  653. run: |
  654. cd build
  655. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  656. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  657. $cl = $(join-path $msvc 'bin\Hostx64\x64\cl.exe')
  658. echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c
  659. & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
  660. .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
  661. - name: Test
  662. id: cmake_test
  663. # not all machines have native AVX-512
  664. if: ${{ matrix.build != 'arm64' && matrix.build != 'clblast' && matrix.build != 'kompute' && matrix.build != 'vulkan' && (matrix.build != 'avx512' || env.HAS_AVX512F == '1') }}
  665. run: |
  666. cd build
  667. ctest -L main -C Release --verbose --timeout 900
  668. - name: Test (Intel SDE)
  669. id: cmake_test_sde
  670. if: ${{ matrix.build == 'avx512' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  671. run: |
  672. curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  673. # for some weird reason windows tar doesn't like sde tar.xz
  674. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  675. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  676. $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  677. cd build
  678. & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  679. - name: Determine tag name
  680. id: tag
  681. shell: bash
  682. run: |
  683. BUILD_NUMBER="$(git rev-list --count HEAD)"
  684. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  685. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  686. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  687. else
  688. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  689. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  690. fi
  691. - name: Pack artifacts
  692. id: pack_artifacts
  693. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  694. run: |
  695. Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
  696. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip .\build\bin\Release\*
  697. - name: Upload artifacts
  698. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  699. uses: actions/upload-artifact@v4
  700. with:
  701. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip
  702. name: llama-bin-win-${{ matrix.build }}-x64.zip
  703. windows-latest-cmake-cuda:
  704. runs-on: windows-latest
  705. strategy:
  706. matrix:
  707. cuda: ['12.2.0', '11.7.1']
  708. build: ['cuda']
  709. steps:
  710. - name: Clone
  711. id: checkout
  712. uses: actions/checkout@v4
  713. with:
  714. fetch-depth: 0
  715. - uses: Jimver/cuda-toolkit@v0.2.11
  716. id: cuda-toolkit
  717. with:
  718. cuda: ${{ matrix.cuda }}
  719. method: 'network'
  720. sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
  721. - name: Build
  722. id: cmake_build
  723. run: |
  724. mkdir build
  725. cd build
  726. cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUDA=ON -DBUILD_SHARED_LIBS=ON
  727. cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
  728. - name: Determine tag name
  729. id: tag
  730. shell: bash
  731. run: |
  732. BUILD_NUMBER="$(git rev-list --count HEAD)"
  733. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  734. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  735. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  736. else
  737. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  738. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  739. fi
  740. - name: Pack artifacts
  741. id: pack_artifacts
  742. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  743. run: |
  744. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
  745. - name: Upload artifacts
  746. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  747. uses: actions/upload-artifact@v4
  748. with:
  749. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
  750. name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  751. - name: Copy and pack Cuda runtime
  752. run: |
  753. echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
  754. $dst='.\build\bin\cudart\'
  755. robocopy "${{steps.cuda-toolkit.outputs.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  756. 7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
  757. - name: Upload Cuda runtime
  758. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  759. uses: actions/upload-artifact@v4
  760. with:
  761. path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  762. name: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  763. windows-latest-cmake-sycl:
  764. runs-on: windows-latest
  765. defaults:
  766. run:
  767. shell: bash
  768. env:
  769. 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
  770. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel
  771. steps:
  772. - name: Clone
  773. id: checkout
  774. uses: actions/checkout@v4
  775. with:
  776. fetch-depth: 0
  777. - name: Install
  778. run: scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  779. - name: Build
  780. id: cmake_build
  781. run: examples/sycl/win-build-sycl.bat
  782. - name: Determine tag name
  783. id: tag
  784. shell: bash
  785. run: |
  786. BUILD_NUMBER="$(git rev-list --count HEAD)"
  787. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  788. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  789. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  790. else
  791. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  792. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  793. fi
  794. - name: Pack artifacts
  795. id: pack_artifacts
  796. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  797. run: |
  798. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*
  799. - name: Upload artifacts
  800. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  801. uses: actions/upload-artifact@v4
  802. with:
  803. path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip
  804. name: llama-bin-win-sycl-x64.zip
  805. ios-xcode-build:
  806. runs-on: macos-latest
  807. steps:
  808. - name: Checkout code
  809. uses: actions/checkout@v4
  810. - name: Build Xcode project
  811. 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
  812. android-build:
  813. runs-on: ubuntu-latest
  814. steps:
  815. - name: Clone
  816. uses: actions/checkout@v4
  817. - name: Set up JDK
  818. uses: actions/setup-java@v3
  819. with:
  820. java-version: 17
  821. distribution: zulu
  822. - name: Setup Android SDK
  823. uses: android-actions/setup-android@v3
  824. with:
  825. log-accepted-android-sdk-licenses: false
  826. - name: Build
  827. run: |
  828. cd examples/llama.android
  829. ./gradlew build --no-daemon
  830. # freeBSD-latest:
  831. # runs-on: macos-12
  832. # steps:
  833. # - name: Clone
  834. # uses: actions/checkout@v4
  835. #
  836. # - name: Build
  837. # uses: cross-platform-actions/action@v0.19.0
  838. # with:
  839. # operating_system: freebsd
  840. # version: '13.2'
  841. # hypervisor: 'qemu'
  842. # run: |
  843. # sudo pkg update
  844. # sudo pkg install -y gmake automake autoconf pkgconf llvm15 clinfo clover opencl clblast openblas
  845. # gmake CC=/usr/local/bin/clang15 CXX=/usr/local/bin/clang++15 -j `sysctl -n hw.ncpu`
  846. release:
  847. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  848. runs-on: ubuntu-latest
  849. needs:
  850. - ubuntu-focal-make
  851. - ubuntu-latest-cmake
  852. - macOS-latest-make
  853. - macOS-latest-cmake
  854. - windows-latest-cmake
  855. - windows-latest-cmake-cuda
  856. - macOS-latest-cmake-arm64
  857. - macOS-latest-cmake-x64
  858. steps:
  859. - name: Clone
  860. id: checkout
  861. uses: actions/checkout@v4
  862. with:
  863. fetch-depth: 0
  864. - name: Determine tag name
  865. id: tag
  866. shell: bash
  867. run: |
  868. BUILD_NUMBER="$(git rev-list --count HEAD)"
  869. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  870. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  871. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  872. else
  873. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  874. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  875. fi
  876. - name: Download artifacts
  877. id: download-artifact
  878. uses: actions/download-artifact@v4
  879. with:
  880. path: ./artifact
  881. - name: Move artifacts
  882. id: move_artifacts
  883. run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
  884. - name: Create release
  885. id: create_release
  886. uses: anzz1/action-create-release@v1
  887. env:
  888. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  889. with:
  890. tag_name: ${{ steps.tag.outputs.name }}
  891. - name: Upload release
  892. id: upload_release
  893. uses: actions/github-script@v3
  894. with:
  895. github-token: ${{secrets.GITHUB_TOKEN}}
  896. script: |
  897. const path = require('path');
  898. const fs = require('fs');
  899. const release_id = '${{ steps.create_release.outputs.id }}';
  900. for (let file of await fs.readdirSync('./artifact/release')) {
  901. if (path.extname(file) === '.zip') {
  902. console.log('uploadReleaseAsset', file);
  903. await github.repos.uploadReleaseAsset({
  904. owner: context.repo.owner,
  905. repo: context.repo.repo,
  906. release_id: release_id,
  907. name: file,
  908. data: await fs.readFileSync(`./artifact/release/${file}`)
  909. });
  910. }
  911. }
  912. # ubuntu-latest-gcc:
  913. # runs-on: ubuntu-latest
  914. #
  915. # strategy:
  916. # matrix:
  917. # build: [Debug, Release]
  918. #
  919. # steps:
  920. # - name: Clone
  921. # uses: actions/checkout@v4
  922. #
  923. # - name: Dependencies
  924. # run: |
  925. # sudo apt-get update
  926. # sudo apt-get install build-essential
  927. # sudo apt-get install cmake
  928. #
  929. # - name: Configure
  930. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  931. #
  932. # - name: Build
  933. # run: |
  934. # make
  935. #
  936. # ubuntu-latest-clang:
  937. # runs-on: ubuntu-latest
  938. #
  939. # strategy:
  940. # matrix:
  941. # build: [Debug, Release]
  942. #
  943. # steps:
  944. # - name: Clone
  945. # uses: actions/checkout@v4
  946. #
  947. # - name: Dependencies
  948. # run: |
  949. # sudo apt-get update
  950. # sudo apt-get install build-essential
  951. # sudo apt-get install cmake
  952. #
  953. # - name: Configure
  954. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
  955. #
  956. # - name: Build
  957. # run: |
  958. # make
  959. #
  960. # ubuntu-latest-gcc-sanitized:
  961. # runs-on: ubuntu-latest
  962. #
  963. # strategy:
  964. # matrix:
  965. # sanitizer: [ADDRESS, THREAD, UNDEFINED]
  966. #
  967. # steps:
  968. # - name: Clone
  969. # uses: actions/checkout@v4
  970. #
  971. # - name: Dependencies
  972. # run: |
  973. # sudo apt-get update
  974. # sudo apt-get install build-essential
  975. # sudo apt-get install cmake
  976. #
  977. # - name: Configure
  978. # run: cmake . -DCMAKE_BUILD_TYPE=Debug -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON
  979. #
  980. # - name: Build
  981. # run: |
  982. # make
  983. #
  984. # windows:
  985. # runs-on: windows-latest
  986. #
  987. # strategy:
  988. # matrix:
  989. # build: [Release]
  990. # arch: [Win32, x64]
  991. # include:
  992. # - arch: Win32
  993. # s2arc: x86
  994. # - arch: x64
  995. # s2arc: x64
  996. #
  997. # steps:
  998. # - name: Clone
  999. # uses: actions/checkout@v4
  1000. #
  1001. # - name: Add msbuild to PATH
  1002. # uses: microsoft/setup-msbuild@v1
  1003. #
  1004. # - name: Configure
  1005. # run: >
  1006. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1007. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1008. #
  1009. # - name: Build
  1010. # run: |
  1011. # cd ./build
  1012. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1013. #
  1014. # - name: Upload binaries
  1015. # uses: actions/upload-artifact@v4
  1016. # with:
  1017. # name: llama-bin-${{ matrix.arch }}
  1018. # path: build/bin/${{ matrix.build }}
  1019. #
  1020. # windows-blas:
  1021. # runs-on: windows-latest
  1022. #
  1023. # strategy:
  1024. # matrix:
  1025. # build: [Release]
  1026. # arch: [Win32, x64]
  1027. # blas: [ON]
  1028. # include:
  1029. # - arch: Win32
  1030. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x86.zip
  1031. # s2arc: x86
  1032. # - arch: x64
  1033. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
  1034. # s2arc: x64
  1035. #
  1036. # steps:
  1037. # - name: Clone
  1038. # uses: actions/checkout@v4
  1039. #
  1040. # - name: Add msbuild to PATH
  1041. # uses: microsoft/setup-msbuild@v1
  1042. #
  1043. # - name: Fetch OpenBLAS
  1044. # if: matrix.blas == 'ON'
  1045. # run: |
  1046. # C:/msys64/usr/bin/wget.exe -qO blas.zip ${{ matrix.obzip }}
  1047. # 7z x blas.zip -oblas -y
  1048. # copy blas/include/cblas.h .
  1049. # copy blas/include/openblas_config.h .
  1050. # echo "blasdir=$env:GITHUB_WORKSPACE/blas" >> $env:GITHUB_ENV
  1051. #
  1052. # - name: Configure
  1053. # run: >
  1054. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1055. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1056. # -DLLAMA_SUPPORT_OPENBLAS=${{ matrix.blas }}
  1057. # -DCMAKE_LIBRARY_PATH="$env:blasdir/lib"
  1058. #
  1059. # - name: Build
  1060. # run: |
  1061. # cd ./build
  1062. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1063. #
  1064. # - name: Copy libopenblas.dll
  1065. # if: matrix.blas == 'ON'
  1066. # run: copy "$env:blasdir/bin/libopenblas.dll" build/bin/${{ matrix.build }}
  1067. #
  1068. # - name: Upload binaries
  1069. # if: matrix.blas == 'ON'
  1070. # uses: actions/upload-artifact@v4
  1071. # with:
  1072. # name: llama-blas-bin-${{ matrix.arch }}
  1073. # path: build/bin/${{ matrix.build }}
  1074. #
  1075. # emscripten:
  1076. # runs-on: ubuntu-latest
  1077. #
  1078. # strategy:
  1079. # matrix:
  1080. # build: [Release]
  1081. #
  1082. # steps:
  1083. # - name: Clone
  1084. # uses: actions/checkout@v4
  1085. #
  1086. # - name: Dependencies
  1087. # run: |
  1088. # wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
  1089. # tar -xvf master.tar.gz
  1090. # emsdk-master/emsdk update
  1091. # emsdk-master/emsdk install latest
  1092. # emsdk-master/emsdk activate latest
  1093. #
  1094. # - name: Configure
  1095. # run: echo "tmp"
  1096. #
  1097. # - name: Build
  1098. # run: |
  1099. # pushd emsdk-master
  1100. # source ./emsdk_env.sh
  1101. # popd
  1102. # emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1103. # make