-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob-accept-cuda.sh
44 lines (36 loc) · 1.07 KB
/
job-accept-cuda.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
#!/bin/bash
export [email protected]
INCOMING=/home/pfp-run/incoming
SANDBOX=$HOME/tmp
TIMEOUT=15s
if [ -e $HOME/RUNNING ]
then
exit
fi
touch $HOME/RUNNING
mkdir $SANDBOX
scp -r pfp-queue.mkmks.org:/home/pfp-queue/incoming $INCOMING
ssh pfp-queue.mkmks.org "rm -f /home/pfp-queue/incoming/*"
while [ "`ls $INCOMING/cuda+*`" ]
do
NEXTJOB=`ls -1 $INCOMING/cuda+* | head -n 1`
JOBMAIL=$(echo $NEXTJOB | cut -f2 -d+)
JOBPN=$(echo $NEXTJOB | cut -f3 -d+)
JOBDATE=$(echo $NEXTJOB | cut -f4 -d+)
mv "$NEXTJOB" $SANDBOX/main.cu
cd $SANDBOX
nvcc main.cu -o main &>$SANDBOX/compile.log
sudo -u nobody timeout -k 5s $TIMEOUT $1 ./main &> $SANDBOX/run.log
if [ $? != 0 ]
then
echo "Timeout!" >> $SANDBOX/run.log
fi
if [ `stat -c%s $SANDBOX/run.log` -gt 500000 ]
then
echo "Nice one, now try not to flood stdout/stderr." > $SANDBOX/run.log
fi
echo "O HAI" | mutt -s "About that PFP job from $JOBDATE" -a $SANDBOX/compile.log -a $SANDBOX/run.log -- $JOBMAIL
done
rm -rf $SANDBOX
rm -rf $INCOMING
rm $HOME/RUNNING