build.yml 55 KB

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