source: issm/trunk/cron/run2.sh@ 4999

Last change on this file since 4999 was 4999, checked in by Mathieu Morlighem, 15 years ago

Added New nightly runs

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/bin/bash
2
3#prepare runs
4#get configs {{{1
5if [ $# -ne 1 ];
6then
7 #no config file specified: exit
8 echo "no config file specified. Exiting..."
9 exit 1
10fi
11
12#Go to init_Path and source config
13INIT_PATH=$(cat $ISSM_DIR/TEMP/nightly.log | grep "init_path" | awk '{print $2}')
14cd $INIT_PATH
15source $1;
16#}}}
17#check NUMCPUS_RUN options {{{1
18if [ "$NUMCPUS_RUN" = "" ]
19then
20 echo "NUMCPUS_RUN option not found, defaulting to NUMCPUS_RUN = 1"
21 NUMCPUS_RUN=1
22fi
23#}}}
24#create softlink to startup {{{1
25cd $ISSM_DIR/test/NightlyRun/
26ln -s $ISSM_DIR/startup.m .
27#}}}
28
29#Launch all tests on different cpus
30for (( i=1;i<=$NUMCPUS_RUN;i++ ))
31do
32 #Launch matlab and the nightly run script
33 cat > $ISSM_DIR/TEMP/matlab_run$i.m << EOF
34 warning off %necessary to avoid a nightly.log of several Go for parallel runs
35 try,
36 cd $ISSM_DIR/test/NightlyRun
37 startup;
38 $(if [ "$NROPTIONS" = "" ]
39 then
40 echo "runme('rank',$i,'numprocs',$NUMCPUS_RUN);"
41 else
42 echo "runme($NROPTIONS,'rank',$i,'numprocs',$NUMCPUS_RUN);"
43 fi
44 )
45 catch me,
46 %An error occured, get report and exit
47 directory=strsplit(pwd,'/');
48 message=getReport(me)
49 fid=fopen([ISSM_DIR '/TEMP/matlaberror.log'], 'at');
50 fprintf(fid,'\nMatlab error occured in: %s\n\n',directory{end});
51 fprintf(fid,'%s',message);
52 fclose(fid);
53 end
54 exit
55EOF
56
57 #Start run from TEMP directory
58 cd $ISSM_DIR/TEMP/
59
60 #Start test
61 MATLAB_VERSION="7.6" #7.2,7.4,7.6 and 7.8
62 /usr/local/pkgs/matlab-$MATLAB_VERSION/bin/matlab -nojvm -nosplash -r matlab_run$i -logfile matlab_log$i.log &
63
64done
65
66#wait until matlab closes
67wait
68
69#concatenate all reports
70mv matlab_log1.log matlab_log.log
71for (( i=2;i<=$NUMCPUS_RUN;i++ ))
72do
73 cat matlab_log.log matlab_log$i.log > matlab_log.log.bak
74 mv matlab_log.log.bak matlab_log.log
75 rm matlab_log$i.log
76
77done
Note: See TracBrowser for help on using the repository browser.