Skip to content

Doc.Installation.Singularity.Local

Joe Latessa edited this page Jun 11, 2024 · 5 revisions

Using X-SCAPE in a Singularity Container

Install Singularity

If you already have Singularity installed on your local system, you can skip this step. From a stand-alone Ubuntu/Debian Linux terminal (or from an Ubuntu/Debian Linux terminal running through the Windows 10 WSL2), enable the NeuroDebian repository from which Singularity can be installed. Then install Singularity. Further details are at: https://sylabs.io/guides/3.0/user-guide/installation.html

sudo wget -O- http://neuro.debian.net/lists/xenial.us-ca.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list && \
    sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9 && \
    sudo apt-get update

sudo apt-get install -y singularity-container

To check that Singularity was installed, check the version number with the following command:

singularity --version

Install X-SCAPE in a Singularity Container

Create a Singularity container of X-SCAPE built from the Docker container available on Docker Hub. Note that tags and container version numbers on Docker Hub (such as stable or v1.4) do not correspond to tags and version numbers of X-SCAPE. The versioning on Docker Hub is different. In most cases, use the stable version of the container.

Using the --sandbox flag creates the X-SCAPE Singularity container as a writable directory. The directory name chosen here is jetbox. You can create any directory name you prefer.

This command creates the Singularity container with the required software prerequisites to run X-SCAPE. If you have administrative privileges, using sudo is preferred. Building without sudo is possible, but might not work on some older kernels.

sudo singularity build --sandbox jetbox docker://jetscape/base:stable

Shell into the newly built container. $HOME is mounted by default. If you have administrative privileges, using sudo is preferred. Running without sudo is possible, but might not work on some older kernels.

sudo singularity shell --writable jetbox

Create a directory called myX-SCAPE. You can create any directory name you prefer. CD into the new directory and clone X-SCAPE.

mkdir /myX-SCAPE
cd myX-SCAPE
git clone https://github.com/JETSCAPE/X-SCAPE.git

CD into the cloned repository. Create a directory called build. CD into the build directory and build X-SCAPE.

cd X-SCAPE
mkdir build
cd build
cmake ..
make -j4    # Builds using 4 cores; adapt as appropriate

Without leaving the interactive Singularity container, run X-SCAPE passing in the jetscape_user_PP_1910.05481.xml file from the config directory to test the installation.

./runJetscape ../config/publications_config/arXiv_1910.05481/jetscape_user_PP_1910.05481.xml

Note that when using Singularity with external modules such as SMASH, some environment variables that specify directory paths such as SMASH_DIR might need to be updated with paths relevant to your system. The default values provided in the image are intended for use with Docker on one's local machine and may differ with Singularity. See the external_packages README for details about which environment variables are needed and how to set them.