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

[WIP] Merge PyChaste #22

Draft
wants to merge 8 commits into
base: master
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
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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} \
Expand All @@ -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" \
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,20 @@ 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"
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"
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)
Expand Down
21 changes: 19 additions & 2 deletions scripts/build_chaste.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,31 @@ else # if [ $VERSION = 'develop' ]; then
echo "Chaste_ERROR_ON_WARNING=${Chaste_ERROR_ON_WARNING}"
fi

# Only run if new files have been created
# # 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
# 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 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

# 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
fi

# Save the build info
get_chaste_info.sh > "${CHASTE_TEST_OUTPUT}/chaste-info.txt"
Expand Down
3 changes: 3 additions & 0 deletions scripts/get_chaste_info.sh
Original file line number Diff line number Diff line change
@@ -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$ )