-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): release GPU wheel for concrete-python
- Loading branch information
Showing
2 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
name: Concrete Python Release (GPU) | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
instance_id: | ||
description: 'Instance ID' | ||
type: string | ||
instance_image_id: | ||
description: 'Instance AMI ID' | ||
type: string | ||
instance_type: | ||
description: 'Instance product type' | ||
type: string | ||
runner_name: | ||
description: 'Action runner name' | ||
type: string | ||
request_id: | ||
description: 'Slab request ID' | ||
type: string | ||
user_inputs: | ||
description: 'either "nightly" or "public" or "private" to specify the release type' | ||
required: true | ||
default: 'nightly' | ||
type: string | ||
|
||
env: | ||
DOCKER_IMAGE_TEST: ghcr.io/zama-ai/concrete-compiler | ||
CUDA_PATH: /usr/local/cuda-12.3 | ||
GCC_VERSION: 11 | ||
GLIB_VER: 2_28 | ||
RELEASE_TYPE: ${{ inputs.user_inputs }} | ||
|
||
jobs: | ||
build-linux-x86: | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
|
||
runs-on: ${{ github.event.inputs.runner_name }} | ||
steps: | ||
- name: Log instance configuration | ||
run: | | ||
echo "IDs: ${{ inputs.instance_id }}" | ||
echo "AMI: ${{ inputs.instance_image_id }}" | ||
echo "Type: ${{ inputs.instance_type }}" | ||
echo "Request ID: ${{ inputs.request_id }}" | ||
echo "User Inputs: ${{ inputs.user_inputs }}" | ||
- name: Set up GitHub environment | ||
run: | | ||
echo "HOME=/home/ubuntu" >> "${GITHUB_ENV}" | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
|
||
- name: Set release version (nightly) | ||
if: ${{ env.RELEASE_TYPE == 'nightly' }} | ||
run: | | ||
NIGHTLY_VERSION=$(date +"%Y.%m.%d") | ||
NIGHTLY_VERSION_ONE_NUMBER=$(date +"%Y%m%d") | ||
LATEST_RELEASE_VERSION=`git tag -l |grep "v.*" |sort |tail -n 1 | grep -e '[0-9].*' -o` | ||
echo "__version__ = \"${LATEST_RELEASE_VERSION}-dev${NIGHTLY_VERSION_ONE_NUMBER}\"" >| frontends/concrete-python/version.txt | ||
git tag nightly-$NIGHTLY_VERSION || true | ||
git push origin nightly-$NIGHTLY_VERSION || true | ||
- name: Set release version (public) | ||
if: ${{ env.RELEASE_TYPE == 'public' }} | ||
run: echo "__version__ = \"`git describe --tags --abbrev=0 | grep -e '[0-9].*' -o`\"" >| frontends/concrete-python/version.txt | ||
|
||
- name: Expose release version from Python | ||
run: cp frontends/concrete-python/version.txt frontends/concrete-python/concrete/fhe/version.py | ||
|
||
- name: Build wheel | ||
uses: addnab/docker-run-action@v3 | ||
id: build-compiler-bindings | ||
with: | ||
registry: ghcr.io | ||
image: ${{ env.DOCKER_IMAGE_TEST }} | ||
username: ${{ secrets.GHCR_LOGIN }} | ||
password: ${{ secrets.GHCR_PASSWORD }} | ||
options: >- | ||
-v ${{ github.workspace }}:/concrete | ||
-v ${{ github.workspace }}/build:/build | ||
-v ${{ env.SSH_AUTH_SOCK }}:/ssh.socket | ||
-e SSH_AUTH_SOCK=/ssh.socket | ||
--gpus all | ||
shell: bash | ||
run: | | ||
set -e | ||
rustup toolchain install nightly-2024-01-31 | ||
rm -rf /build/* | ||
export PYTHON=${{ format('python{0}', matrix.python-version) }} | ||
echo "Using $PYTHON" | ||
dnf -y install graphviz graphviz-devel | ||
cd /concrete/frontends/concrete-python | ||
make PYTHON=$PYTHON venv | ||
source .venv/bin/activate | ||
cd /concrete/compilers/concrete-compiler/compiler | ||
make BUILD_DIR=/build CCACHE=ON DATAFLOW_EXECUTION_ENABLED=OFF Python3_EXECUTABLE=$(which python) \ | ||
CUDA_SUPPORT=ON CUDA_PATH=${{ env.CUDA_PATH }} python-bindings | ||
echo "Debug: ccache statistics (after the build):" | ||
ccache -s | ||
cd /concrete/frontends/concrete-python | ||
export COMPILER_BUILD_DIRECTORY="/build" | ||
make whl | ||
deactivate | ||
- name: Upload wheel | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ format('wheel-{0}-linux-x86', matrix.python-version) }} | ||
path: frontends/concrete-python/dist/*manylinux*.whl | ||
retention-days: 3 | ||
|
||
|
||
test-linux-x86: | ||
needs: [build-linux-x86] | ||
continue-on-error: true | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
runs-on: ${{ github.event.inputs.runner_name }} | ||
steps: | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Download wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ format('wheel-{0}-linux-x86', matrix.python-version) }} | ||
path: ${{ format('wheel-{0}-linux-x86', matrix.python-version) }} | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
path: repo | ||
- name: Test wheel | ||
run: | | ||
WHEEL_DIR=$(pwd)/${{ format('wheel-{0}-linux-x86', matrix.python-version) }} | ||
CONCRETE_PYTHON=$(pwd)/repo/frontends/concrete-python | ||
# Initialize an empty test environment | ||
cd $(mktemp -d) | ||
python -m venv .testenv && source .testenv/bin/activate | ||
# Install the concrete-python wheel | ||
pip install $WHEEL_DIR/*.whl | ||
# Install extra requirements for tests | ||
sudo apt update -y | ||
sudo apt install -y graphviz libgraphviz-dev | ||
pip install -r $CONCRETE_PYTHON/requirements.extra-full.txt | ||
pip install -r $CONCRETE_PYTHON/requirements.dev.txt | ||
# Running tests | ||
cd $CONCRETE_PYTHON | ||
make pytest-gpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters