#!/bin/sh
# This wrapper script is intended to support independent execution.
# 
# This script uses the following environment variables set by the submit MATLAB code:
# MDCE_MATLAB_EXE     - the MATLAB executable to use
# MDCE_MATLAB_ARGS    - the MATLAB args to use
#

# Copyright 2010-2017 The MathWorks, Inc.

# Prep module load
source /etc/profile.d/modules.sh
module load profile/eng
# matlab module generally loads intel MPI, but due to the ssh connection do it explicitly
module load intel/pe-xe-2018--binary
module load intelmpi/2018--binary
module load matlab

export TZ=Europe/Zurich

echo "Executing: ${MDCE_MATLAB_EXE} ${MDCE_MATLAB_ARGS}"
eval "${MDCE_MATLAB_EXE}" ${MDCE_MATLAB_ARGS}
EXIT_CODE=${?}
echo "Exiting with code: ${EXIT_CODE}"
exit ${EXIT_CODE}
