-
Notifications
You must be signed in to change notification settings - Fork 1
/
eden_mp
executable file
·98 lines (81 loc) · 2.56 KB
/
eden_mp
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
#!/bin/sh
########################################################################
#
# eden_mp
# Copyright (C) 2011 Scott Simmerman
#
# This file is part of Eden.
#
# Eden is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Eden is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eden. If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
# Eden_mp - to run on multiprocessor
# run eden_config from inside the Eden directory to set EDEN_PATH
EDEN_PATH=
# check cmd line args
usage="usage: eden_mp run_dir num_cores"
if test $# -ne 2; then
echo $usage
exit 1
fi
# check for existence of run_dir
if test ! -d $1; then
echo " Error: run_dir '$1' not found"
exit 1
fi
# get full path to run_dir
case $(dirname $1) in
.) run_path=$PWD;;
..) run_path=$(dirname $PWD);;
*) run_path=$(dirname $1)
esac
RUN_DIR=$run_path/$(basename $1)
NCPUS=$2
TIMESTAMP=$(date +%Y.%m.%d-%H.%M.%S)
# see what files are in run_dir
if test -f $RUN_DIR/eden.config; then
echo " ERROR: run_dir contains configuration file from previous run"
exit 1
fi
if test -f $RUN_DIR/params; then
echo " EDEN: generating commands"
$EDEN_PATH/make_commands.sh < $RUN_DIR/params > $RUN_DIR/commands
# check success of make_commands
elif test ! -f $RUN_DIR/commands; then
echo $usage
echo " ERROR: no params or commands file found in run_dir"
exit 1
fi
# get number of digits in number of commands so we can pad indices properly
NUM_DIGITS=$(( $(cat $RUN_DIR/commands | wc -l | awk '{print $1}' | wc -c) - 1))
HNAME=$(hostname)
# write out eden.config file (this will be needed by abel processes)
echo " EDEN: writing eden.config"
echo "#!/bin/sh
# $TIMESTAMP
# Base configuration
export mode=mp
export time=$TIMESTAMP
export eden_path=$EDEN_PATH
export run_dir=$RUN_DIR
export outfiles_dir=$RUN_DIR/outfiles
export commands_file=$RUN_DIR/commands
export num_digits=$NUM_DIGITS
export adam_hostname=$HNAME
export cores_per_abel=1
export pbs_opts=\"\" # not needed for eden_mp
export ncpus=$NCPUS
" > $RUN_DIR/eden.config
# adam takes over from here
$EDEN_PATH/adam.sh $RUN_DIR/eden.config