build.yml 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512
  1. name: CI
  2. on:
  3. workflow_dispatch: # allows manual triggering
  4. inputs:
  5. create_release:
  6. description: 'Create new release'
  7. required: true
  8. type: boolean
  9. push:
  10. branches:
  11. - master
  12. paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal']
  13. pull_request:
  14. types: [opened, synchronize, reopened]
  15. paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal']
  16. concurrency:
  17. group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  18. cancel-in-progress: true
  19. # Fine-grant permission
  20. # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
  21. permissions:
  22. contents: write # for creating release
  23. env:
  24. BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
  25. GGML_NLOOP: 3
  26. GGML_N_THREADS: 1
  27. LLAMA_LOG_COLORS: 1
  28. LLAMA_LOG_PREFIX: 1
  29. LLAMA_LOG_TIMESTAMPS: 1
  30. jobs:
  31. macOS-latest-cmake-arm64:
  32. runs-on: macos-14
  33. steps:
  34. - name: Clone
  35. id: checkout
  36. uses: actions/checkout@v4
  37. with:
  38. fetch-depth: 0
  39. - name: Dependencies
  40. id: depends
  41. continue-on-error: true
  42. run: |
  43. brew update
  44. - name: Build
  45. id: cmake_build
  46. run: |
  47. sysctl -a
  48. mkdir build
  49. cd build
  50. cmake .. \
  51. -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. git
  526. mingw-w64-${{matrix.env}}-toolchain
  527. mingw-w64-${{matrix.env}}-cmake
  528. mingw-w64-${{matrix.env}}-openblas
  529. - name: Build using CMake
  530. shell: msys2 {0}
  531. run: |
  532. cmake -B build
  533. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  534. - name: Clean after building using CMake
  535. shell: msys2 {0}
  536. run: |
  537. rm -rf build
  538. - name: Build using CMake w/ OpenBLAS
  539. shell: msys2 {0}
  540. run: |
  541. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  542. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  543. windows-latest-cmake:
  544. runs-on: windows-latest
  545. env:
  546. OPENBLAS_VERSION: 0.3.23
  547. SDE_VERSION: 9.33.0-2024-01-07
  548. VULKAN_VERSION: 1.3.261.1
  549. strategy:
  550. matrix:
  551. include:
  552. - build: 'noavx-x64'
  553. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF'
  554. - build: 'avx2-x64'
  555. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON'
  556. - build: 'avx-x64'
  557. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX2=OFF'
  558. - build: 'avx512-x64'
  559. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX512=ON'
  560. - build: 'openblas-x64'
  561. 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"'
  562. - build: 'kompute-x64'
  563. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_KOMPUTE=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON'
  564. - build: 'vulkan-x64'
  565. defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_VULKAN=ON'
  566. - build: 'llvm-arm64'
  567. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  568. - build: 'msvc-arm64'
  569. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-msvc.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  570. - build: 'llvm-arm64-opencl-adreno'
  571. 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'
  572. steps:
  573. - name: Clone
  574. id: checkout
  575. uses: actions/checkout@v4
  576. with:
  577. fetch-depth: 0
  578. - name: Clone Kompute submodule
  579. id: clone_kompute
  580. if: ${{ matrix.build == 'kompute-x64' }}
  581. run: |
  582. git submodule update --init ggml/src/ggml-kompute/kompute
  583. - name: Download OpenBLAS
  584. id: get_openblas
  585. if: ${{ matrix.build == 'openblas-x64' }}
  586. run: |
  587. 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"
  588. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  589. mkdir $env:RUNNER_TEMP/openblas
  590. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  591. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  592. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  593. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  594. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  595. - name: Install Vulkan SDK
  596. id: get_vulkan
  597. if: ${{ matrix.build == 'kompute-x64' || matrix.build == 'vulkan-x64' }}
  598. run: |
  599. 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"
  600. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  601. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  602. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  603. - name: Install Ninja
  604. id: install_ninja
  605. run: |
  606. choco install ninja
  607. - name: Install OpenCL Headers and Libs
  608. id: install_opencl
  609. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  610. run: |
  611. git clone https://github.com/KhronosGroup/OpenCL-Headers
  612. cd OpenCL-Headers
  613. mkdir build && cd build
  614. cmake .. `
  615. -DBUILD_TESTING=OFF `
  616. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  617. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  618. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  619. cmake --build . --target install
  620. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  621. cd OpenCL-ICD-Loader
  622. mkdir build-arm64-release && cd build-arm64-release
  623. cmake .. `
  624. -A arm64 `
  625. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  626. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  627. cmake --build . --target install --config release
  628. - name: Build
  629. id: cmake_build
  630. run: |
  631. cmake -S . -B build ${{ matrix.defines }}
  632. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  633. - name: Add libopenblas.dll
  634. id: add_libopenblas_dll
  635. if: ${{ matrix.build == 'openblas-x64' }}
  636. run: |
  637. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  638. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  639. - name: Check AVX512F support
  640. id: check_avx512f
  641. if: ${{ matrix.build == 'avx512-x64' }}
  642. continue-on-error: true
  643. run: |
  644. cd build
  645. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  646. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  647. $cl = $(join-path $msvc 'bin\Hostx64\x64\cl.exe')
  648. echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c
  649. & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
  650. .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
  651. - name: Test
  652. id: cmake_test
  653. # not all machines have native AVX-512
  654. 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') }}
  655. run: |
  656. cd build
  657. ctest -L main -C Release --verbose --timeout 900
  658. - name: Test (Intel SDE)
  659. id: cmake_test_sde
  660. if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  661. run: |
  662. curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  663. # for some weird reason windows tar doesn't like sde tar.xz
  664. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  665. 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  666. $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  667. cd build
  668. $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  669. & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  670. - name: Determine tag name
  671. id: tag
  672. shell: bash
  673. run: |
  674. BUILD_NUMBER="$(git rev-list --count HEAD)"
  675. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  676. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  677. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  678. else
  679. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  680. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  681. fi
  682. - name: Pack artifacts
  683. id: pack_artifacts
  684. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  685. run: |
  686. Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
  687. Copy-Item .\examples\run\linenoise.cpp\LICENSE .\build\bin\Release\linenoise.cpp.txt
  688. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip .\build\bin\Release\*
  689. - name: Upload artifacts
  690. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  691. uses: actions/upload-artifact@v4
  692. with:
  693. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip
  694. name: llama-bin-win-${{ matrix.build }}.zip
  695. ubuntu-latest-cmake-cuda:
  696. runs-on: ubuntu-latest
  697. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  698. steps:
  699. - name: Clone
  700. id: checkout
  701. uses: actions/checkout@v4
  702. - name: Install dependencies
  703. env:
  704. DEBIAN_FRONTEND: noninteractive
  705. run: |
  706. apt update
  707. apt install -y cmake build-essential ninja-build libgomp1 git
  708. - name: Build with CMake
  709. run: |
  710. cmake -S . -B build -G Ninja \
  711. -DCMAKE_BUILD_TYPE=Release \
  712. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  713. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  714. -DLLAMA_FATAL_WARNINGS=ON \
  715. -DGGML_NATIVE=OFF \
  716. -DGGML_CUDA=ON
  717. cmake --build build
  718. windows-2019-cmake-cuda:
  719. runs-on: windows-2019
  720. strategy:
  721. matrix:
  722. cuda: ['12.4', '11.7']
  723. build: ['cuda']
  724. steps:
  725. - name: Clone
  726. id: checkout
  727. uses: actions/checkout@v4
  728. with:
  729. fetch-depth: 0
  730. - name: Install Cuda Toolkit 11.7
  731. if: ${{ matrix.cuda == '11.7' }}
  732. run: |
  733. mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"
  734. choco install unzip -y
  735. 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"
  736. 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"
  737. 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"
  738. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-11.7.4.6-archive.zip"
  739. 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"
  740. 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"
  741. 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"
  742. 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"
  743. unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"
  744. 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
  745. 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
  746. 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
  747. 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
  748. 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
  749. 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
  750. 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
  751. 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
  752. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  753. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  754. echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  755. echo "CUDA_PATH_V11_7=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  756. - name: Install Cuda Toolkit 12.4
  757. if: ${{ matrix.cuda == '12.4' }}
  758. run: |
  759. mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"
  760. choco install unzip -y
  761. 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"
  762. 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"
  763. 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"
  764. curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-12.4.5.8-archive.zip"
  765. 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"
  766. 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"
  767. 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"
  768. 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"
  769. 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"
  770. unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"
  771. 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
  772. 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
  773. 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
  774. 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
  775. 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
  776. 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
  777. 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
  778. 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
  779. 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
  780. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  781. echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  782. echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  783. echo "CUDA_PATH_V12_4=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
  784. - name: Install ccache
  785. uses: hendrikmuhs/ccache-action@v1.2
  786. with:
  787. key: ${{ github.job }}-${{ matrix.cuda }}-${{ matrix.build }}
  788. - name: Install Ninja
  789. id: install_ninja
  790. run: |
  791. choco install ninja
  792. - name: Build
  793. id: cmake_build
  794. shell: cmd
  795. run: |
  796. call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
  797. cmake -S . -B build -G "Ninja Multi-Config" ^
  798. -DLLAMA_BUILD_SERVER=ON ^
  799. -DGGML_NATIVE=OFF ^
  800. -DGGML_CUDA=ON ^
  801. -DGGML_RPC=ON
  802. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  803. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  804. cmake --build build --config Release
  805. - name: Determine tag name
  806. id: tag
  807. shell: bash
  808. run: |
  809. BUILD_NUMBER="$(git rev-list --count HEAD)"
  810. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  811. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  812. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  813. else
  814. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  815. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  816. fi
  817. - name: Pack artifacts
  818. id: pack_artifacts
  819. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  820. run: |
  821. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
  822. - name: Upload artifacts
  823. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  824. uses: actions/upload-artifact@v4
  825. with:
  826. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
  827. name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  828. - name: Copy and pack Cuda runtime
  829. if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  830. run: |
  831. echo "Cuda install location: ${{ env.CUDA_PATH }}"
  832. $dst='.\build\bin\cudart\'
  833. robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  834. robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  835. 7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
  836. - name: Upload Cuda runtime
  837. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  838. uses: actions/upload-artifact@v4
  839. with:
  840. path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  841. name: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  842. windows-latest-cmake-sycl:
  843. runs-on: windows-latest
  844. defaults:
  845. run:
  846. shell: bash
  847. env:
  848. 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
  849. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  850. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  851. steps:
  852. - name: Clone
  853. id: checkout
  854. uses: actions/checkout@v4
  855. with:
  856. fetch-depth: 0
  857. - name: Install
  858. run: |
  859. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  860. - name: Build
  861. id: cmake_build
  862. run: examples/sycl/win-build-sycl.bat
  863. - name: Determine tag name
  864. id: tag
  865. shell: bash
  866. run: |
  867. BUILD_NUMBER="$(git rev-list --count HEAD)"
  868. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  869. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  870. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  871. else
  872. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  873. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  874. fi
  875. - name: Build the release package
  876. id: pack_artifacts
  877. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  878. run: |
  879. echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"
  880. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.5.dll" ./build/bin
  881. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_core.2.dll" ./build/bin
  882. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_tbb_thread.2.dll" ./build/bin
  883. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_level_zero.dll" ./build/bin
  884. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_opencl.dll" ./build/bin
  885. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_loader.dll" ./build/bin
  886. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_win_proxy_loader.dll" ./build/bin
  887. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl8.dll" ./build/bin
  888. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/svml_dispmd.dll" ./build/bin
  889. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libmmd.dll" ./build/bin
  890. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libiomp5md.dll" ./build/bin
  891. cp "${{ env.ONEAPI_ROOT }}/dnnl/latest/bin/dnnl.dll" ./build/bin
  892. cp "${{ env.ONEAPI_ROOT }}/tbb/latest/bin/tbb12.dll" ./build/bin
  893. echo "cp oneAPI running time dll files to ./build/bin done"
  894. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*
  895. - name: Upload the release package
  896. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  897. uses: actions/upload-artifact@v4
  898. with:
  899. path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip
  900. name: llama-bin-win-sycl-x64.zip
  901. windows-latest-cmake-hip:
  902. if: ${{ github.event.inputs.create_release != 'true' }}
  903. runs-on: windows-latest
  904. steps:
  905. - name: Clone
  906. id: checkout
  907. uses: actions/checkout@v4
  908. - name: Install
  909. id: depends
  910. run: |
  911. $ErrorActionPreference = "Stop"
  912. write-host "Downloading AMD HIP SDK Installer"
  913. 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"
  914. write-host "Installing AMD HIP SDK"
  915. Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
  916. write-host "Completed AMD HIP SDK installation"
  917. - name: Verify ROCm
  918. id: verify
  919. run: |
  920. & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
  921. - name: Install ccache
  922. uses: hendrikmuhs/ccache-action@v1.2
  923. with:
  924. key: ${{ github.job }}
  925. - name: Build
  926. id: cmake_build
  927. run: |
  928. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  929. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  930. cmake -G "Unix Makefiles" -B build -S . `
  931. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  932. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  933. -DCMAKE_BUILD_TYPE=Release `
  934. -DGGML_HIP=ON `
  935. -DGGML_RPC=ON
  936. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  937. windows-latest-cmake-hip-release:
  938. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  939. runs-on: windows-latest
  940. strategy:
  941. matrix:
  942. gpu_target: [gfx1100, gfx1101, gfx1030]
  943. steps:
  944. - name: Clone
  945. id: checkout
  946. uses: actions/checkout@v4
  947. with:
  948. fetch-depth: 0
  949. - name: Install
  950. id: depends
  951. run: |
  952. $ErrorActionPreference = "Stop"
  953. write-host "Downloading AMD HIP SDK Installer"
  954. 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"
  955. write-host "Installing AMD HIP SDK"
  956. Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
  957. write-host "Completed AMD HIP SDK installation"
  958. - name: Verify ROCm
  959. id: verify
  960. run: |
  961. & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
  962. - name: Build
  963. id: cmake_build
  964. run: |
  965. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  966. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  967. cmake -G "Unix Makefiles" -B build -S . `
  968. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  969. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  970. -DCMAKE_BUILD_TYPE=Release `
  971. -DAMDGPU_TARGETS=${{ matrix.gpu_target }} `
  972. -DGGML_HIP=ON `
  973. -DGGML_RPC=ON
  974. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  975. md "build\bin\rocblas\library\"
  976. cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
  977. cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
  978. cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
  979. - name: Determine tag name
  980. id: tag
  981. shell: bash
  982. run: |
  983. BUILD_NUMBER="$(git rev-list --count HEAD)"
  984. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  985. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  986. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  987. else
  988. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  989. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  990. fi
  991. - name: Pack artifacts
  992. id: pack_artifacts
  993. run: |
  994. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip .\build\bin\*
  995. - name: Upload artifacts
  996. uses: actions/upload-artifact@v4
  997. with:
  998. path: llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  999. name: llama-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  1000. ios-xcode-build:
  1001. runs-on: macos-latest
  1002. steps:
  1003. - name: Checkout code
  1004. uses: actions/checkout@v4
  1005. - name: Build
  1006. id: cmake_build
  1007. run: |
  1008. sysctl -a
  1009. mkdir build
  1010. cd build
  1011. cmake -G Xcode .. \
  1012. -DGGML_METAL_USE_BF16=ON \
  1013. -DGGML_METAL_EMBED_LIBRARY=ON \
  1014. -DLLAMA_BUILD_EXAMPLES=OFF \
  1015. -DLLAMA_BUILD_TESTS=OFF \
  1016. -DLLAMA_BUILD_SERVER=OFF \
  1017. -DCMAKE_SYSTEM_NAME=iOS \
  1018. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  1019. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  1020. cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  1021. sudo cmake --install . --config Release
  1022. - name: xcodebuild for swift package
  1023. id: xcodebuild
  1024. run: |
  1025. xcodebuild -scheme llama-Package -destination 'generic/platform=iOS'
  1026. - name: Build Xcode project
  1027. 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
  1028. android-build:
  1029. runs-on: ubuntu-latest
  1030. steps:
  1031. - name: Clone
  1032. uses: actions/checkout@v4
  1033. - name: Set up JDK
  1034. uses: actions/setup-java@v3
  1035. with:
  1036. java-version: 17
  1037. distribution: zulu
  1038. - name: Setup Android SDK
  1039. uses: android-actions/setup-android@v3
  1040. with:
  1041. log-accepted-android-sdk-licenses: false
  1042. - name: Build
  1043. run: |
  1044. cd examples/llama.android
  1045. ./gradlew build --no-daemon
  1046. release:
  1047. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  1048. runs-on: ubuntu-latest
  1049. needs:
  1050. - ubuntu-cpu-cmake
  1051. - windows-latest-cmake
  1052. - windows-2019-cmake-cuda
  1053. - windows-latest-cmake-hip-release
  1054. - macOS-latest-cmake-arm64
  1055. - macOS-latest-cmake-x64
  1056. steps:
  1057. - name: Clone
  1058. id: checkout
  1059. uses: actions/checkout@v4
  1060. with:
  1061. fetch-depth: 0
  1062. - name: Determine tag name
  1063. id: tag
  1064. shell: bash
  1065. run: |
  1066. BUILD_NUMBER="$(git rev-list --count HEAD)"
  1067. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  1068. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  1069. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  1070. else
  1071. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  1072. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  1073. fi
  1074. - name: Download artifacts
  1075. id: download-artifact
  1076. uses: actions/download-artifact@v4
  1077. with:
  1078. path: ./artifact
  1079. - name: Move artifacts
  1080. id: move_artifacts
  1081. run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
  1082. - name: Create release
  1083. id: create_release
  1084. uses: ggml-org/action-create-release@v1
  1085. env:
  1086. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1087. with:
  1088. tag_name: ${{ steps.tag.outputs.name }}
  1089. - name: Upload release
  1090. id: upload_release
  1091. uses: actions/github-script@v3
  1092. with:
  1093. github-token: ${{secrets.GITHUB_TOKEN}}
  1094. script: |
  1095. const path = require('path');
  1096. const fs = require('fs');
  1097. const release_id = '${{ steps.create_release.outputs.id }}';
  1098. for (let file of await fs.readdirSync('./artifact/release')) {
  1099. if (path.extname(file) === '.zip') {
  1100. console.log('uploadReleaseAsset', file);
  1101. await github.repos.uploadReleaseAsset({
  1102. owner: context.repo.owner,
  1103. repo: context.repo.repo,
  1104. release_id: release_id,
  1105. name: file,
  1106. data: await fs.readFileSync(`./artifact/release/${file}`)
  1107. });
  1108. }
  1109. }
  1110. # ubuntu-latest-gcc:
  1111. # runs-on: ubuntu-latest
  1112. #
  1113. # strategy:
  1114. # matrix:
  1115. # build: [Debug, Release]
  1116. #
  1117. # steps:
  1118. # - name: Clone
  1119. # uses: actions/checkout@v4
  1120. #
  1121. # - name: Dependencies
  1122. # run: |
  1123. # sudo apt-get update
  1124. # sudo apt-get install build-essential
  1125. # sudo apt-get install cmake
  1126. #
  1127. # - name: Configure
  1128. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1129. #
  1130. # - name: Build
  1131. # run: |
  1132. # make
  1133. #
  1134. # ubuntu-latest-clang:
  1135. # runs-on: ubuntu-latest
  1136. #
  1137. # strategy:
  1138. # matrix:
  1139. # build: [Debug, Release]
  1140. #
  1141. # steps:
  1142. # - name: Clone
  1143. # uses: actions/checkout@v4
  1144. #
  1145. # - name: Dependencies
  1146. # run: |
  1147. # sudo apt-get update
  1148. # sudo apt-get install build-essential
  1149. # sudo apt-get install cmake
  1150. #
  1151. # - name: Configure
  1152. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
  1153. #
  1154. # - name: Build
  1155. # run: |
  1156. # make
  1157. #
  1158. # ubuntu-latest-gcc-sanitized:
  1159. # runs-on: ubuntu-latest
  1160. #
  1161. # strategy:
  1162. # matrix:
  1163. # sanitizer: [ADDRESS, THREAD, UNDEFINED]
  1164. #
  1165. # steps:
  1166. # - name: Clone
  1167. # uses: actions/checkout@v4
  1168. #
  1169. # - name: Dependencies
  1170. # run: |
  1171. # sudo apt-get update
  1172. # sudo apt-get install build-essential
  1173. # sudo apt-get install cmake
  1174. #
  1175. # - name: Configure
  1176. # run: cmake . -DCMAKE_BUILD_TYPE=Debug -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON
  1177. #
  1178. # - name: Build
  1179. # run: |
  1180. # make
  1181. #
  1182. # windows:
  1183. # runs-on: windows-latest
  1184. #
  1185. # strategy:
  1186. # matrix:
  1187. # build: [Release]
  1188. # arch: [Win32, x64]
  1189. # include:
  1190. # - arch: Win32
  1191. # s2arc: x86
  1192. # - arch: x64
  1193. # s2arc: x64
  1194. #
  1195. # steps:
  1196. # - name: Clone
  1197. # uses: actions/checkout@v4
  1198. #
  1199. # - name: Add msbuild to PATH
  1200. # uses: microsoft/setup-msbuild@v1
  1201. #
  1202. # - name: Configure
  1203. # run: >
  1204. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1205. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1206. #
  1207. # - name: Build
  1208. # run: |
  1209. # cd ./build
  1210. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1211. #
  1212. # - name: Upload binaries
  1213. # uses: actions/upload-artifact@v4
  1214. # with:
  1215. # name: llama-bin-${{ matrix.arch }}
  1216. # path: build/bin/${{ matrix.build }}
  1217. #
  1218. # windows-blas:
  1219. # runs-on: windows-latest
  1220. #
  1221. # strategy:
  1222. # matrix:
  1223. # build: [Release]
  1224. # arch: [Win32, x64]
  1225. # blas: [ON]
  1226. # include:
  1227. # - arch: Win32
  1228. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x86.zip
  1229. # s2arc: x86
  1230. # - arch: x64
  1231. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
  1232. # s2arc: x64
  1233. #
  1234. # steps:
  1235. # - name: Clone
  1236. # uses: actions/checkout@v4
  1237. #
  1238. # - name: Add msbuild to PATH
  1239. # uses: microsoft/setup-msbuild@v1
  1240. #
  1241. # - name: Fetch OpenBLAS
  1242. # if: matrix.blas == 'ON'
  1243. # run: |
  1244. # C:/msys64/usr/bin/wget.exe -qO blas.zip ${{ matrix.obzip }}
  1245. # 7z x blas.zip -oblas -y
  1246. # copy blas/include/cblas.h .
  1247. # copy blas/include/openblas_config.h .
  1248. # echo "blasdir=$env:GITHUB_WORKSPACE/blas" >> $env:GITHUB_ENV
  1249. #
  1250. # - name: Configure
  1251. # run: >
  1252. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1253. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1254. # -DLLAMA_SUPPORT_OPENBLAS=${{ matrix.blas }}
  1255. # -DCMAKE_LIBRARY_PATH="$env:blasdir/lib"
  1256. #
  1257. # - name: Build
  1258. # run: |
  1259. # cd ./build
  1260. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1261. #
  1262. # - name: Copy libopenblas.dll
  1263. # if: matrix.blas == 'ON'
  1264. # run: copy "$env:blasdir/bin/libopenblas.dll" build/bin/${{ matrix.build }}
  1265. #
  1266. # - name: Upload binaries
  1267. # if: matrix.blas == 'ON'
  1268. # uses: actions/upload-artifact@v4
  1269. # with:
  1270. # name: llama-blas-bin-${{ matrix.arch }}
  1271. # path: build/bin/${{ matrix.build }}
  1272. #
  1273. # emscripten:
  1274. # runs-on: ubuntu-latest
  1275. #
  1276. # strategy:
  1277. # matrix:
  1278. # build: [Release]
  1279. #
  1280. # steps:
  1281. # - name: Clone
  1282. # uses: actions/checkout@v4
  1283. #
  1284. # - name: Dependencies
  1285. # run: |
  1286. # wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
  1287. # tar -xvf master.tar.gz
  1288. # emsdk-master/emsdk update
  1289. # emsdk-master/emsdk install latest
  1290. # emsdk-master/emsdk activate latest
  1291. #
  1292. # - name: Configure
  1293. # run: echo "tmp"
  1294. #
  1295. # - name: Build
  1296. # run: |
  1297. # pushd emsdk-master
  1298. # source ./emsdk_env.sh
  1299. # popd
  1300. # emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1301. # make
  1302. openEuler-latest-cmake-cann:
  1303. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1304. defaults:
  1305. run:
  1306. shell: bash -el {0}
  1307. runs-on: ubuntu-24.04-arm
  1308. strategy:
  1309. matrix:
  1310. cann:
  1311. - '8.0.rc3.beta1-910b-openeuler22.03-py3.10'
  1312. device:
  1313. - 'ascend910b3'
  1314. build:
  1315. - 'Release'
  1316. container: ascendai/cann:${{ matrix.cann }}
  1317. steps:
  1318. - name: Checkout
  1319. uses: actions/checkout@v4
  1320. - name: Dependencies
  1321. run: |
  1322. yum update -y
  1323. yum install -y git gcc gcc-c++ make cmake
  1324. - name: Build
  1325. run: |
  1326. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1327. cmake -S . -B build \
  1328. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1329. -DGGML_CANN=on \
  1330. -DSOC_TYPE=${{ matrix.device }}
  1331. cmake --build build -j $(nproc)