build.yml 55 KB

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