[torqueusers] running perl in a batch program

James J Coyle jjc at iastate.edu
Wed Jan 9 14:09:44 MST 2008


   I assume that you are wanting the perl script to run on each of
the nodes.  To do that you would need some sort of a launcher.
Torque just reserves the nodes, and any serial program or command is
just run on the first node listed in  $PBS_NODEFILE . To run this command
on ever node, you need some sort of remote launcher like mpiexec, mpirun
or ssh.

   E.g. If you have passworld-less ssh installed between the nodes
you can use:


#PBS -lmem=2Gb,nodes=4:ppn=2,cput=40:00,walltime=25:00

# Change to directory from which qsub was executed

cat ${PBS_NODEFILE} | uniq     

/bin/rm -f myperlscript
echo 'system("hostname > /tmp/a1");open(FH,"/tmp/a1");$_=<FH>; 
s/node/computer/g;print;' > myperlscript

for n in `uniq $PBS_NODEFILE` ; do

  ssh $n "echo '' | perl $PBS_O_WORKDIR/myperlscript"


The above would run a copy of the perl script myperlscript on each 
node in the cluster before running the MPI program myprog.

The result of the above run on my cluster was:

  Or, if your program is in C, and you want one perl script to run for each
instance of the program myprog, you could use the system call in C:

main() {

  MPI_Init( ... )   ;
  system( "echo '' | perl myperlscript" );



 James Coyle, PhD
 SGI Origin, Alpha, Xeon and Opteron Cluster Manager
 High Performance Computing Group     
 235 Durham Center            
 Iowa State Univ.           phone: (515)-294-2099
 Ames, Iowa 50011           web: http://jjc.public.iastate.edu

> Has anyone been able to run a perl program from multiple
> nodes using qsub?
> tia
> Ted Maas
> Systems Group - ACCC 
> University of Illinois @ Chicago
> _______________________________________________
> torqueusers mailing list
> torqueusers at supercluster.org
> http://www.supercluster.org/mailman/listinfo/torqueusers

More information about the torqueusers mailing list