Skip to content

Commit a6c5f59

Browse files
committed
ci: add linux binaries to release build
1 parent 061f5f8 commit a6c5f59

File tree

2 files changed

+144
-0
lines changed

2 files changed

+144
-0
lines changed

.github/workflows/build.yml

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

@@ -358,6 +499,8 @@ jobs:
358499
needs:
359500
- ubuntu-focal-make
360501
- ubuntu-latest-cmake
502+
- ubuntu-focal-cmake
503+
- ubuntu-focal-cmake-cublas
361504
- macOS-latest-make
362505
- macOS-latest-cmake
363506
- windows-latest-cmake

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
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)