-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun_WISC_MVPA.sh
executable file
·102 lines (86 loc) · 1.96 KB
/
run_WISC_MVPA.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# script for execution of deployed applications
#
# Sets up the MCR environment for the current $ARCH and executes
# the specified command.
#
cleanup() {
# Remove the Matlab runtime distribution
if [ -f "r2018b.tar.gz" ]; then
rm -v "r2018b.tar.gz"
fi
for x in "$@"; do
rm -fv $(basename "$x")
done
echo "all clean"
}
abort() {
echo >&2 '
*************
** ABORTED **
*************
'
echo >&2 "Files at time of error"
echo >&2 "----------------------"
ls >&2 -l
cleanup "$@"
echo "An error occured. Exiting ..." >&2
exit 1
}
terminated() {
echo >&2 '
****************
** TERMINATED **
****************
'
echo >&2 "Files at time of interrupt"
echo >&2 "--------------------------"
ls >&2 -l
cleanup "$@"
echo "An error occured. Exiting ..." >&2
exit 1
}
success() {
echo '
*************
** SUCCESS **
*************
'
cleanup "$@"
exit 0
}
# If an exit or interrupt occurs while the script is executing, run the abort
# function.
trap 'abort "$@"' EXIT
trap 'terminated "$@"' SIGTERM SIGKILL
set -e
set -x
EXECUTABLE=$1
shift 1
for x in "$@"; do
cp "$x" .
done
# Run the Matlab application
# CHTC
echo "------------------------------------------"
echo "Setting up environment variables"
tar xzf "r2018b.tar.gz"
# This is an attempt to fix broken environments by shipping libraries that are
# missing on some nodes.
MCR_ROOT="`pwd`/v95"
mkdir cache && export MCR_CACHE_ROOT="`pwd`/cache"
echo "MCR_ROOT: ${MCR_ROOT}"
echo "MCR_CACHE_ROOT: ${MCR_CACHE_ROOT}"
echo ---
LD_LIBRARY_PATH=.:${MCR_ROOT}/runtime/glnxa64 ;
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCR_ROOT}/bin/glnxa64 ;
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCR_ROOT}/sys/os/glnxa64;
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:"./lib64"
XAPPLRESDIR=${MCR_ROOT}/X11/app-defaults ;
export XAPPLRESDIR;
export LD_LIBRARY_PATH;
echo LD_LIBRARY_PATH is ${LD_LIBRARY_PATH};
chmod +x ${EXECUTABLE}
eval "./${EXECUTABLE}"
# Exit successfully. Hooray!
trap 'success "$@"' EXIT SIGTERM