- Install Docker Desktop link and follow the instruction for your OS. To check that the installation is working try to run sudo docker run hello-world
- Manage Docker as a non-root user link NOTE: if you are on Windows this means opening the terminal with Admin privileges (with right click)
- Install VS Code link
- Clone the repository git clone git@github.com:vulpeslib/vulpes.git --recursive NOTE: if you are on Windows, it is much faster to clone in a folder that is owned by the WSL. That is, opening the terminal on WSL and cloning in a directory that is NOT under /mnt
- Open the repository in VSCode
- Install the "Docker" and "Dev Container" extension in VS Code (Open the extension panel with Ctrl+Shift+X)
- Should be promped to enter the .devcontaier when opening the vulpes folder. We you agree the first time VSCode will start building the Docker container automatically. It will take a few minutes.
Every time you install a kernel update you may need to restart your pc to use this setup.
MacOS users with M1/M2 chips
Move inside the directory and open the devcontainer.json file located under the hidden .devcontainer folder. Substitute the content of the file with the following:
json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Vulpes Environment",
"build": {
"dockerfile": "Dockerfile",
"options": ["--platform=linux/amd64"]
},
"runArgs": ["--platform=linux/amd64"],
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools-themes",
"twxs.cmake",
"ms-vscode.cmake-tools",
"cheshirekow.cmake-format",
"foxundermoon.shell-format"
]
}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "gcc -v",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
Save and close the file.
Build Image Open VScode and select the option "Reopen in container".
Proceed with the instructions in the main documentation to complete the setup and start using Vulpes.
VSCode extensions
Relevant VSCode extensions in the remote container should be automatically installed.
In settings (File > Preferences > Settings) search "Clang_format_style" and set file:/workspaces/vulpes/.clang-format. Then you can format with Ctrl+Shift+I.
Use the Docker from VSCode
- To create a new terminal from VS Code use Ctrl+Shift+P and select Terminal: Create New Terminal
- To enter the docker from a generic terminal, find the name of the container using docker ps -a (the image name should be something similar to vsc-vulpes-<hash>), then use docker exec -it <docker container name> /bin/bash to open the container in interactive mode
Simple firsts steps
If you want to jump directly into the code your first step can be something like
mkdir build
cmake .. -DCMAKE_BUILD_TYPE=<Release>
make -j<n_jobs>
To test the code
To check the failure of a test, you can run the single executable in the tests folder.
Installation of Vulpes on Cluster - Apptainer Image
1. Install Vulpes on cluster
Clone the library from github and install all the third party libraries.
git clone git@github.com:vulpeslib/vulpes.git --recursive
cd vulpes
2. Setup Apptainer on cluster:
You can use either the system-installed Apptainer (recommended) or install a local version.
Using system-installed Apptainer (recommended)
In order to use the local installation, you just need to run:
/opt/mox/apptainer/bin/apptainer <commands>
Installing a local version
In order to setup you local installation, run the following commands
cd
mkdir opt
mkdir opt/apptainer
curl -s https://raw.githubusercontent.com/apptainer/apptainer/main/tools/install-unprivileged.sh | \ bash -s - ~/opt/apptainer
With this command you install a local version of Apptainer, you can use the Apptainer commands by running:
/opt/apptainer/bin/apptainer <command>
See Apptainer User Guide for full documentation.
3. Create the Apptainer definition file
Navigate to the repository and create the folder for the definition file:
mkdir .apptainer
cd .apptainer
Create the a file called vulpes.def
and paste the following code:
Bootstrap: docker
From: ubuntu:26.04
%post
apt-get update && apt-get upgrade -y
apt-get install -y build-essential python3-pip wget cmake git lcov
apt-get install -y clang-tidy-18 clang-format-18
apt-get install -y openmpi-bin libopenmpi-dev libopenblas-dev
apt-get install -y libhypre-dev petsc-dev
apt-get install -y libgmp-dev
apt-get install -y libscotchparmetis-dev
apt-get install -y vtk9 libvtk9-dev
apt-get install -y libboost-dev libboost-serialization-dev
apt-get install -y cppcheck
apt-get install -y doxygen pdf2svg graphviz
apt-get install -y xsltproc
apt-get install -y shfmt
rm -rf /var/lib/apt/lists/*
# pip
pip3 install cmakelang --break-system-packages
%environment
export PATH=/usr/local/bin:$PATH
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
%labels
Author "Nicola De March"
Description "Container Apptainer equivalent to Dockerfile"
%help
This container
4. Build the image
/opt/mox/apptainer/bin/apptainer build vulpes_apptainer.sif vulpes.def
This creates vulpes_apptainer.sif, which can be used on any cluster with Apptainer/Singularity installed.
5. Run the image and compile Vulpes
Start the container:
/opt/mox/apptainer/bin/apptainer exec vulpes_apptainer.sif bash
then the terminal should transform into an Apptainer terminal. Navigate to the base directory of Vulpes and start the compilation (see the Vulpes Documentation):
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j2
Test the installation: