1
0

build.yml 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511
  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 . `
  930. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  931. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  932. -DCMAKE_BUILD_TYPE=Release `
  933. -DGGML_HIP=ON `
  934. -DGGML_RPC=ON
  935. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  936. windows-latest-cmake-hip-release:
  937. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  938. runs-on: windows-latest
  939. strategy:
  940. matrix:
  941. gpu_target: [gfx1100, gfx1101, gfx1030]
  942. steps:
  943. - name: Clone
  944. id: checkout
  945. uses: actions/checkout@v4
  946. with:
  947. fetch-depth: 0
  948. - name: Install
  949. id: depends
  950. run: |
  951. $ErrorActionPreference = "Stop"
  952. write-host "Downloading AMD HIP SDK Installer"
  953. 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"
  954. write-host "Installing AMD HIP SDK"
  955. Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
  956. write-host "Completed AMD HIP SDK installation"
  957. - name: Verify ROCm
  958. id: verify
  959. run: |
  960. & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
  961. - name: Build
  962. id: cmake_build
  963. run: |
  964. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  965. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  966. cmake -G "Unix Makefiles" -B build -S . `
  967. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  968. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  969. -DCMAKE_BUILD_TYPE=Release `
  970. -DAMDGPU_TARGETS=${{ matrix.gpu_target }} `
  971. -DGGML_HIP=ON `
  972. -DGGML_RPC=ON
  973. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  974. md "build\bin\rocblas\library\"
  975. cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
  976. cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
  977. cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
  978. - name: Determine tag name
  979. id: tag
  980. shell: bash
  981. run: |
  982. BUILD_NUMBER="$(git rev-list --count HEAD)"
  983. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  984. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  985. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  986. else
  987. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  988. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  989. fi
  990. - name: Pack artifacts
  991. id: pack_artifacts
  992. run: |
  993. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip .\build\bin\*
  994. - name: Upload artifacts
  995. uses: actions/upload-artifact@v4
  996. with:
  997. path: llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  998. name: llama-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  999. ios-xcode-build:
  1000. runs-on: macos-latest
  1001. steps:
  1002. - name: Checkout code
  1003. uses: actions/checkout@v4
  1004. - name: Build
  1005. id: cmake_build
  1006. run: |
  1007. sysctl -a
  1008. mkdir build
  1009. cd build
  1010. cmake -G Xcode .. \
  1011. -DGGML_METAL_USE_BF16=ON \
  1012. -DGGML_METAL_EMBED_LIBRARY=ON \
  1013. -DLLAMA_BUILD_EXAMPLES=OFF \
  1014. -DLLAMA_BUILD_TESTS=OFF \
  1015. -DLLAMA_BUILD_SERVER=OFF \
  1016. -DCMAKE_SYSTEM_NAME=iOS \
  1017. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  1018. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  1019. cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  1020. sudo cmake --install . --config Release
  1021. - name: xcodebuild for swift package
  1022. id: xcodebuild
  1023. run: |
  1024. xcodebuild -scheme llama-Package -destination 'generic/platform=iOS'
  1025. - name: Build Xcode project
  1026. 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
  1027. android-build:
  1028. runs-on: ubuntu-latest
  1029. steps:
  1030. - name: Clone
  1031. uses: actions/checkout@v4
  1032. - name: Set up JDK
  1033. uses: actions/setup-java@v3
  1034. with:
  1035. java-version: 17
  1036. distribution: zulu
  1037. - name: Setup Android SDK
  1038. uses: android-actions/setup-android@v3
  1039. with:
  1040. log-accepted-android-sdk-licenses: false
  1041. - name: Build
  1042. run: |
  1043. cd examples/llama.android
  1044. ./gradlew build --no-daemon
  1045. release:
  1046. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  1047. runs-on: ubuntu-latest
  1048. needs:
  1049. - ubuntu-cpu-cmake
  1050. - windows-latest-cmake
  1051. - windows-2019-cmake-cuda
  1052. - windows-latest-cmake-hip-release
  1053. - macOS-latest-cmake-arm64
  1054. - macOS-latest-cmake-x64
  1055. steps:
  1056. - name: Clone
  1057. id: checkout
  1058. uses: actions/checkout@v4
  1059. with:
  1060. fetch-depth: 0
  1061. - name: Determine tag name
  1062. id: tag
  1063. shell: bash
  1064. run: |
  1065. BUILD_NUMBER="$(git rev-list --count HEAD)"
  1066. SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  1067. if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  1068. echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  1069. else
  1070. SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  1071. echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  1072. fi
  1073. - name: Download artifacts
  1074. id: download-artifact
  1075. uses: actions/download-artifact@v4
  1076. with:
  1077. path: ./artifact
  1078. - name: Move artifacts
  1079. id: move_artifacts
  1080. run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
  1081. - name: Create release
  1082. id: create_release
  1083. uses: ggml-org/action-create-release@v1
  1084. env:
  1085. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1086. with:
  1087. tag_name: ${{ steps.tag.outputs.name }}
  1088. - name: Upload release
  1089. id: upload_release
  1090. uses: actions/github-script@v3
  1091. with:
  1092. github-token: ${{secrets.GITHUB_TOKEN}}
  1093. script: |
  1094. const path = require('path');
  1095. const fs = require('fs');
  1096. const release_id = '${{ steps.create_release.outputs.id }}';
  1097. for (let file of await fs.readdirSync('./artifact/release')) {
  1098. if (path.extname(file) === '.zip') {
  1099. console.log('uploadReleaseAsset', file);
  1100. await github.repos.uploadReleaseAsset({
  1101. owner: context.repo.owner,
  1102. repo: context.repo.repo,
  1103. release_id: release_id,
  1104. name: file,
  1105. data: await fs.readFileSync(`./artifact/release/${file}`)
  1106. });
  1107. }
  1108. }
  1109. # ubuntu-latest-gcc:
  1110. # runs-on: ubuntu-latest
  1111. #
  1112. # strategy:
  1113. # matrix:
  1114. # build: [Debug, Release]
  1115. #
  1116. # steps:
  1117. # - name: Clone
  1118. # uses: actions/checkout@v4
  1119. #
  1120. # - name: Dependencies
  1121. # run: |
  1122. # sudo apt-get update
  1123. # sudo apt-get install build-essential
  1124. # sudo apt-get install cmake
  1125. #
  1126. # - name: Configure
  1127. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1128. #
  1129. # - name: Build
  1130. # run: |
  1131. # make
  1132. #
  1133. # ubuntu-latest-clang:
  1134. # runs-on: ubuntu-latest
  1135. #
  1136. # strategy:
  1137. # matrix:
  1138. # build: [Debug, Release]
  1139. #
  1140. # steps:
  1141. # - name: Clone
  1142. # uses: actions/checkout@v4
  1143. #
  1144. # - name: Dependencies
  1145. # run: |
  1146. # sudo apt-get update
  1147. # sudo apt-get install build-essential
  1148. # sudo apt-get install cmake
  1149. #
  1150. # - name: Configure
  1151. # run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
  1152. #
  1153. # - name: Build
  1154. # run: |
  1155. # make
  1156. #
  1157. # ubuntu-latest-gcc-sanitized:
  1158. # runs-on: ubuntu-latest
  1159. #
  1160. # strategy:
  1161. # matrix:
  1162. # sanitizer: [ADDRESS, THREAD, UNDEFINED]
  1163. #
  1164. # steps:
  1165. # - name: Clone
  1166. # uses: actions/checkout@v4
  1167. #
  1168. # - name: Dependencies
  1169. # run: |
  1170. # sudo apt-get update
  1171. # sudo apt-get install build-essential
  1172. # sudo apt-get install cmake
  1173. #
  1174. # - name: Configure
  1175. # run: cmake . -DCMAKE_BUILD_TYPE=Debug -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON
  1176. #
  1177. # - name: Build
  1178. # run: |
  1179. # make
  1180. #
  1181. # windows:
  1182. # runs-on: windows-latest
  1183. #
  1184. # strategy:
  1185. # matrix:
  1186. # build: [Release]
  1187. # arch: [Win32, x64]
  1188. # include:
  1189. # - arch: Win32
  1190. # s2arc: x86
  1191. # - arch: x64
  1192. # s2arc: x64
  1193. #
  1194. # steps:
  1195. # - name: Clone
  1196. # uses: actions/checkout@v4
  1197. #
  1198. # - name: Add msbuild to PATH
  1199. # uses: microsoft/setup-msbuild@v1
  1200. #
  1201. # - name: Configure
  1202. # run: >
  1203. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1204. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1205. #
  1206. # - name: Build
  1207. # run: |
  1208. # cd ./build
  1209. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1210. #
  1211. # - name: Upload binaries
  1212. # uses: actions/upload-artifact@v4
  1213. # with:
  1214. # name: llama-bin-${{ matrix.arch }}
  1215. # path: build/bin/${{ matrix.build }}
  1216. #
  1217. # windows-blas:
  1218. # runs-on: windows-latest
  1219. #
  1220. # strategy:
  1221. # matrix:
  1222. # build: [Release]
  1223. # arch: [Win32, x64]
  1224. # blas: [ON]
  1225. # include:
  1226. # - arch: Win32
  1227. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x86.zip
  1228. # s2arc: x86
  1229. # - arch: x64
  1230. # obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
  1231. # s2arc: x64
  1232. #
  1233. # steps:
  1234. # - name: Clone
  1235. # uses: actions/checkout@v4
  1236. #
  1237. # - name: Add msbuild to PATH
  1238. # uses: microsoft/setup-msbuild@v1
  1239. #
  1240. # - name: Fetch OpenBLAS
  1241. # if: matrix.blas == 'ON'
  1242. # run: |
  1243. # C:/msys64/usr/bin/wget.exe -qO blas.zip ${{ matrix.obzip }}
  1244. # 7z x blas.zip -oblas -y
  1245. # copy blas/include/cblas.h .
  1246. # copy blas/include/openblas_config.h .
  1247. # echo "blasdir=$env:GITHUB_WORKSPACE/blas" >> $env:GITHUB_ENV
  1248. #
  1249. # - name: Configure
  1250. # run: >
  1251. # cmake -S . -B ./build -A ${{ matrix.arch }}
  1252. # -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1253. # -DLLAMA_SUPPORT_OPENBLAS=${{ matrix.blas }}
  1254. # -DCMAKE_LIBRARY_PATH="$env:blasdir/lib"
  1255. #
  1256. # - name: Build
  1257. # run: |
  1258. # cd ./build
  1259. # msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
  1260. #
  1261. # - name: Copy libopenblas.dll
  1262. # if: matrix.blas == 'ON'
  1263. # run: copy "$env:blasdir/bin/libopenblas.dll" build/bin/${{ matrix.build }}
  1264. #
  1265. # - name: Upload binaries
  1266. # if: matrix.blas == 'ON'
  1267. # uses: actions/upload-artifact@v4
  1268. # with:
  1269. # name: llama-blas-bin-${{ matrix.arch }}
  1270. # path: build/bin/${{ matrix.build }}
  1271. #
  1272. # emscripten:
  1273. # runs-on: ubuntu-latest
  1274. #
  1275. # strategy:
  1276. # matrix:
  1277. # build: [Release]
  1278. #
  1279. # steps:
  1280. # - name: Clone
  1281. # uses: actions/checkout@v4
  1282. #
  1283. # - name: Dependencies
  1284. # run: |
  1285. # wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
  1286. # tar -xvf master.tar.gz
  1287. # emsdk-master/emsdk update
  1288. # emsdk-master/emsdk install latest
  1289. # emsdk-master/emsdk activate latest
  1290. #
  1291. # - name: Configure
  1292. # run: echo "tmp"
  1293. #
  1294. # - name: Build
  1295. # run: |
  1296. # pushd emsdk-master
  1297. # source ./emsdk_env.sh
  1298. # popd
  1299. # emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
  1300. # make
  1301. openEuler-latest-cmake-cann:
  1302. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1303. defaults:
  1304. run:
  1305. shell: bash -el {0}
  1306. runs-on: ubuntu-24.04-arm
  1307. strategy:
  1308. matrix:
  1309. cann:
  1310. - '8.0.rc3.beta1-910b-openeuler22.03-py3.10'
  1311. device:
  1312. - 'ascend910b3'
  1313. build:
  1314. - 'Release'
  1315. container: ascendai/cann:${{ matrix.cann }}
  1316. steps:
  1317. - name: Checkout
  1318. uses: actions/checkout@v4
  1319. - name: Dependencies
  1320. run: |
  1321. yum update -y
  1322. yum install -y git gcc gcc-c++ make cmake
  1323. - name: Build
  1324. run: |
  1325. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1326. cmake -S . -B build \
  1327. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1328. -DGGML_CANN=on \
  1329. -DSOC_TYPE=${{ matrix.device }}
  1330. cmake --build build -j $(nproc)