build.yml 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  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/7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595_offline.exe
  770. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel
  771. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  772. steps:
  773. - name: Clone
  774. id: checkout
  775. uses: actions/checkout@v4
  776. with:
  777. fetch-depth: 0
  778. - name: Install
  779. run: scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  780. - name: Build
  781. id: cmake_build
  782. run: examples/sycl/win-build-sycl.bat
  783. - name: Determine tag name
  784. id: tag
  785. shell: bash
  786. run: |
  787. BUILD_NUMBER="$(git rev-list --count HEAD)"
  788. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  789. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  790. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  791. else
  792. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  793. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  794. fi
  795. - name: Pack artifacts
  796. id: pack_artifacts
  797. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  798. run: |
  799. echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"
  800. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.4.dll" ./build/bin
  801. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_core.2.dll" ./build/bin
  802. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_tbb_thread.2.dll" ./build/bin
  803. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/pi_win_proxy_loader.dll" ./build/bin
  804. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/pi_level_zero.dll" ./build/bin
  805. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl7.dll" ./build/bin
  806. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/svml_dispmd.dll" ./build/bin
  807. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libmmd.dll" ./build/bin
  808. echo "cp oneAPI running time dll files to ./build/bin done"
  809. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*
  810. - name: Upload artifacts
  811. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  812. uses: actions/upload-artifact@v4
  813. with:
  814. path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip
  815. name: llama-bin-win-sycl-x64.zip
  816. ios-xcode-build:
  817. runs-on: macos-latest
  818. steps:
  819. - name: Checkout code
  820. uses: actions/checkout@v4
  821. - name: Build Xcode project
  822. 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
  823. android-build:
  824. runs-on: ubuntu-latest
  825. steps:
  826. - name: Clone
  827. uses: actions/checkout@v4
  828. - name: Set up JDK
  829. uses: actions/setup-java@v3
  830. with:
  831. java-version: 17
  832. distribution: zulu
  833. - name: Setup Android SDK
  834. uses: android-actions/setup-android@v3
  835. with:
  836. log-accepted-android-sdk-licenses: false
  837. - name: Build
  838. run: |
  839. cd examples/llama.android
  840. ./gradlew build --no-daemon
  841. # freeBSD-latest:
  842. # runs-on: macos-12
  843. # steps:
  844. # - name: Clone
  845. # uses: actions/checkout@v4
  846. #
  847. # - name: Build
  848. # uses: cross-platform-actions/action@v0.19.0
  849. # with:
  850. # operating_system: freebsd
  851. # version: '13.2'
  852. # hypervisor: 'qemu'
  853. # run: |
  854. # sudo pkg update
  855. # sudo pkg install -y gmake automake autoconf pkgconf llvm15 clinfo clover opencl clblast openblas
  856. # gmake CC=/usr/local/bin/clang15 CXX=/usr/local/bin/clang++15 -j `sysctl -n hw.ncpu`
  857. release:
  858. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  859. runs-on: ubuntu-latest
  860. needs:
  861. - ubuntu-focal-make
  862. - ubuntu-latest-cmake
  863. - macOS-latest-make
  864. - macOS-latest-cmake
  865. - windows-latest-cmake
  866. - windows-latest-cmake-cuda
  867. - macOS-latest-cmake-arm64
  868. - macOS-latest-cmake-x64
  869. steps:
  870. - name: Clone
  871. id: checkout
  872. uses: actions/checkout@v4
  873. with:
  874. fetch-depth: 0
  875. - name: Determine tag name
  876. id: tag
  877. shell: bash
  878. run: |
  879. BUILD_NUMBER="$(git rev-list --count HEAD)"
  880. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  881. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  882. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  883. else
  884. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  885. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  886. fi
  887. - name: Download artifacts
  888. id: download-artifact
  889. uses: actions/download-artifact@v4
  890. with:
  891. path: ./artifact
  892. - name: Move artifacts
  893. id: move_artifacts
  894. run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
  895. - name: Create release
  896. id: create_release
  897. uses: anzz1/action-create-release@v1
  898. env:
  899. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  900. with:
  901. tag_name: ${{ steps.tag.outputs.name }}
  902. - name: Upload release
  903. id: upload_release
  904. uses: actions/github-script@v3
  905. with:
  906. github-token: ${{secrets.GITHUB_TOKEN}}
  907. script: |
  908. const path = require('path');
  909. const fs = require('fs');
  910. const release_id = '${{ steps.create_release.outputs.id }}';
  911. for (let file of await fs.readdirSync('./artifact/release')) {
  912. if (path.extname(file) === '.zip') {
  913. console.log('uploadReleaseAsset', file);
  914. await github.repos.uploadReleaseAsset({
  915. owner: context.repo.owner,
  916. repo: context.repo.repo,
  917. release_id: release_id,
  918. name: file,
  919. data: await fs.readFileSync(`./artifact/release/${file}`)
  920. });
  921. }
  922. }
  923. # ubuntu-latest-gcc:
  924. # runs-on: ubuntu-latest
  925. #
  926. # strategy:
  927. # matrix:
  928. # build: [Debug, Release]
  929. #
  930. # steps:
  931. # - name: Clone
  932. # uses: actions/checkout@v4
  933. #
  934. # - name: Dependencies
  935. # run: |
  936. # sudo apt-get update
  937. # sudo apt-get install build-essential
  938. # sudo apt-get install cmake
  939. #
  940. # - name: Configure
  941. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  942. #
  943. # - name: Build
  944. # run: |
  945. # make
  946. #
  947. # ubuntu-latest-clang:
  948. # runs-on: ubuntu-latest
  949. #
  950. # strategy:
  951. # matrix:
  952. # build: [Debug, Release]
  953. #
  954. # steps:
  955. # - name: Clone
  956. # uses: actions/checkout@v4
  957. #
  958. # - name: Dependencies
  959. # run: |
  960. # sudo apt-get update
  961. # sudo apt-get install build-essential
  962. # sudo apt-get install cmake
  963. #
  964. # - name: Configure
  965. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
  966. #
  967. # - name: Build
  968. # run: |
  969. # make
  970. #
  971. # ubuntu-latest-gcc-sanitized:
  972. # runs-on: ubuntu-latest
  973. #
  974. # strategy:
  975. # matrix:
  976. # sanitizer: [ADDRESS, THREAD, UNDEFINED]
  977. #
  978. # steps:
  979. # - name: Clone
  980. # uses: actions/checkout@v4
  981. #
  982. # - name: Dependencies
  983. # run: |
  984. # sudo apt-get update
  985. # sudo apt-get install build-essential
  986. # sudo apt-get install cmake
  987. #
  988. # - name: Configure
  989. # run: cmake . -DCMAKE_BUILD_TYPE=Debug -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON
  990. #
  991. # - name: Build
  992. # run: |
  993. # make
  994. #
  995. # windows:
  996. # runs-on: windows-latest
  997. #
  998. # strategy:
  999. # matrix:
  1000. # build: [Release]
  1001. # arch: [Win32, x64]
  1002. # include:
  1003. # - arch: Win32
  1004. # s2arc: x86
  1005. # - arch: x64
  1006. # s2arc: x64
  1007. #
  1008. # steps:
  1009. # - name: Clone
  1010. # uses: actions/checkout@v4
  1011. #
  1012. # - name: Add msbuild to PATH
  1013. # uses: microsoft/setup-msbuild@v1
  1014. #
  1015. # - name: Configure
  1016. # run: >
  1017. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1018. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1019. #
  1020. # - name: Build
  1021. # run: |
  1022. # cd ./build
  1023. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1024. #
  1025. # - name: Upload binaries
  1026. # uses: actions/upload-artifact@v4
  1027. # with:
  1028. # name: llama-bin-${{ matrix.arch }}
  1029. # path: build/bin/${{ matrix.build }}
  1030. #
  1031. # windows-blas:
  1032. # runs-on: windows-latest
  1033. #
  1034. # strategy:
  1035. # matrix:
  1036. # build: [Release]
  1037. # arch: [Win32, x64]
  1038. # blas: [ON]
  1039. # include:
  1040. # - arch: Win32
  1041. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x86.zip
  1042. # s2arc: x86
  1043. # - arch: x64
  1044. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
  1045. # s2arc: x64
  1046. #
  1047. # steps:
  1048. # - name: Clone
  1049. # uses: actions/checkout@v4
  1050. #
  1051. # - name: Add msbuild to PATH
  1052. # uses: microsoft/setup-msbuild@v1
  1053. #
  1054. # - name: Fetch OpenBLAS
  1055. # if: matrix.blas == 'ON'
  1056. # run: |
  1057. # C:/msys64/usr/bin/wget.exe -qO blas.zip ${{ matrix.obzip }}
  1058. # 7z x blas.zip -oblas -y
  1059. # copy blas/include/cblas.h .
  1060. # copy blas/include/openblas_config.h .
  1061. # echo "blasdir=$env:GITHUB_WORKSPACE/blas" >> $env:GITHUB_ENV
  1062. #
  1063. # - name: Configure
  1064. # run: >
  1065. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1066. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1067. # -DLLAMA_SUPPORT_OPENBLAS=${{ matrix.blas }}
  1068. # -DCMAKE_LIBRARY_PATH="$env:blasdir/lib"
  1069. #
  1070. # - name: Build
  1071. # run: |
  1072. # cd ./build
  1073. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1074. #
  1075. # - name: Copy libopenblas.dll
  1076. # if: matrix.blas == 'ON'
  1077. # run: copy "$env:blasdir/bin/libopenblas.dll" build/bin/${{ matrix.build }}
  1078. #
  1079. # - name: Upload binaries
  1080. # if: matrix.blas == 'ON'
  1081. # uses: actions/upload-artifact@v4
  1082. # with:
  1083. # name: llama-blas-bin-${{ matrix.arch }}
  1084. # path: build/bin/${{ matrix.build }}
  1085. #
  1086. # emscripten:
  1087. # runs-on: ubuntu-latest
  1088. #
  1089. # strategy:
  1090. # matrix:
  1091. # build: [Release]
  1092. #
  1093. # steps:
  1094. # - name: Clone
  1095. # uses: actions/checkout@v4
  1096. #
  1097. # - name: Dependencies
  1098. # run: |
  1099. # wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
  1100. # tar -xvf master.tar.gz
  1101. # emsdk-master/emsdk update
  1102. # emsdk-master/emsdk install latest
  1103. # emsdk-master/emsdk activate latest
  1104. #
  1105. # - name: Configure
  1106. # run: echo "tmp"
  1107. #
  1108. # - name: Build
  1109. # run: |
  1110. # pushd emsdk-master
  1111. # source ./emsdk_env.sh
  1112. # popd
  1113. # emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1114. # make