Gysela Development Environment with Guix

Table of content

This tutorial covers how to use Guix to get a development environment for Gysela with Guix. The core item to the tutorial is a Guix pack, a bundle containing all the software. The tutorial is then divided in 2 sections:

  • Fetching a pre-built Guix pack
  • Generating a Guix pack yourself
  • Using the Guix pack as a development environment

Downloading the pack

The easiest way to get started is by downloading the Guix pack that is built by our continuous integration system. It is a Singularity/Apptainer image and is available from https://guix.bordeaux.inria.fr/search/latest/archive?query=spec:images-x86_64+status:success+gyselalibxx-squashfs.

Once downloaded, make sure to rename to file so that it has a .sif extension. See Using the Guix pack as a development environment for information on how to use that image.

Generating the pack

Requisites

You need to have Guix available, either locally or remotely. If you're running a Linux environment, it can be installed on your machine according to these instructions.

  guix pack -f squashfs -S /bin=bin -S /lib=lib --entry-point=/bin/bash -m manifest-gyselalibxx-dev-env.scm -r gysela-dev-env.sif

  # Send the pack from your computer to jean-zay
  scp ./gysela-dev-env.sif jean-zay.idris.fr:gysela-dev-env.sif

Jean-Zay requires that the image is moved into the $WORK directory, and then copied into the "authorized" directory:

  # In jean-zay
  mv -v gysela-dev-env.sif $WORK/gysela-dev-env.sif

  idrcontmgr cp $WORK/gysela-dev-env.sif
  # Now the container is copied into $SINGULARITY_ALLOWED_DIR/gysela-dev-env.sif

Using the Guix pack as a development environment

This step requires having the pack on the target machine. We have prepackaged an image at $WORK/../commun, which you can load into the authorized directory:

  idrcontmgr cp /gpfswork/rech/jpz/commun/gysela-dev-env.sif
  module load singularity

Singularity only works on compute nodes, so ask SLURM to give you an interactive session:

  # Launch the container. Here we ask for 2 hours and 10 CPU cores.
  srun \
    -A user@v100 \
    --time=02:00:00 \
    --ntasks=1 \
    --cpus-per-task=10 \
    --pty \
    --hint=nomultithread \
    -l \
    singularity shell \
      --bind $WORK:/work \
      $SINGULARITY_ALLOWED_DIR/gysela-dev-env.sif

You can now follow the regular Gysela development workflow:

  # clone gysela
  git clone --recurse-submodules git@gitlab.maisondelasimulation.fr:gysela-developpers/gyselalibxx.git gyselalibxx
  cd gyselalibxx

  # build
  mkdir build
  cd build
  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wall -Wno-sign-compare" ..
  make -j$(nproc)

  # test
  ctest --output-on-failure