Ubuntu image with pre-installed SPHinXsys
120
Disclaimer: tested only on Ubuntu 22.04
docker pull toshev/sphinxsys:20240521
docker run -itd --name my_container toshev/sphinxsys:20240521
docker attach my_container
cd $HOME/sphinxsys/build/tests/2d_examples/test_2d_dambreak/bin/
# run the binary
./test_2d_dambreak
# The above will use all CPUs. Specify e.g. threads 0-15 as:
taskset -c 0-15 ./test_2d_dambreak
If you want to access the simulation results directly on the host machine, you should mount a shared directory/volume when creating the container.
docker run -itd -v /tmp/sphinxsys_volume:/sphinxsys_volume --name my_container toshev/sphinxsys:20240521
Now you would need to change the directory where the simulation results are written. This is specified by output_folder_. For an example on how to overwrite this variable see: https://github.com/arturtoshev/SPHinXsys/blob/dbds/tests/3d_examples/test_3d_dambreak/dambreak.cpp. This is a minimal example:
docker attach my_container
cd $HOME/sphinxsys
# On the 2d dam break example, after line `sph_system.handleCommandlineOptions(ac, av)->setIOEnvironment();` add `sph_system.getIOEnvironment().output_folder_ = "/sphinxsys_volume";`
vim tests/2d_examples/test_2d_dambreak/Dambreak.cpp
# rebuild modified case
cmake --build build/
./build/tests/2d_examples/test_2d_dambreak/bin/test_2d_dambreak
If you want to start a bigger run, you might want to detach it from the terminal.
# run script without entering the container
docker exec my_container taskset -c 0-15 /root/sphinxsys/build/tests/2d_examples/test_2d_dambreak/bin/test_2d_dambreak
# run script without entering the container in detached mode
nohup docker exec my_container taskset -c 0-15 /root/sphinxsys/build/tests/2d_examples/test_2d_dambreak/bin/test_2d_dambreak >> nohup.out 2>&1 &
The image is based on the SPHinXsys library and its dependencies as of 21.05.2024. The steps to reproduce the image are given in the following
# set up docker
docker pull ubuntu
docker run -itd --name sphinxsys ubuntu
# remove with `docker stop sphinxsys` and then `docker rm sphinxsys`
# enter container
docker attach sphinxsys
# detach with Ctrl + p then Ctrl + q
docker attach sphinxsys
# dependencies
export TZ=Europe/Berlin
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
apt update && apt upgrade
apt install -y apt-utils build-essential curl zip unzip tar pkg-config git cmake ccache python3-dev gfortran autoconf automake autoconf-archive
cd $HOME
git clone https://www.github.com/microsoft/vcpkg
# version on 21.05.2024: 261dd6831673d3b07e5118261f7e161a21d1a759
cd vcpkg
./bootstrap-vcpkg.sh
# the following line takes 10min
./vcpkg install --clean-after-build eigen3 tbb boost-program-options boost-geometry simbody gtest pybind11
# install sphinxsys
cd $HOME
git clone https://github.com/Xiangyu-Hu/SPHinXsys sphinxsys
# version on 21.05.2024: d7c33a4ab0bd9e135dc22a3c4cf1bfe048b8ff16
cd sphinxsys
# comment out the line with Werror - to aviod an error
sed -i 's/\(target_compile_options(sphinxsys_core INTERFACE \$<\$<BOOL:${SPHINXSYS_DEVELOPER_MODE}>:-Werror>\)/# \1/' CMakeListst.txt
# add `#include <cstdint>` after line 30 - to aviod error
sed -i '30a #include <cstdint>' tests/3d_examples/test_3d_heart_volume_change/TriangleMeshDistance.h
cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ -D CMAKE_TOOLCHAIN_FILE="$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake" -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -S . -B ./build
# the following line takes 90min
cmake --build build/
# log in to docker hub
docker login -u toshev
# create an image from the container and push it to Docker Hub
docker commit sphinxsys toshev/sphinxsys:20240521
docker push toshev/sphinxsys:20240521
Content type
Image
Digest
sha256:6aca7ae32…
Size
1.5 GB
Last updated
over 2 years ago
docker pull toshev/sphinxsys:20240521