Enviamatlab: enviamatlab2009.sh

File enviamatlab2009.sh, 1.3 KB (added by antonio, 12 years ago)
Line 
1#!/bin/bash 
2
3if [ $# -lt 1 ] ; then
4  echo "Uso: enviamatlab2009.sh fichero.m ['-l host=wn00x.macc.unican.es']"
5  exit 1
6fi
7
8mfile=$1
9shift
10qsubargs="$*"
11
12tag=$(date +%Y%m%dT%H%M%S)
13mlscript="matlabqsub.${tag}"
14bname=$(basename $mfile .m)
15
16mfilepath=`pwd`/`dirname $mfile`
17
18cat > ${mlscript} << EOF
19#!/bin/bash
20#PBS -N ${bname}
21#PBS -q macc
22#PBS -l nodes=1:ppn=1
23# --- Mail options
24#     mail on execution("b"), termination ("e"), or interruption ("a")
25#PBS -m a
26#PBS -j oe
27#PBS -M ${EMAIL:-noreply@unican.es}
28# --- do not rerun this job if it fails
29#PBS -r n
30# --- export all my environment variables to the job
31#PBS -V
32echo "Job $PBS_JOBID"
33source /software/etc/bashrc
34export PATH=/software/Matlab_R2009a/bin:$PATH
35matlab -logfile ${bname}.${tag}.log -r "maxNumCompThreads(1);cd ${mfilepath};pwd;${bname};" -nosplash
36 -nodesktop -nojvm   
37EOF
38chmod +x ${mlscript}
39#cat ${mlscript}
40#
41# mandamos el job
42#
43#echo "Envio del job desde $PWD"
44ssh ce01.macc.unican.es qsub ${PWD}/${mlscript} ${qsubargs} 
45#ssh ce01.macc.unican.es qsub -q macc -l nodes=1:ppn=2 ${PWD}/${mlscript} ${qsubargs} 
46#ssh ce01.macc.unican.es qsub -q hmem -l nodes=1:ppn=8 ${PWD}/${mlscript} ${qsubargs} 
47
48# qsub -I -q macc -l nodes=1:ppn=1
49# qsub -I -q macc -l nodes=1:ppn=2
50# qsub -I -q hmem -l nodes=1:ppn=8
51