build.yml 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500
  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. -DCMAKE_BUILD_RPATH="@loader_path" \
  52. -DLLAMA_FATAL_WARNINGS=ON \
  53. -DLLAMA_CURL=ON \
  54. -DGGML_METAL_USE_BF16=ON \
  55. -DGGML_METAL_EMBED_LIBRARY=ON \
  56. -DGGML_RPC=ON
  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. cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
  81. zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip ./build/bin/*
  82. - name: Upload artifacts
  83. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  84. uses: actions/upload-artifact@v4
  85. with:
  86. path: llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip
  87. name: llama-bin-macos-arm64.zip
  88. macOS-latest-cmake-x64:
  89. runs-on: macos-13
  90. steps:
  91. - name: Clone
  92. id: checkout
  93. uses: actions/checkout@v4
  94. with:
  95. fetch-depth: 0
  96. - name: Dependencies
  97. id: depends
  98. continue-on-error: true
  99. run: |
  100. brew update
  101. - name: Build
  102. id: cmake_build
  103. run: |
  104. sysctl -a
  105. # Metal is disabled due to intermittent failures with Github runners not having a GPU:
  106. # https://github.com/ggerganov/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
  107. cmake -B build \
  108. -DCMAKE_BUILD_RPATH="@loader_path" \
  109. -DLLAMA_FATAL_WARNINGS=ON \
  110. -DLLAMA_CURL=ON \
  111. -DGGML_METAL=OFF \
  112. -DGGML_RPC=ON
  113. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  114. - name: Test
  115. id: cmake_test
  116. run: |
  117. cd build
  118. ctest -L main --verbose --timeout 900
  119. - name: Determine tag name
  120. id: tag
  121. shell: bash
  122. run: |
  123. BUILD_NUMBER="$(git rev-list --count HEAD)"
  124. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  125. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  126. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  127. else
  128. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  129. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  130. fi
  131. - name: Pack artifacts
  132. id: pack_artifacts
  133. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  134. run: |
  135. cp LICENSE ./build/bin/
  136. cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
  137. zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip ./build/bin/*
  138. - name: Upload artifacts
  139. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  140. uses: actions/upload-artifact@v4
  141. with:
  142. path: llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip
  143. name: llama-bin-macos-x64.zip
  144. ubuntu-cpu-cmake:
  145. runs-on: ubuntu-22.04
  146. steps:
  147. - name: Clone
  148. id: checkout
  149. uses: actions/checkout@v4
  150. with:
  151. fetch-depth: 0
  152. - name: Dependencies
  153. id: depends
  154. run: |
  155. sudo apt-get update
  156. sudo apt-get install build-essential libcurl4-openssl-dev
  157. - name: Build
  158. id: cmake_build
  159. run: |
  160. mkdir build
  161. cd build
  162. cmake .. \
  163. -DLLAMA_FATAL_WARNINGS=ON \
  164. -DLLAMA_CURL=ON \
  165. -DGGML_RPC=ON
  166. cmake --build . --config Release -j $(nproc)
  167. - name: Test
  168. id: cmake_test
  169. run: |
  170. cd build
  171. ctest -L 'main|curl' --verbose --timeout 900
  172. - name: Test llama2c conversion
  173. id: llama2c_test
  174. run: |
  175. cd build
  176. echo "Fetch tokenizer"
  177. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  178. echo "Fetch llama2c model"
  179. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  180. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  181. ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  182. - name: Determine tag name
  183. id: tag
  184. shell: bash
  185. run: |
  186. BUILD_NUMBER="$(git rev-list --count HEAD)"
  187. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  188. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  189. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  190. else
  191. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  192. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  193. fi
  194. - name: Pack artifacts
  195. id: pack_artifacts
  196. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  197. run: |
  198. cp LICENSE ./build/bin/
  199. cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
  200. zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip ./build/bin/*
  201. - name: Upload artifacts
  202. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  203. uses: actions/upload-artifact@v4
  204. with:
  205. path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip
  206. name: llama-bin-ubuntu-x64.zip
  207. ubuntu-latest-cmake-sanitizer:
  208. runs-on: ubuntu-latest
  209. continue-on-error: true
  210. strategy:
  211. matrix:
  212. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  213. build_type: [Debug]
  214. steps:
  215. - name: Clone
  216. id: checkout
  217. uses: actions/checkout@v4
  218. - name: Dependencies
  219. id: depends
  220. run: |
  221. sudo apt-get update
  222. sudo apt-get install build-essential
  223. - name: Build
  224. id: cmake_build
  225. if: ${{ matrix.sanitizer != 'THREAD' }}
  226. run: |
  227. mkdir build
  228. cd build
  229. cmake .. \
  230. -DLLAMA_FATAL_WARNINGS=ON \
  231. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  232. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
  233. cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
  234. - name: Build (no OpenMP)
  235. id: cmake_build_no_openmp
  236. if: ${{ matrix.sanitizer == 'THREAD' }}
  237. run: |
  238. mkdir build
  239. cd build
  240. cmake .. \
  241. -DLLAMA_FATAL_WARNINGS=ON \
  242. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  243. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  244. -DGGML_OPENMP=OFF
  245. cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
  246. - name: Test
  247. id: cmake_test
  248. run: |
  249. cd build
  250. ctest -L main --verbose --timeout 900
  251. ubuntu-latest-cmake-rpc:
  252. runs-on: ubuntu-latest
  253. continue-on-error: true
  254. steps:
  255. - name: Clone
  256. id: checkout
  257. uses: actions/checkout@v4
  258. - name: Dependencies
  259. id: depends
  260. run: |
  261. sudo apt-get update
  262. sudo apt-get install build-essential
  263. - name: Build
  264. id: cmake_build
  265. run: |
  266. mkdir build
  267. cd build
  268. cmake .. \
  269. -DGGML_RPC=ON
  270. cmake --build . --config Release -j $(nproc)
  271. - name: Test
  272. id: cmake_test
  273. run: |
  274. cd build
  275. ctest -L main --verbose
  276. ubuntu-22-cmake-vulkan:
  277. runs-on: ubuntu-22.04
  278. steps:
  279. - name: Clone
  280. id: checkout
  281. uses: actions/checkout@v4
  282. - name: Dependencies
  283. id: depends
  284. run: |
  285. wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
  286. sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
  287. sudo apt-get update -y
  288. sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk
  289. - name: Build
  290. id: cmake_build
  291. run: |
  292. mkdir build
  293. cd build
  294. cmake .. \
  295. -DGGML_VULKAN=ON
  296. cmake --build . --config Release -j $(nproc)
  297. - name: Test
  298. id: cmake_test
  299. run: |
  300. cd build
  301. ctest -L main --verbose --timeout 900
  302. ubuntu-22-cmake-hip:
  303. runs-on: ubuntu-22.04
  304. container: rocm/dev-ubuntu-22.04:6.0.2
  305. steps:
  306. - name: Clone
  307. id: checkout
  308. uses: actions/checkout@v4
  309. - name: Dependencies
  310. id: depends
  311. run: |
  312. sudo apt-get update
  313. sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev
  314. - name: Build with native CMake HIP support
  315. id: cmake_build
  316. run: |
  317. cmake -B build -S . \
  318. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
  319. -DGGML_HIP=ON
  320. cmake --build build --config Release -j $(nproc)
  321. - name: Build with legacy HIP support
  322. id: cmake_build_legacy_hip
  323. run: |
  324. cmake -B build2 -S . \
  325. -DCMAKE_C_COMPILER=hipcc \
  326. -DCMAKE_CXX_COMPILER=hipcc \
  327. -DGGML_HIP=ON
  328. cmake --build build2 --config Release -j $(nproc)
  329. ubuntu-22-cmake-musa:
  330. runs-on: ubuntu-22.04
  331. container: mthreads/musa:rc3.1.0-devel-ubuntu22.04
  332. steps:
  333. - name: Clone
  334. id: checkout
  335. uses: actions/checkout@v4
  336. - name: Dependencies
  337. id: depends
  338. run: |
  339. apt-get update
  340. apt-get install -y build-essential git cmake libcurl4-openssl-dev
  341. - name: Build with native CMake MUSA support
  342. id: cmake_build
  343. run: |
  344. cmake -B build -S . \
  345. -DGGML_MUSA=ON
  346. cmake --build build --config Release -j $(nproc)
  347. ubuntu-22-cmake-sycl:
  348. runs-on: ubuntu-22.04
  349. continue-on-error: true
  350. steps:
  351. - uses: actions/checkout@v4
  352. - name: add oneAPI to apt
  353. shell: bash
  354. run: |
  355. cd /tmp
  356. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  357. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  358. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  359. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  360. - name: install oneAPI dpcpp compiler
  361. shell: bash
  362. run: |
  363. sudo apt update
  364. sudo apt install intel-oneapi-compiler-dpcpp-cpp
  365. - name: install oneAPI MKL library
  366. shell: bash
  367. run: |
  368. sudo apt install intel-oneapi-mkl-devel
  369. - name: Clone
  370. id: checkout
  371. uses: actions/checkout@v4
  372. - name: Build
  373. id: cmake_build
  374. run: |
  375. source /opt/intel/oneapi/setvars.sh
  376. mkdir build
  377. cd build
  378. cmake .. \
  379. -DGGML_SYCL=ON \
  380. -DCMAKE_C_COMPILER=icx \
  381. -DCMAKE_CXX_COMPILER=icpx
  382. cmake --build . --config Release -j $(nproc)
  383. ubuntu-22-cmake-sycl-fp16:
  384. runs-on: ubuntu-22.04
  385. continue-on-error: true
  386. steps:
  387. - uses: actions/checkout@v4
  388. - name: add oneAPI to apt
  389. shell: bash
  390. run: |
  391. cd /tmp
  392. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  393. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  394. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  395. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  396. - name: install oneAPI dpcpp compiler
  397. shell: bash
  398. run: |
  399. sudo apt update
  400. sudo apt install intel-oneapi-compiler-dpcpp-cpp
  401. - name: install oneAPI MKL library
  402. shell: bash
  403. run: |
  404. sudo apt install intel-oneapi-mkl-devel
  405. - name: Clone
  406. id: checkout
  407. uses: actions/checkout@v4
  408. - name: Build
  409. id: cmake_build
  410. run: |
  411. source /opt/intel/oneapi/setvars.sh
  412. mkdir build
  413. cd build
  414. cmake .. \
  415. -DGGML_SYCL=ON \
  416. -DCMAKE_C_COMPILER=icx \
  417. -DCMAKE_CXX_COMPILER=icpx \
  418. -DGGML_SYCL_F16=ON
  419. cmake --build . --config Release -j $(nproc)
  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'
  553. - build: 'avx2-x64'
  554. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON'
  555. - build: 'avx-x64'
  556. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX2=OFF'
  557. - build: 'avx512-x64'
  558. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX512=ON'
  559. - build: 'openblas-x64'
  560. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BLAS=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'
  563. - build: 'vulkan-x64'
  564. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_VULKAN=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'
  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'
  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. Copy-Item .\examples\run\linenoise.cpp\LICENSE .\build\bin\Release\linenoise.cpp.txt
  687. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip .\build\bin\Release\*
  688. - name: Upload artifacts
  689. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  690. uses: actions/upload-artifact@v4
  691. with:
  692. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip
  693. name: llama-bin-win-${{ matrix.build }}.zip
  694. ubuntu-latest-cmake-cuda:
  695. runs-on: ubuntu-latest
  696. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  697. steps:
  698. - name: Clone
  699. id: checkout
  700. uses: actions/checkout@v4
  701. - name: Install dependencies
  702. env:
  703. DEBIAN_FRONTEND: noninteractive
  704. run: |
  705. apt update
  706. apt install -y cmake build-essential ninja-build libgomp1 git
  707. - name: Build with CMake
  708. run: |
  709. cmake -S . -B build -G Ninja \
  710. -DCMAKE_BUILD_TYPE=Release \
  711. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  712. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  713. -DLLAMA_FATAL_WARNINGS=ON \
  714. -DGGML_NATIVE=OFF \
  715. -DGGML_CUDA=ON
  716. cmake --build build
  717. windows-2019-cmake-cuda:
  718. runs-on: windows-2019
  719. strategy:
  720. matrix:
  721. cuda: ['12.4', '11.7']
  722. build: ['cuda']
  723. steps:
  724. - name: Clone
  725. id: checkout
  726. uses: actions/checkout@v4
  727. with:
  728. fetch-depth: 0
  729. - name: Install Cuda Toolkit 11.7
  730. if: ${{ matrix.cuda == '11.7' }}
  731. run: |
  732. mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"
  733. choco install unzip -y
  734. 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"
  735. 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"
  736. 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"
  737. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-11.7.4.6-archive.zip"
  738. 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"
  739. 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"
  740. 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"
  741. 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"
  742. unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"
  743. 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
  744. 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
  745. 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
  746. 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
  747. 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
  748. 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
  749. 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
  750. 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
  751. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  752. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  753. echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  754. echo "CUDA_PATH_V11_7=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  755. - name: Install Cuda Toolkit 12.4
  756. if: ${{ matrix.cuda == '12.4' }}
  757. run: |
  758. mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"
  759. choco install unzip -y
  760. 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"
  761. 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"
  762. 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"
  763. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-12.4.5.8-archive.zip"
  764. 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"
  765. 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"
  766. 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"
  767. 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"
  768. 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"
  769. unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"
  770. 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
  771. 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
  772. 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
  773. 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
  774. 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
  775. 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
  776. 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
  777. 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
  778. 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
  779. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  780. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  781. echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  782. echo "CUDA_PATH_V12_4=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  783. - name: Install ccache
  784. uses: hendrikmuhs/ccache-action@v1.2
  785. with:
  786. key: ${{ github.job }}-${{ matrix.cuda }}-${{ matrix.build }}
  787. - name: Install Ninja
  788. id: install_ninja
  789. run: |
  790. choco install ninja
  791. - name: Build
  792. id: cmake_build
  793. shell: cmd
  794. run: |
  795. call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
  796. cmake -S . -B build -G "Ninja Multi-Config" \
  797. -DLLAMA_BUILD_SERVER=ON \
  798. -DGGML_NATIVE=OFF \
  799. -DGGML_CUDA=ON \
  800. -DGGML_RPC=ON
  801. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  802. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  803. cmake --build build --config Release
  804. - name: Determine tag name
  805. id: tag
  806. shell: bash
  807. run: |
  808. BUILD_NUMBER="$(git rev-list --count HEAD)"
  809. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  810. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  811. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  812. else
  813. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  814. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  815. fi
  816. - name: Pack artifacts
  817. id: pack_artifacts
  818. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  819. run: |
  820. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
  821. - name: Upload artifacts
  822. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  823. uses: actions/upload-artifact@v4
  824. with:
  825. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
  826. name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  827. - name: Copy and pack Cuda runtime
  828. if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  829. run: |
  830. echo "Cuda install location: ${{ env.CUDA_PATH }}"
  831. $dst='.\build\bin\cudart\'
  832. robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  833. robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  834. 7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
  835. - name: Upload Cuda runtime
  836. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  837. uses: actions/upload-artifact@v4
  838. with:
  839. path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  840. name: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  841. windows-latest-cmake-sycl:
  842. runs-on: windows-latest
  843. defaults:
  844. run:
  845. shell: bash
  846. env:
  847. 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
  848. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  849. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  850. steps:
  851. - name: Clone
  852. id: checkout
  853. uses: actions/checkout@v4
  854. with:
  855. fetch-depth: 0
  856. - name: Install
  857. run: |
  858. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  859. - name: Build
  860. id: cmake_build
  861. run: examples/sycl/win-build-sycl.bat
  862. - name: Determine tag name
  863. id: tag
  864. shell: bash
  865. run: |
  866. BUILD_NUMBER="$(git rev-list --count HEAD)"
  867. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  868. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  869. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  870. else
  871. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  872. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  873. fi
  874. - name: Build the release package
  875. id: pack_artifacts
  876. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  877. run: |
  878. echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"
  879. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.5.dll" ./build/bin
  880. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_core.2.dll" ./build/bin
  881. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_tbb_thread.2.dll" ./build/bin
  882. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_level_zero.dll" ./build/bin
  883. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_opencl.dll" ./build/bin
  884. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_loader.dll" ./build/bin
  885. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_win_proxy_loader.dll" ./build/bin
  886. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl8.dll" ./build/bin
  887. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/svml_dispmd.dll" ./build/bin
  888. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libmmd.dll" ./build/bin
  889. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libiomp5md.dll" ./build/bin
  890. cp "${{ env.ONEAPI_ROOT }}/dnnl/latest/bin/dnnl.dll" ./build/bin
  891. cp "${{ env.ONEAPI_ROOT }}/tbb/latest/bin/tbb12.dll" ./build/bin
  892. echo "cp oneAPI running time dll files to ./build/bin done"
  893. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*
  894. - name: Upload the release package
  895. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  896. uses: actions/upload-artifact@v4
  897. with:
  898. path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip
  899. name: llama-bin-win-sycl-x64.zip
  900. windows-latest-cmake-hip:
  901. if: ${{ github.event.inputs.create_release != 'true' }}
  902. runs-on: windows-latest
  903. steps:
  904. - name: Clone
  905. id: checkout
  906. uses: actions/checkout@v4
  907. - name: Install
  908. id: depends
  909. run: |
  910. $ErrorActionPreference = "Stop"
  911. write-host "Downloading AMD HIP SDK Installer"
  912. 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"
  913. write-host "Installing AMD HIP SDK"
  914. Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
  915. write-host "Completed AMD HIP SDK installation"
  916. - name: Verify ROCm
  917. id: verify
  918. run: |
  919. & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
  920. - name: Install ccache
  921. uses: hendrikmuhs/ccache-action@v1.2
  922. with:
  923. key: ${{ github.job }}
  924. - name: Build
  925. id: cmake_build
  926. run: |
  927. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  928. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  929. 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
  930. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  931. windows-latest-cmake-hip-release:
  932. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  933. runs-on: windows-latest
  934. strategy:
  935. matrix:
  936. gpu_target: [gfx1100, gfx1101, gfx1030]
  937. steps:
  938. - name: Clone
  939. id: checkout
  940. uses: actions/checkout@v4
  941. with:
  942. fetch-depth: 0
  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: Build
  957. id: cmake_build
  958. run: |
  959. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  960. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  961. 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
  962. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  963. md "build\bin\rocblas\library\"
  964. cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
  965. cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
  966. cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
  967. - name: Determine tag name
  968. id: tag
  969. shell: bash
  970. run: |
  971. BUILD_NUMBER="$(git rev-list --count HEAD)"
  972. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  973. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  974. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  975. else
  976. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  977. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  978. fi
  979. - name: Pack artifacts
  980. id: pack_artifacts
  981. run: |
  982. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip .\build\bin\*
  983. - name: Upload artifacts
  984. uses: actions/upload-artifact@v4
  985. with:
  986. path: llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  987. name: llama-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  988. ios-xcode-build:
  989. runs-on: macos-latest
  990. steps:
  991. - name: Checkout code
  992. uses: actions/checkout@v4
  993. - name: Build
  994. id: cmake_build
  995. run: |
  996. sysctl -a
  997. mkdir build
  998. cd build
  999. cmake -G Xcode .. \
  1000. -DGGML_METAL_USE_BF16=ON \
  1001. -DGGML_METAL_EMBED_LIBRARY=ON \
  1002. -DLLAMA_BUILD_EXAMPLES=OFF \
  1003. -DLLAMA_BUILD_TESTS=OFF \
  1004. -DLLAMA_BUILD_SERVER=OFF \
  1005. -DCMAKE_SYSTEM_NAME=iOS \
  1006. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  1007. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  1008. cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  1009. sudo cmake --install . --config Release
  1010. - name: xcodebuild for swift package
  1011. id: xcodebuild
  1012. run: |
  1013. xcodebuild -scheme llama-Package -destination 'generic/platform=iOS'
  1014. - name: Build Xcode project
  1015. 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
  1016. android-build:
  1017. runs-on: ubuntu-latest
  1018. steps:
  1019. - name: Clone
  1020. uses: actions/checkout@v4
  1021. - name: Set up JDK
  1022. uses: actions/setup-java@v3
  1023. with:
  1024. java-version: 17
  1025. distribution: zulu
  1026. - name: Setup Android SDK
  1027. uses: android-actions/setup-android@v3
  1028. with:
  1029. log-accepted-android-sdk-licenses: false
  1030. - name: Build
  1031. run: |
  1032. cd examples/llama.android
  1033. ./gradlew build --no-daemon
  1034. release:
  1035. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  1036. runs-on: ubuntu-latest
  1037. needs:
  1038. - ubuntu-cpu-cmake
  1039. - windows-latest-cmake
  1040. - windows-2019-cmake-cuda
  1041. - windows-latest-cmake-hip-release
  1042. - macOS-latest-cmake-arm64
  1043. - macOS-latest-cmake-x64
  1044. steps:
  1045. - name: Clone
  1046. id: checkout
  1047. uses: actions/checkout@v4
  1048. with:
  1049. fetch-depth: 0
  1050. - name: Determine tag name
  1051. id: tag
  1052. shell: bash
  1053. run: |
  1054. BUILD_NUMBER="$(git rev-list --count HEAD)"
  1055. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  1056. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  1057. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  1058. else
  1059. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  1060. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  1061. fi
  1062. - name: Download artifacts
  1063. id: download-artifact
  1064. uses: actions/download-artifact@v4
  1065. with:
  1066. path: ./artifact
  1067. - name: Move artifacts
  1068. id: move_artifacts
  1069. run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
  1070. - name: Create release
  1071. id: create_release
  1072. uses: ggml-org/action-create-release@v1
  1073. env:
  1074. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1075. with:
  1076. tag_name: ${{ steps.tag.outputs.name }}
  1077. - name: Upload release
  1078. id: upload_release
  1079. uses: actions/github-script@v3
  1080. with:
  1081. github-token: ${{secrets.GITHUB_TOKEN}}
  1082. script: |
  1083. const path = require('path');
  1084. const fs = require('fs');
  1085. const release_id = '${{ steps.create_release.outputs.id }}';
  1086. for (let file of await fs.readdirSync('./artifact/release')) {
  1087. if (path.extname(file) === '.zip') {
  1088. console.log('uploadReleaseAsset', file);
  1089. await github.repos.uploadReleaseAsset({
  1090. owner: context.repo.owner,
  1091. repo: context.repo.repo,
  1092. release_id: release_id,
  1093. name: file,
  1094. data: await fs.readFileSync(`./artifact/release/${file}`)
  1095. });
  1096. }
  1097. }
  1098. # ubuntu-latest-gcc:
  1099. # runs-on: ubuntu-latest
  1100. #
  1101. # strategy:
  1102. # matrix:
  1103. # build: [Debug, Release]
  1104. #
  1105. # steps:
  1106. # - name: Clone
  1107. # uses: actions/checkout@v4
  1108. #
  1109. # - name: Dependencies
  1110. # run: |
  1111. # sudo apt-get update
  1112. # sudo apt-get install build-essential
  1113. # sudo apt-get install cmake
  1114. #
  1115. # - name: Configure
  1116. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1117. #
  1118. # - name: Build
  1119. # run: |
  1120. # make
  1121. #
  1122. # ubuntu-latest-clang:
  1123. # runs-on: ubuntu-latest
  1124. #
  1125. # strategy:
  1126. # matrix:
  1127. # build: [Debug, Release]
  1128. #
  1129. # steps:
  1130. # - name: Clone
  1131. # uses: actions/checkout@v4
  1132. #
  1133. # - name: Dependencies
  1134. # run: |
  1135. # sudo apt-get update
  1136. # sudo apt-get install build-essential
  1137. # sudo apt-get install cmake
  1138. #
  1139. # - name: Configure
  1140. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
  1141. #
  1142. # - name: Build
  1143. # run: |
  1144. # make
  1145. #
  1146. # ubuntu-latest-gcc-sanitized:
  1147. # runs-on: ubuntu-latest
  1148. #
  1149. # strategy:
  1150. # matrix:
  1151. # sanitizer: [ADDRESS, THREAD, UNDEFINED]
  1152. #
  1153. # steps:
  1154. # - name: Clone
  1155. # uses: actions/checkout@v4
  1156. #
  1157. # - name: Dependencies
  1158. # run: |
  1159. # sudo apt-get update
  1160. # sudo apt-get install build-essential
  1161. # sudo apt-get install cmake
  1162. #
  1163. # - name: Configure
  1164. # run: cmake . -DCMAKE_BUILD_TYPE=Debug -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON
  1165. #
  1166. # - name: Build
  1167. # run: |
  1168. # make
  1169. #
  1170. # windows:
  1171. # runs-on: windows-latest
  1172. #
  1173. # strategy:
  1174. # matrix:
  1175. # build: [Release]
  1176. # arch: [Win32, x64]
  1177. # include:
  1178. # - arch: Win32
  1179. # s2arc: x86
  1180. # - arch: x64
  1181. # s2arc: x64
  1182. #
  1183. # steps:
  1184. # - name: Clone
  1185. # uses: actions/checkout@v4
  1186. #
  1187. # - name: Add msbuild to PATH
  1188. # uses: microsoft/setup-msbuild@v1
  1189. #
  1190. # - name: Configure
  1191. # run: >
  1192. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1193. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1194. #
  1195. # - name: Build
  1196. # run: |
  1197. # cd ./build
  1198. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1199. #
  1200. # - name: Upload binaries
  1201. # uses: actions/upload-artifact@v4
  1202. # with:
  1203. # name: llama-bin-${{ matrix.arch }}
  1204. # path: build/bin/${{ matrix.build }}
  1205. #
  1206. # windows-blas:
  1207. # runs-on: windows-latest
  1208. #
  1209. # strategy:
  1210. # matrix:
  1211. # build: [Release]
  1212. # arch: [Win32, x64]
  1213. # blas: [ON]
  1214. # include:
  1215. # - arch: Win32
  1216. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x86.zip
  1217. # s2arc: x86
  1218. # - arch: x64
  1219. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
  1220. # s2arc: x64
  1221. #
  1222. # steps:
  1223. # - name: Clone
  1224. # uses: actions/checkout@v4
  1225. #
  1226. # - name: Add msbuild to PATH
  1227. # uses: microsoft/setup-msbuild@v1
  1228. #
  1229. # - name: Fetch OpenBLAS
  1230. # if: matrix.blas == 'ON'
  1231. # run: |
  1232. # C:/msys64/usr/bin/wget.exe -qO blas.zip ${{ matrix.obzip }}
  1233. # 7z x blas.zip -oblas -y
  1234. # copy blas/include/cblas.h .
  1235. # copy blas/include/openblas_config.h .
  1236. # echo "blasdir=$env:GITHUB_WORKSPACE/blas" >> $env:GITHUB_ENV
  1237. #
  1238. # - name: Configure
  1239. # run: >
  1240. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1241. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1242. # -DLLAMA_SUPPORT_OPENBLAS=${{ matrix.blas }}
  1243. # -DCMAKE_LIBRARY_PATH="$env:blasdir/lib"
  1244. #
  1245. # - name: Build
  1246. # run: |
  1247. # cd ./build
  1248. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1249. #
  1250. # - name: Copy libopenblas.dll
  1251. # if: matrix.blas == 'ON'
  1252. # run: copy "$env:blasdir/bin/libopenblas.dll" build/bin/${{ matrix.build }}
  1253. #
  1254. # - name: Upload binaries
  1255. # if: matrix.blas == 'ON'
  1256. # uses: actions/upload-artifact@v4
  1257. # with:
  1258. # name: llama-blas-bin-${{ matrix.arch }}
  1259. # path: build/bin/${{ matrix.build }}
  1260. #
  1261. # emscripten:
  1262. # runs-on: ubuntu-latest
  1263. #
  1264. # strategy:
  1265. # matrix:
  1266. # build: [Release]
  1267. #
  1268. # steps:
  1269. # - name: Clone
  1270. # uses: actions/checkout@v4
  1271. #
  1272. # - name: Dependencies
  1273. # run: |
  1274. # wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
  1275. # tar -xvf master.tar.gz
  1276. # emsdk-master/emsdk update
  1277. # emsdk-master/emsdk install latest
  1278. # emsdk-master/emsdk activate latest
  1279. #
  1280. # - name: Configure
  1281. # run: echo "tmp"
  1282. #
  1283. # - name: Build
  1284. # run: |
  1285. # pushd emsdk-master
  1286. # source ./emsdk_env.sh
  1287. # popd
  1288. # emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1289. # make
  1290. openEuler-latest-cmake-cann:
  1291. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1292. defaults:
  1293. run:
  1294. shell: bash -el {0}
  1295. runs-on: ubuntu-24.04-arm
  1296. strategy:
  1297. matrix:
  1298. cann:
  1299. - '8.0.rc3.beta1-910b-openeuler22.03-py3.10'
  1300. device:
  1301. - 'ascend910b3'
  1302. build:
  1303. - 'Release'
  1304. container: ascendai/cann:${{ matrix.cann }}
  1305. steps:
  1306. - name: Checkout
  1307. uses: actions/checkout@v4
  1308. - name: Dependencies
  1309. run: |
  1310. yum update -y
  1311. yum install -y git gcc gcc-c++ make cmake
  1312. - name: Build
  1313. run: |
  1314. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1315. cmake -S . -B build \
  1316. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1317. -DGGML_CANN=on \
  1318. -DSOC_TYPE=${{ matrix.device }}
  1319. cmake --build build -j $(nproc)