| 1 | #!/bin/bash
|
|---|
| 2 |
|
|---|
| 3 | #prepare runs
|
|---|
| 4 | #get configs {{{1
|
|---|
| 5 | if [ $# -ne 1 ];
|
|---|
| 6 | then
|
|---|
| 7 | #no config file specified: exit
|
|---|
| 8 | echo "no config file specified. Exiting..."
|
|---|
| 9 | exit 1
|
|---|
| 10 | fi
|
|---|
| 11 |
|
|---|
| 12 | #Go to init_Path and source config
|
|---|
| 13 | INIT_PATH=$(cat $ISSM_DIR/TEMP/nightly.log | grep "init_path" | awk '{print $2}')
|
|---|
| 14 | cd $INIT_PATH
|
|---|
| 15 | source $1;
|
|---|
| 16 | #}}}
|
|---|
| 17 | #check NUMCPUS_RUN options {{{1
|
|---|
| 18 | if [ "$NUMCPUS_RUN" = "" ]
|
|---|
| 19 | then
|
|---|
| 20 | echo "NUMCPUS_RUN option not found, defaulting to NUMCPUS_RUN = 1"
|
|---|
| 21 | NUMCPUS_RUN=1
|
|---|
| 22 | fi
|
|---|
| 23 | #}}}
|
|---|
| 24 | #create softlink to startup {{{1
|
|---|
| 25 | cd $ISSM_DIR/test/NightlyRun/
|
|---|
| 26 | ln -s $ISSM_DIR/startup.m .
|
|---|
| 27 | #}}}
|
|---|
| 28 |
|
|---|
| 29 | #Launch all tests on different cpus
|
|---|
| 30 | for (( i=1;i<=$NUMCPUS_RUN;i++ ))
|
|---|
| 31 | do
|
|---|
| 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
|
|---|
| 55 | EOF
|
|---|
| 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 |
|
|---|
| 64 | done
|
|---|
| 65 |
|
|---|
| 66 | #wait until matlab closes
|
|---|
| 67 | wait
|
|---|
| 68 |
|
|---|
| 69 | #concatenate all reports
|
|---|
| 70 | mv matlab_log1.log matlab_log.log
|
|---|
| 71 | for (( i=2;i<=$NUMCPUS_RUN;i++ ))
|
|---|
| 72 | do
|
|---|
| 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 |
|
|---|
| 77 | done
|
|---|