build.yml 55 KB

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