Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major update: Add gpu support to Bioconductor containers [WIP] #49

Draft
wants to merge 8 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/weekly-build-bioc-ml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Bioc ML-GPU image weekly build

on:
push:
branches:
- 'add_gpu_support'

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Checkout rocker/versioned2 repo
uses: actions/checkout@v3
with:
repository: rocker-org/rocker-versioned2
path: rocker-versioned2

-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build and export
uses: docker/build-push-action@v2
with:
context: .
file: dockerfiles/r-ver_devel.Dockerfile
tags: rocker/r-ver:devel
outputs: type=docker,dest=/tmp/rverdevel.tar
-
name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: r-ver
path: /tmp/rverdevel.tar

# -
# name: Checkout
# uses: actions/checkout@v2

use:
runs-on: ubuntu-latest
needs: build
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Download artifact
uses: actions/download-artifact@v2
with:
name: myimage
path: /tmp
-
name: Load image
run: |
docker load --input /tmp/myimage.tar
docker image ls -a


63 changes: 63 additions & 0 deletions .scripts/weekly_build_ml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
set -e
echo "Build bioconductor_docker image"

###############################################
## Step 0: Set up variables and clone
## Rocker repo
ROCKER_REPO=https://github.com/rocker-org/rocker-versioned2

## git clone rocker
git clone --depth 1 $ROCKER_REPO

###############################################
## 1. docker build rocker r-ver: repo

cd rocker-versioned2/

#################################################################
## NOTE: This needs to change when it comes time for RELEASE_3_12
##
## The R_VERSION in the dockerfile for r-ver needs to be changed to
## 'ENV R_VERSION=patched' during this release cycle.
##
## This will be done with the help of "sed"

#sed -r -i 's/ENV R_VERSION=4.0.2/ENV R_VERSION=patched/g' dockerfiles/r-ver_4.0.2.Dockerfile

#################################################################

docker build -t rocker/r-ver:devel -f dockerfiles/r-ver_devel.Dockerfile .

###############################################
## 2. docker build rocker/cuda:devel

echo "*** Building rocker/cuda:devel *** \n"

docker build -t rocker/cuda:devel -f dockerfiles/cuda_devel.Dockerfile .

###############################################
## 3. docker build nitesh1989/bioconductor_ml:devel

cd $GITHUB_WORKSPACE;

echo "*** Building nitesh1989/bioconductor_ml *** \n"

## increment version number with sed
sed -r -i 's/(^ARG BIOCONDUCTOR_PATCH=)([0-9]+)$/echo "\1$((\2+1))"/ge' Dockerfile

## Git login
git config user.email "[email protected]"
git config user.name "bioc-docker-bot"

## Git commit
git commit -am "Weekly version bump and rebuild of nitesh1989/bioconductor_ml:devel"

## docker build, login and push
docker build -t nitesh1989/bioconductor_ml:devel -f dockerfiles/bioc_ml_devel.Dockerfile .

docker login --username=$DOCKER_USERNAME --password=$DOCKER_PASSWORD

docker push nitesh1989/bioconductor_ml:devel

## Finish
echo "Done"
9 changes: 9 additions & 0 deletions bioc_scripts/add_bioc_devel_env_variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Variables in Renviron.site are made available inside of R.
# Add libsbml CFLAGS

curl -O http://bioconductor.org/checkResults/devel/bioc-LATEST/Renviron.bioc \
&& cat Renviron.bioc | grep -o '^[^#]*' | sed 's/export //g' >>/etc/environment \
&& cat Renviron.bioc >> /usr/local/lib/R/etc/Renviron.site \
&& echo 'LIBSBML_CFLAGS="-I/usr/include"' >> /usr/local/lib/R/etc/Renviron.site \
&& echo 'LIBSBML_LIBS="-lsbml"' >> /usr/local/lib/R/etc/Renviron.site \
&& rm -rf Renviron.bioc
13 changes: 13 additions & 0 deletions bioc_scripts/conda-tensorflow-env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: conda-tensorflow-env
channels:
- defaults
- conda-forge
dependencies:
- python=3.9
- anaconda
- pip
- git
## Scientific Computing
- numpy
- scipy
- tensorflow-gpu
19 changes: 19 additions & 0 deletions bioc_scripts/install-conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \
&& /bin/bash ~/miniconda.sh -b -p /opt/conda \
&& rm -f ~/miniconda.sh

## https://docs.anaconda.com/anaconda/install/multi-user/ -
## Multi user conda installation -
## Install conda for both rstudio user and root -
## make sure the "env" is available to both users
groupadd condausers
chgrp -R condausers /opt/conda
chmod 770 -R /opt/conda

## Add rstudio to condausers group
adduser rstudio condausers

## Make sure conda works on "rstudio" user as well
cat <<"EOF">>/etc/bash.bashrc
PATH=/opt/conda/bin:$PATH
EOF
File renamed without changes.
51 changes: 51 additions & 0 deletions dockerfiles/bioconductor_ml.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# The suggested name for this image is: bioconductor/bioconductor_docker:devel
FROM rocker/ml:4.2.0

## Set Dockerfile version number
ARG BIOCONDUCTOR_VERSION=3.16

##### IMPORTANT ########
## The PATCH version number should be incremented each time
## there is a change in the Dockerfile.
ARG BIOCONDUCTOR_PATCH=0
ARG BIOCONDUCTOR_DOCKER_VERSION=${BIOCONDUCTOR_VERSION}.${BIOCONDUCTOR_PATCH}

LABEL name="bioconductor/bioconductor_docker" \
version=$BIOCONDUCTOR_DOCKER_VERSION \
url="https://github.com/Bioconductor/bioconductor_docker" \
vendor="Bioconductor Project" \
maintainer="[email protected]" \
description="Bioconductor docker image with system dependencies to install all packages." \
license="Artistic-2.0"

## Add Bioconductor Requirements
ADD bioc_scripts /tmp/bioc_scripts

## Add host-site-library
## Set PIP_USER=false
RUN echo "R_LIBS=/usr/local/lib/R/host-site-library:\${R_LIBS}" > /usr/local/lib/R/etc/Renviron.site \
&& echo "BIOCONDUCTOR_VERSION=${BIOCONDUCTOR_VERSION}" >> /usr/local/lib/R/etc/Renviron.site \
&& echo "BIOCONDUCTOR_DOCKER_VERSION=${BIOCONDUCTOR_DOCKER_VERSION}" >> /usr/local/lib/R/etc/Renviron.site \
&& echo "PIP_USER=false" >> /usr/local/lib/R/etc/Renviron.site

# 1. Install Bioconductor system depdencies
RUN bash /tmp/bioc_scripts/install_bioc_sysdeps.sh

# 2. Install specific version of BiocManager and libraries
RUN R -f /tmp/bioc_scripts/install.R

# 3. DEVEL: Add sys env variables to DEVEL image
RUN bash /tmp/bioc_scripts/add_bioc_devel_env_variables.sh

# 4. Install conda
RUN bash /tmp/bioc_scripts/install-conda.sh
ENV PATH="/opt/conda/bin:${PATH}"

# Add Env variables for specific packages
ENV LIBSBML_CFLAGS="-I/usr/include"
ENV LIBSBML_LIBS="-lsbml"
ENV BIOCONDUCTOR_DOCKER_VERSION=$BIOCONDUCTOR_DOCKER_VERSION
ENV BIOCONDUCTOR_VERSION=$BIOCONDUCTOR_VERSION

# Init command for s6-overlay
CMD ["/init"]