Search code examples
pbs

How to execute a script on every allocated node with PBS


I want to execute a script on every node that is allocated to my job. So I did the following test.

#PBS -N Test
#PBS -l nodes=2:ppn=4

ulimit -Ss unlimited

cd $PBS_O_WORKDIR
cp $PBS_NODEFILE node
NCORE=`cat node | wc -l`
export P4_RSHCOMMAND=/opt/pbs/default/bin/pbs_remsh
echo `hostname` > `hostname`

The result is echo `hostname` > `hostname` is only executed on the first allocated node.

What I actually want to do is

#PBS -N Test
#PBS -l nodes=2:ppn=4

ulimit -Ss unlimited

cd $PBS_O_WORKDIR
cp $PBS_NODEFILE node
NCORE=`cat node | wc -l`
export P4_RSHCOMMAND=/opt/pbs/default/bin/pbs_remsh
jug execute somescript&
jug execute somescript&
jug execute somescript&
jug execute somescript&

in which the four jug execute somescript& is executed on every node. How can I do this?


Solution

  • If you are using Torque, there is an easy was to do this is:

    pbsdsh -u somescript