diff --git a/.github/workflows/linux_cuda.yaml b/.github/workflows/linux_cuda.yaml index 1a5e042..f8fa8ce 100644 --- a/.github/workflows/linux_cuda.yaml +++ b/.github/workflows/linux_cuda.yaml @@ -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 }} diff --git a/.github/workflows/linux_cuda_base.yaml b/.github/workflows/linux_cuda_base.yaml index d6cab7f..f1df4ba 100644 --- a/.github/workflows/linux_cuda_base.yaml +++ b/.github/workflows/linux_cuda_base.yaml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: python: ["3.9", "3.10", "3.11"] - cuda: ["11.8", "12.1"] + cuda: ["11", "12"] version: ["cuda"] dependencies: ["base"] diff --git a/.github/workflows/linux_cuda_latest_scheduled.yaml b/.github/workflows/linux_cuda_latest_scheduled.yaml index 3366a33..c9a6f3d 100644 --- a/.github/workflows/linux_cuda_latest_scheduled.yaml +++ b/.github/workflows/linux_cuda_latest_scheduled.yaml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: python: ["3.9", "3.10", "3.11"] - cuda: ["11.8", "12.1"] + cuda: ["11", "12"] version: ["latest"] dependencies: ["", "dev", "tutorials"] diff --git a/.github/workflows/linux_cuda_manual.yaml b/.github/workflows/linux_cuda_manual.yaml index f87e0bc..1bc90b5 100644 --- a/.github/workflows/linux_cuda_manual.yaml +++ b/.github/workflows/linux_cuda_manual.yaml @@ -20,7 +20,7 @@ jobs: fail-fast: false matrix: python: ["3.9", "3.10", "3.11"] - cuda: ["11.8", "12.1"] + cuda: ["11", "12"] uses: ./.github/workflows/linux_cuda.yaml with: diff --git a/.github/workflows/linux_cuda_release.yaml b/.github/workflows/linux_cuda_release.yaml new file mode 100644 index 0000000..776a562 --- /dev/null +++ b/.github/workflows/linux_cuda_release.yaml @@ -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 diff --git a/docker/cuda11/Dockerfile b/docker/cuda11/Dockerfile new file mode 100644 index 0000000..2692d78 --- /dev/null +++ b/docker/cuda11/Dockerfile @@ -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 diff --git a/docker/Dockerfile b/docker/cuda12/Dockerfile similarity index 98% rename from docker/Dockerfile rename to docker/cuda12/Dockerfile index 8d92aad..79b00ad 100644 --- a/docker/Dockerfile +++ b/docker/cuda12/Dockerfile @@ -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 && \