Skip to content

Commit 99b7d15

Browse files
committed
ci: add linux binaries to release build
1 parent 2b26469 commit 99b7d15

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed

.github/workflows/build.yml

+141
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,145 @@ jobs:
6666
cd build
6767
ctest --verbose
6868
69+
ubuntu-focal-cmake:
70+
runs-on: ubuntu-20.04
71+
72+
strategy:
73+
matrix:
74+
include:
75+
- build: 'avx2'
76+
defines: ''
77+
- build: 'avx'
78+
defines: '-DLLAMA_AVX2=OFF'
79+
80+
steps:
81+
- name: Clone
82+
id: checkout
83+
uses: actions/checkout@v1
84+
85+
- name: Dependencies
86+
id: depends
87+
run: |
88+
sudo apt-get update
89+
sudo apt-get install build-essential
90+
91+
- name: Build
92+
id: cmake_build
93+
run: |
94+
mkdir build
95+
cd build
96+
cmake .. ${{ matrix.defines }} -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON -DBUILD_SHARED_LIBS=ON
97+
cmake --build . --config Release
98+
99+
- name: Test
100+
id: cmake_test
101+
run: |
102+
cd build
103+
ctest --verbose
104+
105+
- name: Get commit hash
106+
id: commit
107+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
108+
uses: pr-mpt/actions-commit-hash@v2
109+
110+
- name: Pack artifacts
111+
id: pack_artifacts
112+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
113+
run: |
114+
7z a llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-ubuntu20.04-${{ matrix.build }}-x64.zip ./build/bin/*
115+
116+
- name: Upload artifacts
117+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
118+
uses: actions/upload-artifact@v3
119+
with:
120+
path: |
121+
llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-ubuntu20.04-${{ matrix.build }}-x64.zip
122+
123+
ubuntu-focal-cmake-cublas:
124+
runs-on: ubuntu-20.04
125+
126+
strategy:
127+
matrix:
128+
cuda: ['12.1.0', '11.7.1']
129+
build: ['cublas']
130+
131+
steps:
132+
- name: Clone
133+
id: checkout
134+
uses: actions/checkout@v1
135+
136+
- name: Dependencies
137+
id: depends
138+
run: |
139+
sudo apt-get update
140+
sudo apt-get install build-essential
141+
142+
- uses: Jimver/cuda-toolkit@v0.2.10
143+
id: cuda-toolkit
144+
with:
145+
cuda: ${{ matrix.cuda }}
146+
# TODO(green-sky): _dev seems to fail, and non dev are not enought
147+
#sub-packages: '["nvcc", "cudart", "cublas", "cudart_dev", "cublas_dev"]'
148+
149+
- name: Build
150+
id: cmake_build
151+
run: |
152+
mkdir build
153+
cd build
154+
cmake .. -DLLAMA_CUBLAS=ON -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON -DBUILD_SHARED_LIBS=ON
155+
cmake --build . --config Release
156+
157+
- name: Get commit hash
158+
id: commit
159+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
160+
uses: pr-mpt/actions-commit-hash@v2
161+
162+
- name: Pack artifacts
163+
id: pack_artifacts
164+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
165+
run: |
166+
7z a llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-ubuntu20.04-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip ./build/bin/*
167+
168+
- name: Upload artifacts
169+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
170+
uses: actions/upload-artifact@v3
171+
with:
172+
path: |
173+
llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-ubuntu20.04-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
174+
175+
- name: Copy and pack Cuda runtime
176+
if: ${{ matrix.cuda == '12.1.0' }}
177+
# TODO(green-sky): paths are cuda 12 specific
178+
run: |
179+
echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
180+
mkdir './build/bin/cudart/'
181+
ls "${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
182+
ls "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/bin"
183+
ls "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64"
184+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcudart.so.12" './build/bin/cudart/'
185+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcublas.so.12" './build/bin/cudart/'
186+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcublasLt.so.12" './build/bin/cudart/'
187+
7z a cudart-llama-bin-ubuntu20.04-cu${{ matrix.cuda }}-x64.zip ./build/bin/cudart/*
188+
189+
- name: Copy and pack Cuda runtime
190+
if: ${{ matrix.cuda == '11.7.1' }}
191+
# TODO(green-sky): paths are cuda 11 specific
192+
run: |
193+
echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
194+
mkdir './build/bin/cudart/'
195+
ls "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64"
196+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcudart.so.11.0" './build/bin/cudart/'
197+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcublas.so.11" './build/bin/cudart/'
198+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcublasLt.so.11" './build/bin/cudart/'
199+
7z a cudart-llama-bin-ubuntu20.04-cu${{ matrix.cuda }}-x64.zip ./build/bin/cudart/*
200+
201+
- name: Upload Cuda runtime
202+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
203+
uses: actions/upload-artifact@v3
204+
with:
205+
path: |
206+
cudart-llama-bin-ubuntu20.04-cu${{ matrix.cuda }}-x64.zip
207+
69208
ubuntu-latest-cmake-sanitizer:
70209
runs-on: ubuntu-latest
71210

@@ -351,6 +490,8 @@ jobs:
351490
needs:
352491
- ubuntu-focal-make
353492
- ubuntu-latest-cmake
493+
- ubuntu-focal-cmake
494+
- ubuntu-focal-cmake-cublas
354495
- macOS-latest-make
355496
- macOS-latest-cmake
356497
- windows-latest-cmake

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
88
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
99
endif()
1010

11+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
1112
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
1213

1314
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)

0 commit comments

Comments
 (0)