From ce88de4011ba3e17c3d4c810aa188a629b3802fa Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Tue, 17 Sep 2024 14:17:51 +0100 Subject: [PATCH 1/8] Add dependencies and env variable --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 143032e..67acda4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,6 +58,13 @@ RUN wget -O /usr/share/keyrings/chaste.asc https://chaste.github.io/chaste.asc \ RUN apt-get update && \ apt-get install -y --no-install-recommends \ chaste-dependencies \ + xvfb \ + python3-matplotlib \ + python3-notebook \ + python3-numpy \ + python3-petsc4py \ + python3-vtk7 \ + python3-xvfbwrapper \ cmake \ clang \ lldb \ @@ -93,6 +100,7 @@ ARG CHASTE_DIR="/home/${USER}" ARG CMAKE_BUILD_TYPE="Debug" ARG Chaste_ERROR_ON_WARNING="ON" ARG Chaste_UPDATE_PROVENANCE="OFF" +ARG Chaste_ENABLE_PYCHASTE="ON" # RUN source /home/chaste/scripts/set_env_vars.sh ENV USER=${USER} \ GROUP=${USER} \ @@ -101,6 +109,7 @@ ENV USER=${USER} \ CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ Chaste_ERROR_ON_WARNING=${Chaste_ERROR_ON_WARNING} \ Chaste_UPDATE_PROVENANCE=${Chaste_UPDATE_PROVENANCE} \ + Chaste_ENABLE_PYCHASTE=${Chaste_ENABLE_PYCHASTE} \ CHASTE_SOURCE_DIR="${CHASTE_DIR}/src" \ CHASTE_BUILD_DIR="${CHASTE_DIR}/build" \ CHASTE_TEST_OUTPUT="${CHASTE_DIR}/output" \ From 4f58b93bb50a8f7bae69c810575d85998de9cc80 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Tue, 17 Sep 2024 14:18:27 +0100 Subject: [PATCH 2/8] Add variables to makefile --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index cb942db..62710be 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,7 @@ develop main release: BUILD_ARGS += --build-arg GIT_TAG=$(GIT_TAG) \ --build-arg CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \ --build-arg Chaste_ERROR_ON_WARNING=$(Chaste_ERROR_ON_WARNING) \ --build-arg Chaste_UPDATE_PROVENANCE=$(Chaste_UPDATE_PROVENANCE) \ + --build-arg Chaste_ENABLE_PYCHASTE=${Chaste_ENABLE_PYCHASTE} \ --build-arg TEST_SUITE=$(TEST_SUITE) develop main: CMAKE_BUILD_TYPE="Debug" @@ -76,6 +77,7 @@ release: Chaste_ERROR_ON_WARNING="OFF" release: Chaste_UPDATE_PROVENANCE="ON" release: TEST_SUITE="Continuous" +develop main release: Chaste_ENABLE_PYCHASTE="ON" base develop main release: CHASTE_IMAGE = chaste/$@ base develop main release: DOCKER_TAGS = -t $(CHASTE_IMAGE) base develop main: DOCKER_TAGS += -t $(CHASTE_IMAGE):$(BASE) From a2f00b3c1f6aaa3c958a066908e92ffd5ff184a7 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Tue, 17 Sep 2024 14:18:44 +0100 Subject: [PATCH 3/8] Attempt at build commands --- scripts/build_chaste.sh | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/scripts/build_chaste.sh b/scripts/build_chaste.sh index 0f90ca8..c376b0c 100755 --- a/scripts/build_chaste.sh +++ b/scripts/build_chaste.sh @@ -42,14 +42,43 @@ else # if [ $VERSION = 'develop' ]; then echo "Chaste_ERROR_ON_WARNING=${Chaste_ERROR_ON_WARNING}" fi -# Only run if new files have been created -cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ +# # Only run if new files have been created +# cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ +# -DChaste_ERROR_ON_WARNING:BOOL=${Chaste_ERROR_ON_WARNING} \ +# -DChaste_UPDATE_PROVENANCE:BOOL=${Chaste_UPDATE_PROVENANCE} \ +# -DChaste_ENABLE_PYCHASTE:BOOL=${Chaste_ENABLE_PYCHASTE} \ +# -H$CHASTE_SOURCE_DIR \ +# -B$CHASTE_BUILD_DIR + +# make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile + +if [ "$Chaste_ENABLE_PYCHASTE" = "ON" ]; then + # Build and install PyChaste + git clone --recursive https://github.com/Chaste/PyChaste.git "${CHASTE_PROJECTS_DIR}/PyChaste" + + # Only run if new files have been created + cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ -DChaste_ERROR_ON_WARNING:BOOL=${Chaste_ERROR_ON_WARNING} \ -DChaste_UPDATE_PROVENANCE:BOOL=${Chaste_UPDATE_PROVENANCE} \ + -DChaste_ENABLE_PYCHASTE:BOOL=${Chaste_ENABLE_PYCHASTE} \ -H$CHASTE_SOURCE_DIR \ -B$CHASTE_BUILD_DIR -make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile + echo "Building PyChaste..." + # make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR + make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR pychaste + python -m pip install --no-cache-dir --user $CHASTE_BUILD_DIR/pychaste/package +else + echo "PyChaste is not enabled." + # Only run if new files have been created + cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ + -DChaste_ERROR_ON_WARNING:BOOL=${Chaste_ERROR_ON_WARNING} \ + -DChaste_UPDATE_PROVENANCE:BOOL=${Chaste_UPDATE_PROVENANCE} \ + -DChaste_ENABLE_PYCHASTE:BOOL=${Chaste_ENABLE_PYCHASTE} \ + -H$CHASTE_SOURCE_DIR \ + -B$CHASTE_BUILD_DIR + make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile +fi # Save the build info get_chaste_info.sh > "${CHASTE_TEST_OUTPUT}/chaste-info.txt" From 0f5696ebb3acbf50a11ee9e076519a2945d75f98 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Tue, 17 Sep 2024 15:09:14 +0100 Subject: [PATCH 4/8] Only set GIT_TAG for develop and main if not passed --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 62710be..55d6194 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ develop main release: BUILD_ARGS += --build-arg GIT_TAG=$(GIT_TAG) \ develop main: CMAKE_BUILD_TYPE="Debug" develop main: Chaste_ERROR_ON_WARNING="ON" develop main: Chaste_UPDATE_PROVENANCE="OFF" -develop main: GIT_TAG=$@ +develop main: GIT_TAG?=$@ release: CMAKE_BUILD_TYPE="Release" release: Chaste_ERROR_ON_WARNING="OFF" From 72bc929658fad3b282502655b9a433e899811e62 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Wed, 18 Sep 2024 12:58:41 +0100 Subject: [PATCH 5/8] Tidy up --- scripts/build_chaste.sh | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/scripts/build_chaste.sh b/scripts/build_chaste.sh index c376b0c..253b379 100755 --- a/scripts/build_chaste.sh +++ b/scripts/build_chaste.sh @@ -43,40 +43,24 @@ else # if [ $VERSION = 'develop' ]; then fi # # Only run if new files have been created -# cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ -# -DChaste_ERROR_ON_WARNING:BOOL=${Chaste_ERROR_ON_WARNING} \ -# -DChaste_UPDATE_PROVENANCE:BOOL=${Chaste_UPDATE_PROVENANCE} \ -# -DChaste_ENABLE_PYCHASTE:BOOL=${Chaste_ENABLE_PYCHASTE} \ -# -H$CHASTE_SOURCE_DIR \ -# -B$CHASTE_BUILD_DIR - -# make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile - -if [ "$Chaste_ENABLE_PYCHASTE" = "ON" ]; then - # Build and install PyChaste - git clone --recursive https://github.com/Chaste/PyChaste.git "${CHASTE_PROJECTS_DIR}/PyChaste" - - # Only run if new files have been created - cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ +cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ -DChaste_ERROR_ON_WARNING:BOOL=${Chaste_ERROR_ON_WARNING} \ -DChaste_UPDATE_PROVENANCE:BOOL=${Chaste_UPDATE_PROVENANCE} \ -DChaste_ENABLE_PYCHASTE:BOOL=${Chaste_ENABLE_PYCHASTE} \ -H$CHASTE_SOURCE_DIR \ -B$CHASTE_BUILD_DIR +# make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile + +if [ "$Chaste_ENABLE_PYCHASTE" = "ON" ]; then + # Build and install PyChaste + echo "Building PyChaste..." # make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR pychaste python -m pip install --no-cache-dir --user $CHASTE_BUILD_DIR/pychaste/package else echo "PyChaste is not enabled." - # Only run if new files have been created - cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ - -DChaste_ERROR_ON_WARNING:BOOL=${Chaste_ERROR_ON_WARNING} \ - -DChaste_UPDATE_PROVENANCE:BOOL=${Chaste_UPDATE_PROVENANCE} \ - -DChaste_ENABLE_PYCHASTE:BOOL=${Chaste_ENABLE_PYCHASTE} \ - -H$CHASTE_SOURCE_DIR \ - -B$CHASTE_BUILD_DIR make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile fi From 9ce0a503fc275f88c881909d0c264080e3a46dcd Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Fri, 20 Sep 2024 15:29:49 +0100 Subject: [PATCH 6/8] Install python packages with pip --- Dockerfile | 10 +++++----- scripts/build_chaste.sh | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 67acda4..2c8dcf4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,12 +59,12 @@ RUN apt-get update && \ apt-get install -y --no-install-recommends \ chaste-dependencies \ xvfb \ - python3-matplotlib \ - python3-notebook \ - python3-numpy \ - python3-petsc4py \ + # python3-matplotlib \ + # python3-notebook \ + # python3-numpy \ + # python3-petsc4py \ python3-vtk7 \ - python3-xvfbwrapper \ + # python3-xvfbwrapper \ cmake \ clang \ lldb \ diff --git a/scripts/build_chaste.sh b/scripts/build_chaste.sh index 253b379..cb2721d 100755 --- a/scripts/build_chaste.sh +++ b/scripts/build_chaste.sh @@ -58,7 +58,10 @@ if [ "$Chaste_ENABLE_PYCHASTE" = "ON" ]; then echo "Building PyChaste..." # make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR pychaste - python -m pip install --no-cache-dir --user $CHASTE_BUILD_DIR/pychaste/package + python -m pip install --no-cache-dir --user numpy matplotlib petsc4py jupyterlab xvfbwrapper + # python -m pip install --no-cache-dir --user --no-deps pychaste/package + python -m pip install --no-cache-dir --user --no-deps $CHASTE_BUILD_DIR/pychaste/package + else echo "PyChaste is not enabled." make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile From 3df46381b61710c3d87e9922d446d76865786583 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Thu, 3 Oct 2024 18:09:59 +0100 Subject: [PATCH 7/8] Add test instructions --- scripts/build_chaste.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build_chaste.sh b/scripts/build_chaste.sh index cb2721d..dd63c27 100755 --- a/scripts/build_chaste.sh +++ b/scripts/build_chaste.sh @@ -54,7 +54,6 @@ cmake -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \ if [ "$Chaste_ENABLE_PYCHASTE" = "ON" ]; then # Build and install PyChaste - echo "Building PyChaste..." # make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR pychaste @@ -62,6 +61,8 @@ if [ "$Chaste_ENABLE_PYCHASTE" = "ON" ]; then # python -m pip install --no-cache-dir --user --no-deps pychaste/package python -m pip install --no-cache-dir --user --no-deps $CHASTE_BUILD_DIR/pychaste/package + # Test PyChaste + # xvfb-run --server-args="-screen 0 1024x768x24" ctest -L pychaste else echo "PyChaste is not enabled." make --no-print-directory -j$NCORES -C $CHASTE_BUILD_DIR # -f $CHASTE_BUILD_DIR/Makefile From 5262a16a1e6ed410370e595210feabc7e3877207 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Thu, 3 Oct 2024 18:10:29 +0100 Subject: [PATCH 8/8] Fix test? --- scripts/get_chaste_info.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/get_chaste_info.sh b/scripts/get_chaste_info.sh index c7369d4..0572af2 100755 --- a/scripts/get_chaste_info.sh +++ b/scripts/get_chaste_info.sh @@ -1,4 +1,7 @@ #!/bin/bash set -e +cmake -H$CHASTE_SOURCE_DIR -B$CHASTE_BUILD_DIR +make --no-print-directory -j$(nproc) -C $CHASTE_BUILD_DIR $TEST_SUITE +#-j$(nproc) ( cd $CHASTE_BUILD_DIR && ctest --verbose -R TestChasteBuildInfo$ )