Skip to content

Commit fc60a27

Browse files
committed
ci: add linux binaries to release build
1 parent 9ca4abe commit fc60a27

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed

.github/workflows/build.yml

+145
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,149 @@ 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.11
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+
sub-packages: '["nvcc", "cudart"]'
154+
non-cuda-sub-packages: '["libcublas", "libcublas-dev"]'
155+
156+
- name: Build
157+
id: cmake_build
158+
run: |
159+
mkdir build
160+
cd build
161+
cmake .. -DLLAMA_CUBLAS=ON -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON -DBUILD_SHARED_LIBS=ON
162+
cmake --build . --config Release
163+
164+
- name: Get commit hash
165+
id: commit
166+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
167+
uses: pr-mpt/actions-commit-hash@v2
168+
169+
- name: Pack artifacts
170+
id: pack_artifacts
171+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
172+
run: |
173+
7z a llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-ubuntu20.04-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip ./build/bin/*
174+
175+
- name: Upload artifacts
176+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
177+
uses: actions/upload-artifact@v3
178+
with:
179+
path: |
180+
llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-ubuntu20.04-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
181+
182+
- name: Copy and pack Cuda runtime
183+
if: ${{ matrix.cuda == '12.1.0' }}
184+
# TODO(green-sky): paths are cuda 12 specific
185+
run: |
186+
echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
187+
mkdir './build/bin/cudart/'
188+
ls "${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
189+
ls "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/bin"
190+
ls "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64"
191+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcudart.so.12" './build/bin/cudart/'
192+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcublas.so.12" './build/bin/cudart/'
193+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcublasLt.so.12" './build/bin/cudart/'
194+
7z a cudart-llama-bin-ubuntu20.04-cu${{ matrix.cuda }}-x64.zip ./build/bin/cudart/*
195+
196+
- name: Copy and pack Cuda runtime
197+
if: ${{ matrix.cuda == '11.7.1' }}
198+
# TODO(green-sky): paths are cuda 11 specific
199+
run: |
200+
echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
201+
mkdir './build/bin/cudart/'
202+
ls "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64"
203+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcudart.so.11.0" './build/bin/cudart/'
204+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcublas.so.11" './build/bin/cudart/'
205+
cp "${{steps.cuda-toolkit.outputs.CUDA_PATH}}/lib64/libcublasLt.so.11" './build/bin/cudart/'
206+
7z a cudart-llama-bin-ubuntu20.04-cu${{ matrix.cuda }}-x64.zip ./build/bin/cudart/*
207+
208+
- name: Upload Cuda runtime
209+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
210+
uses: actions/upload-artifact@v3
211+
with:
212+
path: |
213+
cudart-llama-bin-ubuntu20.04-cu${{ matrix.cuda }}-x64.zip
214+
72215
ubuntu-latest-cmake-sanitizer:
73216
runs-on: ubuntu-latest
74217

@@ -394,6 +537,8 @@ jobs:
394537
needs:
395538
- ubuntu-focal-make
396539
- ubuntu-latest-cmake
540+
- ubuntu-focal-cmake
541+
- ubuntu-focal-cmake-cublas
397542
- macOS-latest-make
398543
- macOS-latest-cmake
399544
- 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)