build.yml 55 KB

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