-
Notifications
You must be signed in to change notification settings - Fork 39
/
warp3d_script_macOS
executable file
·79 lines (76 loc) · 1.93 KB
/
warp3d_script_macOS
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
#!/bin/bash
#
#
# Run WARP3D on macOS -- OpenMP only + MKL sparse solver
# =====================================================
#
# usage: warp3d_mac ( number of threads ) ( < input ) ( > output )
#
# ( ) -- optional
#
#
if [ $# = "0" ]; then
echo ">> Usage:"; echo " "
echo " warp3d_mac ( <parms> ) ( < input ) ( > output )"; echo " "
echo " <parms>: <no. of threads> "
echo " ( ) implies optional"
echo " "
exit 1
fi
#
echo " "
echo ">> Running WARP3D on macOS ..."
echo " OpenMP + threaded MKL direct/iterative sparse solver "
#
if [ -z "$WARP3D_HOME" ]; then
printf "[ERROR]\n"
printf "... An environment variable WARP3D_HOME is not set.\n"
printf "... use Bash shell command: export WARP3D_HOME=... install directory...\n"
printf "Quitting...\n"
exit 1
fi
#
# set executable file name for OpenMP + MKL sparse solver
# version of warp3d
#
warp3d_exe="$WARP3D_HOME/run_macOS/warp3d.omp"
#
if [[ ! -f "$WARP3D_HOME/run_macOS/warp3d.omp" ]]
then
echo " "; echo " "
echo ">>>> WARP3D executable does not exist:'$warp3d_exe'"
echo " No execution possible"
echo " "; echo " "
exit
fi
if [[ ! -x "$WARP3D_HOME/run_macOS/warp3d.omp" ]]
then
echo " "; echo " "
echo ">>>> WARP3D executable must have execute permissions:'$warp3d_exe'"
echo " No execution possible"
echo " "; echo " "
exit
fi
#
# set the number of threads for WARP3D execution and
# for use by the MKL sparse direct/iterative solver. Here we just
# assign the same number of threads for both.
# default to 1 thread if user does nothing.
#
export OMP_NUM_THREADS=1
if [ $# = "1" ]; then
export OMP_NUM_THREADS=$1
fi
export MKL_NUM_THREADS=$OMP_NUM_THREADS
#
echo ">> Number of threads for parallel execution: " $OMP_NUM_THREADS
echo " "
#
touch core &> /dev/null
chmod ugo-rwx core
#
ulimit -s 32768
$warp3d_exe
#
/bin/rm -f core
exit