From 88541fed5c3ffcd46430e4f460e8fe8747651739 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Wed, 13 Nov 2024 16:28:13 -0800 Subject: [PATCH 01/15] Use latest ubuntu. --- .github/workflows/dockerbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerbuild.yml b/.github/workflows/dockerbuild.yml index eeb85f2..659738d 100644 --- a/.github/workflows/dockerbuild.yml +++ b/.github/workflows/dockerbuild.yml @@ -10,7 +10,7 @@ on: jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: Maximize build space uses: easimon/maximize-build-space@master From 2f50da47f5484490727a28f399418642eb881d6f Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 15:15:51 -0800 Subject: [PATCH 02/15] Execute on PR and push. --- .github/workflows/dockerbuild.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/dockerbuild.yml b/.github/workflows/dockerbuild.yml index 659738d..63e6014 100644 --- a/.github/workflows/dockerbuild.yml +++ b/.github/workflows/dockerbuild.yml @@ -1,12 +1,6 @@ name: Build and Push Docker Image -on: - push: - branches: - - 'master' - pull_request: - branches: - - main +on: [push, pull_request] jobs: build: From 43b61a411d5292038f68e4de9278a294a6a44faf Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 15:19:17 -0800 Subject: [PATCH 03/15] Skip space-minimizing step. --- .github/workflows/dockerbuild.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/dockerbuild.yml b/.github/workflows/dockerbuild.yml index 63e6014..d179ad1 100644 --- a/.github/workflows/dockerbuild.yml +++ b/.github/workflows/dockerbuild.yml @@ -6,14 +6,6 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - root-reserve-mb: 32768 - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - - name: Checkout repo uses: actions/checkout@v2 From 8f5e6c2fda34242fd63a2f4e3428fae19ad8e3af Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 15:25:00 -0800 Subject: [PATCH 04/15] For now, just build. I'll put back the pushing once I get this to work. --- .github/workflows/dockerbuild.yml | 10 ++-------- docker/dockerbuild.sh | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dockerbuild.yml b/.github/workflows/dockerbuild.yml index d179ad1..0dedc77 100644 --- a/.github/workflows/dockerbuild.yml +++ b/.github/workflows/dockerbuild.yml @@ -15,14 +15,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Login to GHCR - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: dipy - password: ${{secrets.CR_PAT}} - - - name: Build and push docker image + - name: Build docker image run: sh ./Docker/dockerbuild.sh \ "${{github.sha}}" \ "dipy" + diff --git a/docker/dockerbuild.sh b/docker/dockerbuild.sh index c303a87..953d1c0 100644 --- a/docker/dockerbuild.sh +++ b/docker/dockerbuild.sh @@ -10,4 +10,3 @@ NO_TAG="$(echo "${NO_TAG}" | tr -d '[:space:]')" echo $TAG docker build --no-cache -t $TAG -t $TAG2 --build-arg COMMIT ./docker -docker push --all-tags $NO_TAG From 561f2abbaf49185f99e30a8733f5335c785d2c87 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 16:38:05 -0800 Subject: [PATCH 05/15] Fixes typo. --- .github/workflows/dockerbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerbuild.yml b/.github/workflows/dockerbuild.yml index 0dedc77..e14c657 100644 --- a/.github/workflows/dockerbuild.yml +++ b/.github/workflows/dockerbuild.yml @@ -16,7 +16,7 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Build docker image - run: sh ./Docker/dockerbuild.sh \ + run: sh ./docker/dockerbuild.sh \ "${{github.sha}}" \ "dipy" From cb65350c22d6a8f4c003c4fd0c9aaeb99c2f911e Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 16:48:13 -0800 Subject: [PATCH 06/15] Docker repository name has to be all lower-case. --- docker/dockerbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/dockerbuild.sh b/docker/dockerbuild.sh index 953d1c0..a588ee4 100644 --- a/docker/dockerbuild.sh +++ b/docker/dockerbuild.sh @@ -1,7 +1,7 @@ COMMIT=${1} COMMIT="$(echo "${COMMIT}" | tr -d '[:space:]')" export COMMIT -NO_TAG="ghcr.io/${2}/GPUStreamlines" +NO_TAG="ghcr.io/${2}/gpustreamlines" TAG="${NO_TAG}:${COMMIT}" TAG2="${NO_TAG}:latest" TAG="$(echo "${TAG}" | tr -d '[:space:]')" From 0286508f5765365420bf65f973e6533950edf640 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 16:51:07 -0800 Subject: [PATCH 07/15] Refer to the correct FROM image. --- docker/Dockerfile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 9ed425d..00b30f1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,18 +1,12 @@ -FROM nvcr.io/nvidia/cuda:11.0-devel +ARG NVIDIAVERSION=12.0.1-devel-ubuntu20.04 +FROM nvidia/cuda:${NVIDIAVERSION} SHELL ["/bin/bash", "-c"] ENV DEBIAN_FRONTEND=noninteractive -# upgrade -RUN apt update && \ - apt install --assume-yes apt-transport-https \ - ca-certificates gnupg \ - software-properties-common gcc git wget numactl -RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \ - | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null -RUN apt-add-repository "deb https://apt.kitware.com/ubuntu/ focal main" -RUN apt install -y cmake libncurses5-dev libtinfo6 +RUN apt-get update && apt-get install --assume-yes apt-transport-https \ + ca-certificates gnupg software-properties-common gcc git wget numactl cmake # Anaconda RUN cd /opt && wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh \ From 6eea6e86678e83c4d294151152a219ba264f60ce Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 16:57:54 -0800 Subject: [PATCH 08/15] Build/install the thing with pip. --- docker/Dockerfile | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 00b30f1..5a3c94a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,11 +8,10 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install --assume-yes apt-transport-https \ ca-certificates gnupg software-properties-common gcc git wget numactl cmake -# Anaconda -RUN cd /opt && wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh \ - && bash /tmp/Anaconda3-2020.02-Linux-x86_64.sh -b -p /opt/anaconda \ - && rm -rf /tmp/Anaconda3-2020.02-Linux-x86_64.sh \ - && eval "$(/opt/anaconda/bin/conda shell.bash hook)" +RUN wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh +RUN bash /tmp/Anaconda3-2022.10-Linux-x86_64.sh -b -p /opt/anaconda +RUN rm -rf /tmp/Anaconda3-2022.10-Linux-x86_64.sh +RUN cd /opt && eval "$(/opt/anaconda/bin/conda shell.bash hook)" ENV PATH /opt/anaconda/bin:${PATH} ENV LD_LIBRARY_PATH /opt/anaconda/lib:${LD_LIBRARY_PATH} @@ -20,15 +19,8 @@ ENV LD_LIBRARY_PATH /opt/anaconda/lib:${LD_LIBRARY_PATH} RUN pip install numpy scipy cython nibabel dipy tqdm # copy stuff -COPY CMakeLists.txt /opt/GPUStreamlines/CMakeLists.txt -COPY run_dipy_gpu.py /opt/GPUStreamlines/run_dipy_gpu.py -COPY run_dipy_cpu.py /opt/GPUStreamlines/run_dipy_cpu.py -COPY run_dipy_gpu_hardi.py /opt/GPUStreamlines/run_dipy_gpu_hardi.py -COPY run_dipy_cpu_hardi.py /opt/GPUStreamlines/run_dipy_cpu_hardi.py -COPY merge_trk.sh /opt/exec/merge_trk.sh -COPY cuslines /opt/GPUStreamlines/cuslines -COPY external /opt/GPUStreamlines/external -RUN mkdir -p /opt/exec/output +COPY . /opt/GPUStreamlines +RUN /opt/GPUStreamlines && pip install . # compile RUN cd /opt/GPUStreamlines && mkdir build && cd build \ From 0547ee96138f7f40bd1c6810b7f04564b06576f9 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 17:02:46 -0800 Subject: [PATCH 09/15] Change into this directory. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 5a3c94a..7dc5cb1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,7 +20,7 @@ RUN pip install numpy scipy cython nibabel dipy tqdm # copy stuff COPY . /opt/GPUStreamlines -RUN /opt/GPUStreamlines && pip install . +RUN cd /opt/GPUStreamlines && pip install . # compile RUN cd /opt/GPUStreamlines && mkdir build && cd build \ From d6148aa850f9b5619438bb6672d0e141776549b3 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 17:08:47 -0800 Subject: [PATCH 10/15] Copy everything. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7dc5cb1..611ba9b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,7 +19,7 @@ ENV LD_LIBRARY_PATH /opt/anaconda/lib:${LD_LIBRARY_PATH} RUN pip install numpy scipy cython nibabel dipy tqdm # copy stuff -COPY . /opt/GPUStreamlines +COPY * /opt/GPUStreamlines/ RUN cd /opt/GPUStreamlines && pip install . # compile From 3a6d22517621183c8fb2bda71be32193c6f2191e Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 17:09:38 -0800 Subject: [PATCH 11/15] Possibly even simpler. --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 611ba9b..f01bfa6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,8 +19,8 @@ ENV LD_LIBRARY_PATH /opt/anaconda/lib:${LD_LIBRARY_PATH} RUN pip install numpy scipy cython nibabel dipy tqdm # copy stuff -COPY * /opt/GPUStreamlines/ -RUN cd /opt/GPUStreamlines && pip install . +COPY . . +RUN pip install . # compile RUN cd /opt/GPUStreamlines && mkdir build && cd build \ From df68f2758d2fe3439c3a28edf5fd9267a6d4713b Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 17:14:28 -0800 Subject: [PATCH 12/15] Maybe I am trying to get a path relative to the Dockerfile. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f01bfa6..339872e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,7 +19,7 @@ ENV LD_LIBRARY_PATH /opt/anaconda/lib:${LD_LIBRARY_PATH} RUN pip install numpy scipy cython nibabel dipy tqdm # copy stuff -COPY . . +COPY .. . RUN pip install . # compile From dd2ecb2da9634ce9599ffa7595122624913297ce Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 17:21:48 -0800 Subject: [PATCH 13/15] Maybe we use the shell script to get this commit. --- docker/Dockerfile | 5 ++--- docker/dockerbuild.sh | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 339872e..ce7f91b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,9 +18,8 @@ ENV LD_LIBRARY_PATH /opt/anaconda/lib:${LD_LIBRARY_PATH} # python prereqs RUN pip install numpy scipy cython nibabel dipy tqdm -# copy stuff -COPY .. . -RUN pip install . +COPY GPUStreamlines /opt/GPUStreamlines +RUN cd /opt/GPUStreamlines && pip install . # compile RUN cd /opt/GPUStreamlines && mkdir build && cd build \ diff --git a/docker/dockerbuild.sh b/docker/dockerbuild.sh index a588ee4..d6de508 100644 --- a/docker/dockerbuild.sh +++ b/docker/dockerbuild.sh @@ -8,5 +8,10 @@ TAG="$(echo "${TAG}" | tr -d '[:space:]')" TAG2="$(echo "${TAG2}" | tr -d '[:space:]')" NO_TAG="$(echo "${NO_TAG}" | tr -d '[:space:]')" +git clone https://github.com/dipy/GPUStreamlines.git +cd GPUStreamlines +git checkout $COMMIT +cd .. + echo $TAG docker build --no-cache -t $TAG -t $TAG2 --build-arg COMMIT ./docker From 15226cb63d0598183a555dc9ad1790dfe93c5ad1 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 20:59:37 -0800 Subject: [PATCH 14/15] Getting this particular commit may prove tricky. It looks like we might need to know where it comes from more precisely. --- docker/Dockerfile | 4 ++-- docker/dockerbuild.sh | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ce7f91b..f5f9d37 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,8 +18,8 @@ ENV LD_LIBRARY_PATH /opt/anaconda/lib:${LD_LIBRARY_PATH} # python prereqs RUN pip install numpy scipy cython nibabel dipy tqdm -COPY GPUStreamlines /opt/GPUStreamlines -RUN cd /opt/GPUStreamlines && pip install . +RUN git clone https://github.com/dipy/GPUStreamlines.git +RUN cd GPUStreamlines && pip install . # compile RUN cd /opt/GPUStreamlines && mkdir build && cd build \ diff --git a/docker/dockerbuild.sh b/docker/dockerbuild.sh index d6de508..a588ee4 100644 --- a/docker/dockerbuild.sh +++ b/docker/dockerbuild.sh @@ -8,10 +8,5 @@ TAG="$(echo "${TAG}" | tr -d '[:space:]')" TAG2="$(echo "${TAG2}" | tr -d '[:space:]')" NO_TAG="$(echo "${NO_TAG}" | tr -d '[:space:]')" -git clone https://github.com/dipy/GPUStreamlines.git -cd GPUStreamlines -git checkout $COMMIT -cd .. - echo $TAG docker build --no-cache -t $TAG -t $TAG2 --build-arg COMMIT ./docker From 0196cceddf6677d7d2dd9071f22636f0a1ee0426 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 14 Nov 2024 21:06:12 -0800 Subject: [PATCH 15/15] Need to get the pybind11 submodule. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f5f9d37..5fa7a98 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,7 +18,7 @@ ENV LD_LIBRARY_PATH /opt/anaconda/lib:${LD_LIBRARY_PATH} # python prereqs RUN pip install numpy scipy cython nibabel dipy tqdm -RUN git clone https://github.com/dipy/GPUStreamlines.git +RUN git clone --recurse-submodules https://github.com/dipy/GPUStreamlines.git RUN cd GPUStreamlines && pip install . # compile