Is it possible to force a 'serial' section within an SGE script?
#$ -S /bin/bash
#$ -N example
#$ -v MPI_HOME
#$ -q all.q
#$ -pe ompi 40
#$ -j yes
#$ -o example.log
$MPI_HOME/bin/mpirun example.exe
# now do some serial commands
grep 'success' example.log
mv example.out /archive
Currently, I split these types of job into two scripts, and make one dependent on the other. It would be much simpler to maintain and schedule if I could keep everything in one script.
You can do this but the job will hold on to all the slots it is using while you do it. As the serial code is invoked directly in the job script rather than via mpirun it will only be run once on the head node of the job. For quick stuff like your example it doesn't matter too much but if you have a long running serial section then it is a more efficient use of resources to split them into two jobs as you are doing.