From 8f3fc243afbcc5977591656fac261c69f5a801fb Mon Sep 17 00:00:00 2001
From: "Patrick M. Jensen" <patmjen@dtu.dk>
Date: Fri, 10 Feb 2023 11:13:49 +0100
Subject: [PATCH] Fix error in init script

module avail prints its output to stderr. In interactive shells, it
seems this stderr is automatically redirected to stdout, so grep
would pick it up. This is not the case in batch jobs, so we manually
redirect the stderr output to stdout.
---
 scripts/init.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/init.sh b/scripts/init.sh
index d6e29d2..5cb26df 100644
--- a/scripts/init.sh
+++ b/scripts/init.sh
@@ -11,12 +11,12 @@ CUDA_VERSION=11.6      # CUDA version (default: 11.6)
 
 # Load modules
 module load python3/$PYTHON_VERSION
-module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" | grep "numpy/")
-module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" | grep "scipy/")
-module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" | grep "matplotlib/")
-module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" | grep "pandas/")
+module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" 2>&1 | grep "numpy/")
+module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" 2>&1 | grep "scipy/")
+module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" 2>&1 | grep "matplotlib/")
+module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" 2>&1 | grep "pandas/")
 module load cuda/$CUDA_VERSION
-CUDNN_MOD=$(module avail -o modulepath -t cudnn | grep "cuda-${CUDA_VERSION}" | sort | tail -n1)
+CUDNN_MOD=$(module avail -o modulepath -t cudnn | grep "cuda-${CUDA_VERSION}" 2>&1 | sort | tail -n1)
 if [[ ${CUDNN_MOD} ]]
 then
     module load ${CUDNN_MOD}
-- 
GitLab