Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
FIx cuda 11 base image build (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkim0 authored Feb 16, 2024
1 parent 9fc63a4 commit e82902f
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux_cuda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- uses: docker/build-push-action@v5
with:
context: ./docker
context: ./docker/cuda${{ inputs.cuda }}
push: true
target: ${{ steps.build.outputs.target }}
tags: scverse/scvi-tools:py${{ inputs.python }}-cu${{ inputs.cuda }}-${{ steps.build.outputs.dependencies }}${{ steps.build.outputs.versiontag }}
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/linux_cuda_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Linux (CUDA, manual)

on:
workflow_dispatch:
inputs:
version:
description: "semver"
required: true
default: "latest"
type: string

dependencies:
description: "optional dependencies"
required: false
type: string

jobs:
build-semver:
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
cuda: ["11", "12"]
dependencies: ["", "dev", "tutorials"]

uses: ./.github/workflows/linux_cuda.yaml
with:
python: ${{ matrix.python }}
cuda: ${{ matrix.cuda }}
version: ${{ inputs.version }}
dependencies: ${{ matrix.dependencies }}

secrets: inherit

build-stable:
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
cuda: ["11", "12"]
dependencies: ["", "dev", "tutorials"]

uses: ./.github/workflows/linux_cuda.yaml
with:
python: ${{ matrix.python }}
cuda: ${{ matrix.cuda }}
version: stable
dependencies: ${{ matrix.dependencies }}

secrets: inherit
56 changes: 56 additions & 0 deletions docker/cuda11/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM condaforge/miniforge3:latest AS base

RUN head -n -1 "${HOME}/.bashrc" > "${HOME}/tmp.bashrc" ; \
mv "${HOME}/tmp.bashrc" "${HOME}/.bashrc"

ARG PYTHON_VERSION
RUN mamba create --copy -y -p /env \
python=${PYTHON_VERSION} -c conda-forge && \
mamba clean -ayf

RUN mamba install -y -p /env \
gcc cxx-compiler -c conda-forge && \
mamba clean -ayf

ARG CUDA_VERSION=11
RUN CONDA_OVERRIDE_CUDA=${CUDA_VERSION} mamba install -y -p /env \
pytorch torchvision torchaudio pytorch-cuda=${CUDA_VERSION} \
-c pytorch -c nvidia && \
mamba clean -ayf

ARG CUDA_VERSION=11
RUN mamba run -p /env \
python -m pip install --no-cache-dir -U "jax[cuda${CUDA_VERSION}_pip]" \
-f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html && \
mamba run -p /env \
python -m pip cache purge

ENV PATH "/env/bin:$PATH"

RUN conda init --reverse && \
rm -rf $(conda info --base) && \
rm -f "${HOME}/.condarc" && \
rm -rf ${HOME}/.conda && \
rm -rf /opt/conda

FROM base AS latest
ARG DEPENDENCIES=""
RUN pip install --no-cache-dir "scvi-tools[${DEPENDENCIES}] @ git+https://github.com/scverse/scvi-tools" && \
pip cache purge

FROM base AS stable
ARG DEPENDENCIES=""
RUN pip install -U --no-cache-dir "scvi-tools[${DEPENDENCIES}]" && \
pip cache purge

FROM base AS branch
ARG SCVI_TOOLS_VERSION=main
ARG DEPENDENCIES=""
RUN pip install --no-cache-dir "scvi-tools[${DEPENDENCIES}] @ git+https://github.com/scverse/scvi-tools@${SCVI_TOOLS_VERSION}" && \
pip cache purge

FROM base AS semver
ARG SCVI_TOOLS_VERSION=latest
ARG DEPENDENCIES=""
RUN pip install --no-cache-dir "scvi-tools[${DEPENDENCIES}]==${SCVI_TOOLS_VERSION}" && \
pip cache purge
10 changes: 5 additions & 5 deletions docker/Dockerfile → docker/cuda12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ RUN mamba create --copy -y -p /env \
python=${PYTHON_VERSION} -c conda-forge && \
mamba clean -ayf

ARG CUDA_VERSION
RUN mamba install -y -p /env \
gcc cxx-compiler -c conda-forge && \
mamba clean -ayf

ARG CUDA_VERSION=12
RUN CONDA_OVERRIDE_CUDA=${CUDA_VERSION} mamba install -y -p /env \
pytorch torchvision torchaudio pytorch-cuda=${CUDA_VERSION} \
jaxlib=*=*cuda* jax cuda-nvcc -c pytorch -c conda-forge -c nvidia && \
mamba clean -ayf

RUN mamba install -y -p /env \
gcc cxx-compiler -c conda-forge && \
mamba clean -ayf

ENV PATH "/env/bin:$PATH"

RUN conda init --reverse && \
Expand Down

0 comments on commit e82902f

Please sign in to comment.