apptainer/singularity-userdocs

SINGULARITYENV_APPEND_[PATH/LIBRARY_PATH] on %environment issue / Correct MPI example

santos-lucas opened this issue · 2 comments

Which Document page:

On what page is the problem?
on https://sylabs.io/guides/3.5/user-guide/mpi.html

export MPICH_DIR=/opt/mpich-3.3
export SINGULARITY_MPICH_DIR=$MPICH_DIR
export SINGULARITYENV_APPEND_PATH=$MPICH_DIR/bin
export SINGULAIRTYENV_APPEND_LD_LIBRARY_PATH=$MPICH_DIR/lib

I did create the container with the definition file for openMPI. and i expected something like:

$ singularity exec mpi.sif env | grep ^LD_LIB
LD_LIBRARY_PATH=/.singularity.d/libs:/opt/mpich-3.3/lib

Actual results:

But i'm getting the following output, as the env variables were not updated.

$ singularity exec mpi.sif env | grep ^LD_LIB
LD_LIBRARY_PATH=/.singularity.d/libs

somehow the mpi execution is working fine.

Typo - SINGULAIRTYENV on this page. Will fix.

The suggested behaviour of the SINGULARITYENV_APPEND_PATH (and indeed the other SINGULARITYENV_* env vars) indicated in the MPI docs is not consistent with the behaviour I'm experiencing, nor with what's documented here:
https://sylabs.io/guides/3.6/user-guide/environment_and_metadata.html

i.e. that the SINGULARITYENV_* env vars are for use outside of the Singularity container.

So, in a def file I would replace this:

export SINGULARITYENV_APPEND_PATH=$MPICH_DIR/bin

with the more familiar:

export PATH=$PATH:$MPICH_DIR/bin

(... reversing the sequence in the latter when using a SINGULARITYENV_PREPEND_* variable.)