#!/bin/bash # # Script Name : mpijob # Purpose : used to run MPI jobs in the interactive batch environment # (via "qsub -I -l nodes=N") # The script provides the nodes info needed for multiprocessor job # Executable is entered as command line input, $1 # Note that if you submit this script from the directory where # the executable resides, then $1 is just the executable # name, otherwise you must provide absolute path too. # Note also that if your program expects commandline input, just enter them # after the executable name. In the event of multiple entries, enclose # them with double quotes. # # Usage : # nodem032 % mpijob exec-name # nodem032 % mpijob exec-name "infile outfile" # # Author : Kadin Tseng, SCV, Boston University # Date : October, 2003 if [ -z $1 ]; then echo "This script expects an argument (executable file)" elif [ -x $1 ]; then NP=`wc -l $PBS_NODEFILE |awk '{print $1}'` echo The assigned nodes are `cat $PBS_NODEFILE` echo The executable is $1 mpirun -machinefile $PBS_NODEFILE -np $NP $1 $2 else echo "mpijob usage: mpijob /path.../exec-name" fi