-
Notifications
You must be signed in to change notification settings - Fork 0
/
jar_cuda_card.bash
180 lines (140 loc) · 3.35 KB
/
jar_cuda_card.bash
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/bash -l
##load the modules command
. /etc/profile.d/resif.sh
. /etc/profile.d/nvidia.sh
#module load OpenMPI/1.7.3-gcccuda-2.6.10
module load numlib/imkl
#module load CUDA
module load toolchain/iimpi
module load toolchain/ictce
module load mpi/impi
stem=$1
card=$2
##build restraint and infiles
../make_rst.bash $stem.pdb
##find out which cards are active and pick an idle one.
cards_present=$(nvidia-smi -L | awk '{print $2}' | sed 's/://')
cards_used=$(nvidia-smi | grep pmemd | awk '{print $2}')
node=$(cat $OAR_NODEFILE | head -n 1)
use_c=-1
for c in $cards_present
do
ok=1
for cc in $cards_used
do
if [ "$cc" -eq "$c" ]
then
ok=0
fi
done
if [ "$ok" -eq "1" ]
then
use_c=$c
break
else
echo "card $c is busy"
fi
done
if [ "$use_c" -eq "-1" ]
then
echo "did not find non-busy GPU on node $node"
echo "consider a resub asking for access to an entire node instead of 1 core."
nvidia-smi
exit 1
else
echo "running on non-busy GPU, id: $use_c"
export CUDA_VISIBLE_DEVICES=$use_c
fi
#export CUDA_VISIBLE_DEVICES=$card
#set local variables
EXE="mpirun -np 4 /home/clusterusers/jberryman/amber/bin/pmemd.MPI"
EXE=/home/clusterusers/jberryman/amber/bin/pmemd.cuda
sh ~/amber/amber.sh
#sh /opt/apps/resif/devel/v1.1-20150414/core/software/mpi/impi/5.0.3.048-iccifort-2015.3.187/bin64/mpivars.sh
from=crd
dest=heat
if [ -s "$stem.$dest" ]
then
echo "found $stem.$dest"
else
$EXE -O -i heat.in \
-o $stem$dest.out -r $stem.$dest -x $stem$dest.nc \
-c $stem.$from -ref $stem.crd -p $stem.top
fi
from=$dest
dest=heat2
if [ -s "$stem.$dest" ]
then
echo "found $stem.$dest"
else
$EXE -O -i heat2.in \
-o $stem$dest.out -r $stem.$dest -x $stem$dest.nc \
-c $stem.$from -ref $stem.crd -p $stem.top
fi
from=$dest
dest=heat3
if [ -s "$stem.$dest" ]
then
echo "found $stem.$dest"
else
$EXE -O -i heat3.in \
-o $stem$dest.out -r $stem.$dest -x $stem$dest.nc \
-c $stem.$from -ref $stem.crd -p $stem.top
fi
zMax=$(tail -n 1 $stem.crd | awk '{printf("%s\n",substr($0,25,12))}')
for i in `seq 1 15`
do
from=$dest
dest=npt$i
if [ -s "$stem.$dest" ]
then
echo "found $stem.$dest"
else
$EXE -O -i npt.in \
-o $stem$dest.out -r $stem.$dest -x $stem$dest.nc \
-c $stem.$from -ref $stem.crd -p $stem.top
##reset the box length
boxLine=$(tail -n 1 $stem.$dest |\
awk -v z="$zMax" '{printf("%s%s%s\n",substr($0,0,24),z,substr($0,37))}')
N=$(wc -l $stem.$dest | awk '{print $1-1}')
head -n $N $stem.$dest > c
echo "$boxLine" >> c
echo "reset box from:"
tail -n 1 $stem.$dest
echo "to:"
tail -n 1 c
mv c $stem.$dest
fi
done
strtSnap=$dest
for i in `seq 1 99`
do
##update the start snap to end of last equil... if not
##running in parallel.
if [ -s "$stem.stretch${i}_0" ]
then
strtSnap="stretch${i}_0"
fi
if [ "$i" -eq "$card" ]
then
echo "running $i on card $card"
else
continue
fi
dest=$strtSnap
for step in `seq 0 10`
do
from=$dest
dest=stretch${i}_$step
if [ -s "$stem.$dest" ]
then
echo "found $stem.$dest , skipping."
else
sed 's/t_stretch/t_stretch'$i'/' stretch_$step.in > card$i.in
$EXE -O -i card$i.in \
-o $stem$dest.out -r $stem.$dest -x $stem$dest.nc \
-c $stem.$from -ref $stem.crd -p $stem.top
fi
done
break
done