build.yml 55 KB

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