Skip to content
Snippets Groups Projects
Commit 2479b508 authored by Bert Wesarg's avatar Bert Wesarg :keyboard:
Browse files

Singularity: Prefer `${var}` over `$var`

parent 2a22e050
No related branches found
No related tags found
2 merge requests!919Automated merge from preview to main,!911Its "Open MPI"
......@@ -74,9 +74,9 @@ From: ubuntu:20.04
%environment
export MPICH_DIR=/opt/mpich
export SINGULARITY_MPICH_DIR=$MPICH_DIR
export SINGULARITYENV_APPEND_PATH=$MPICH_DIR/bin
export SINGULAIRTYENV_APPEND_LD_LIBRARY_PATH=$MPICH_DIR/lib
export SINGULARITY_MPICH_DIR=${MPICH_DIR}
export SINGULARITYENV_APPEND_PATH=${MPICH_DIR}/bin
export SINGULAIRTYENV_APPEND_LD_LIBRARY_PATH=${MPICH_DIR}/lib
%post
echo "Installing required packages..."
......@@ -88,23 +88,23 @@ From: ubuntu:20.04
echo "Installing MPICH"
export MPICH_DIR=/opt/mpich
export MPICH_VERSION=4.1
export MPICH_URL="https://www.mpich.org/static/downloads/$MPICH_VERSION/mpich-$MPICH_VERSION.tar.gz"
export MPICH_URL="https://www.mpich.org/static/downloads/${MPICH_VERSION}/mpich-${MPICH_VERSION}.tar.gz"
mkdir -p /tmp/mpich
mkdir -p /opt
# Download
cd /tmp/mpich && wget -O mpich-$MPICH_VERSION.tar.gz $MPICH_URL && tar -xf mpich-$MPICH_VERSION.tar.gz
cd /tmp/mpich && wget -O mpich-${MPICH_VERSION}.tar.gz ${MPICH_URL} && tar -xf mpich-${MPICH_VERSION}.tar.gz
# Configure and compile/install
cd /tmp/mpich/mpich-$MPICH_VERSION
./configure --prefix=$MPICH_DIR && make install
cd /tmp/mpich/mpich-${MPICH_VERSION}
./configure --prefix=${MPICH_DIR} && make install
# Set env variables so we can compile our application
export PATH=$MPICH_DIR/bin:$PATH
export LD_LIBRARY_PATH=$MPICH_DIR/lib:$LD_LIBRARY_PATH
export MANPATH=$MPICH_DIR/share/man:$MANPATH
export PATH=${MPICH_DIR}/bin:${PATH}
export LD_LIBRARY_PATH=${MPICH_DIR}/lib:${LD_LIBRARY_PATH}
export MANPATH=${MPICH_DIR}/share/man:${MANPATH}
echo "Compiling the MPI application..."
cd /opt && mpicc -o mpitest mpitest.c
```
......@@ -195,13 +195,13 @@ This image may be run with
singularity exec xeyes.sif xeyes.
```
This works because all the magic is done by Singularity already like setting `$DISPLAY` to the outside
display and mounting `$HOME` so `$HOME/.Xauthority` (X11 authentication cookie) is found. When you are
This works because all the magic is done by Singularity already like setting `${DISPLAY}` to the outside
display and mounting `${HOME}` so `${HOME}/.Xauthority` (X11 authentication cookie) is found. When you are
using `--contain` or `--no-home` you have to set that cookie yourself or mount/copy it inside
the container. Similar for `--cleanenv` you have to set `$DISPLAY`, e.g., via
the container. Similar for `--cleanenv` you have to set `${DISPLAY}`, e.g., via
```console
export SINGULARITY_DISPLAY=$DISPLAY
export SINGULARITY_DISPLAY=${DISPLAY}
```
When you run a container as root (via `sudo`) you may need to allow root for your local display
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment