build.yml 55 KB

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