forked from lime-rt/lime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlime
More file actions
executable file
·109 lines (97 loc) · 2.49 KB
/
lime
File metadata and controls
executable file
·109 lines (97 loc) · 2.49 KB
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
103
104
105
106
107
108
109
#!/bin/bash -e
# LIME main driver script
# This file is part of LIME, the versatile line modeling engine
#
# Copyright (C) 2006-2014 Christian Brinch
# Copyright (C) 2015-2017 The LIME development team
export PATHTOLIME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
vernum=`grep VERSION ${PATHTOLIME}/src/lime.h` | awk '{print $3}' | sed s/\"//g
function version {
echo "This is LIME, The versatile line modeling engine, version $vernum"
echo "Copyright (C) 2006-2014 Christian Brinch"
echo "Copyright (C) 2015-2017 The LIME development team"
}
function usage {
echo "Usage: lime [OPTIONS] [[FILE]]"
echo " "
echo "Arguments:"
echo " FILE C model file"
echo " "
echo "Options:"
echo " -V Display version information"
echo " -h Display this message"
echo " -f Use fast exponential computation"
echo " -s Suppress output messages"
echo " -t Compile with debugging and fixed RNG seeds"
echo " -n Turn off ncurses output"
echo " -p NTHREADS Run in parallel with NTHREADS threads (default: 1)"
echo ""
echo "See <http://lime.readthedocs.org> for more information."
echo "Report bugs to <http://github.com/lime-rt/lime/issues>."
}
function tip {
echo "Try 'lime -h' for more information."
}
options=":Vfnstp:h"
cpp_flags=""
verbose="yes"
do_test="no"
use_curses="yes"
while getopts ${options} opt; do
case $opt in
V)
version
exit 0
;;
h)
usage
exit 0
;;
f)
cpp_flags+="-DFASTEXP "
;;
n)
use_curses="no"
;;
p)
nthreads=${OPTARG}
if [[ $nthreads =~ ^[1-9][0-9]*$ ]]; then
cpp_flags+="-DNTHREADS=${nthreads} "
else
echo "lime: error: invalid number of threads" >&2
tip
exit 1
fi
;;
s)
verbose="no"
;;
t)
do_test="yes"
;;
\?)
echo "lime: error: unknown option" >&2
tip
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ $# -ne 1 ]; then
echo "lime: error: incorrect number of arguments" >&2
tip
exit 1
fi
# Set up the PATHTOLIME, LD_LIBRARY_PATH and WORKDIR variables
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PATHTOLIME}/lib
export WORKDIR=$PWD
# Compile the code
pushd ${PATHTOLIME} >> /dev/null
make -s EXTRACPPFLAGS="${cpp_flags}" MODELS=$WORKDIR/$1 TARGET=$WORKDIR/lime_$$.x DOTEST=$do_test VERBOSE=$verbose USECURSES=$use_curses
# USEHDF5="yes"
make -s limeclean
# Run the code
popd >> /dev/null
./lime_$$.x
rm -rf lime_$$.x
exit 0