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

Add Docker support #29

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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 Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
ARG MAMBA_VERSION=1.5.8
FROM mambaorg/micromamba:${MAMBA_VERSION}-noble AS base

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

WORKDIR /cadet

USER root

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get -y install build-essential cmake libhdf5-dev libsuperlu-dev intel-mkl git git-lfs libeigen3-dev && \
apt-get clean

RUN git clone https://github.com/cadet/CADET-core CADET

#RUN git checkout

RUN mkdir -p CADET/build

WORKDIR CADET/build

SHELL ["/bin/bash", "-c"]

ENV MKLROOT=/opt/intel/mkl

RUN cmake -DCMAKE_INSTALL_PREFIX="../install" -DBLA_VENDOR=Intel10_64lp_seq ../

RUN make -j $(lscpu | grep 'CPU(s)' | head -n 1 | cut -d ':' -f2 | tr -d ' ') install

USER $MAMBA_USER

WORKDIR /tmp

RUN /cadet/CADET/install/bin/cadet-cli --version
RUN /cadet/CADET/install/bin/createLWE -o LWE.h5
RUN /cadet/CADET/install/bin/cadet-cli LWE.h5

# This is the default CADET-RDM Dockerfile content
COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /tmp/environment.yml

RUN micromamba install -y -n base -f /tmp/environment.yml && \
micromamba clean --all --yes

RUN git config --global --add safe.directory /workingdir && \
git config --global --add safe.directory /workingdir/output && \
git config --global user.name "IBG_RDM_DOCKER_USER" && \
git config --global user.email "[email protected]"

RUN git clone https://github.com/cadet/CADET-Verification.git /tmp/CADET-Verification
WORKDIR CADET-Verification
# Use filtter=blob:none to reduce the amount of data transfered.
RUN git clone --filter=blob:none https://github.com/cadet/CADET-Verification-Output.git /tmp/CADET-Verification/output
RUN git checkout feature/add_docker_support
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,26 @@ The results of the verification studies can be accessed in the [CADET-Verificati

CADET-Verification must be run for deployment and on demand, specifically when critical changes are made to the simulator.

To track results: clone with `rdm clone` instead of `git clone`

The tests are located in the `src` folder.
The main script is called `verify_cadet-core`, please refer to the documentation therein for further instruction.

The reference data used in some of the tests implemented in CADET-Core can be generated using the corresponding tests defined in CADET-Verification.

To run in a Docker container:
```bash
# 1. if necessary make changes in the Dockerfile
docker build -t cadet-verification . # build Docker container
docker run -v $(pwd):/workingdir -w /workingdir cadet-verification python src/test_cadet_core/verify_cadet-core.py
```


## Contributing

We welcome and appreciate all contributions!

If you are a CADET-Core developer adding a new feature, you must also include an appropriate set of verification tests or case studies in this repository.
This ensures that your contribution meets the quality standards and helps maintain the long-term reliability and maintainability of the project.

Furthermore, contributions aimed at improving or extending the evaluation functions are highly encouraged.
Furthermore, contributions aimed at improving or extending the evaluation functions are highly encouraged.
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.12
- cadet
- cadet==5.0.3
- pip
- pip:
- scipy
Expand All @@ -13,5 +13,5 @@ dependencies:
- pandas
- h5py
- joblib
- cadet-python
- cadet-python==1.0.4
- cadet-rdm
8 changes: 4 additions & 4 deletions src/test_cadet_core/verify_cadet-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@

rdm_debug_mode = False # Run CADET-RDM in debug mode to test if the script works

small_test = False # Defines a smaller test set (less numerical refinement steps)
small_test = True # Defines a smaller test set (less numerical refinement steps)

n_jobs = -1 # For parallelization on the number of simulations

delete_h5_files = True # delete h5 files (but keep convergence tables and plots)
exclude_files = None # ["file1", "file2"] # specify h5 files that should not be deleted

run_chromatography_tests = True
run_crystallization_tests = True
run_MCT_tests = True
run_crystallization_tests = False
run_MCT_tests = False

database_path = "https://jugit.fz-juelich.de/IBG-1/ModSim/cadet/cadet-database" + \
"/-/raw/core_tests/cadet_config/test_cadet-core/"
Expand All @@ -66,7 +66,7 @@
if run_chromatography_tests:
chromatography.chromatography_tests(
n_jobs=n_jobs, database_path=database_path+"chromatography/",
small_test=small_test, sensitivities=True,
small_test=small_test, sensitivities=False,
output_path=str(output_path) + "/chromatography", cadet_path=cadet_path
)

Expand Down