Commit 6db8dc36 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Add handling of dynamic libraries to wrapper generator.

parent e997e454
......@@ -2,6 +2,9 @@
set -eux
destdir=$1
SCRATCH=$2
if [[ x"${3+set}" = xset ]]; then
libcopy=$3
fi
mkdir -p "${destdir}"
cat >"${destdir}/srun" <<EOF
#! /bin/bash
......@@ -69,7 +72,19 @@ for ((i=1; i <= \$# ; ++i)); do
;;
esac
done
$(if [[ x${libcopy+set} = xset ]]; then
printf "%s\n" "libcopy=(\$(ldd \"\$prog\" | grep ' => $libcopy' | sed -e 's@.*=> @@' -e 's/ (0x[0-9a-f]*)\$//'))"
mkdir -p "$SCRATCH/lib_bcast"
printf "%s\n" "install --compare --target-directory=\"$SCRATCH/lib_bcast\" \"\${libcopy[@]}\""
printf "%s\n" "LD_LIBRARY_PATH=\"$SCRATCH/lib_bcast:\$LD_LIBRARY_PATH\""
printf "%s\n" "srun_opts+=(--epilog=\"${destdir}/srun-bcast-cleanup-epilog\")"
fi)
exec /usr/bin/srun "--bcast=$SCRATCH/" -D "$SCRATCH" "\${srun_opts[@]}" \
"\$prog" "\${prog_opts[@]}"
EOF
if [[ x${libcopy+set} = xset ]]; then
printf "%s\n%s\n" '#! /bin/bash' 'rm \"$SCRATCH/slurm_bcast_$SLURM_JOB_ID.\${SLURM_STEP_ID}*\"' \
>"${destdir}/srun-bcast-cleanup-epilog"
chmod +x "${destdir}/srun-bcast-cleanup-epilog"
fi
chmod +x "${destdir}/srun"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment