| Sample PBS script in your login account
Limit your job to 4 nodes
#!/bin/bash
### Number of nodes 16 nodes using 4 Processor Per Node
#PBS -l nodes=16:ppn=4
### Example: to request 2 VPs on each of 3 nodes and 1 VPs on 2 more
nodes
## #PBS -l nodes=3:ppn=2+2:ppn=1
### Output files. If not specified PBS uses the job name and ID.
###PBS -o output-mytorquejob.log
###PBS -e output-mytorquejob.err
### Merge stderr with stdout
#PBS -j oe
### Mail to user
#PBS -m eb
### Queue name
#PBS -q default
### Job name
#PBS -N PBS_MPI_Test
### Declare job-non-rerunable
#PBS -r n
PBS_PWD="`pwd`";
cd "${PBS_O_WORKDIR}";
THIS_HOST="`hostname`";
MPICH_BUILD="p4-intel";
MPICH_ROOT="/opt/mpich/${MPICH_BUILD}";
MPIRUN_BIN="${MPICH_ROOT}/bin/mpirun";
MPIEXEC_BIN="/opt/mpiexec/bin/mpiexec";
CPI_BIN="${MPICH_ROOT}/examples/cpi";
CLEANIPCS_BIN="${MPICH_ROOT}/sbin/cleanipcs";
NPROCS="`wc -l < ${PBS_NODEFILE} | tr -d '[:blank:]'`";
hr()
{
perl -e 'print "\n" . "-"x70 . "\n\n"';
}
print_job_info()
{
hr;
printf "Torque Job ID: %s\n" "${PBS_JOBID}";
printf "\nRunning on host %s @ %s\n" "${THIS_HOST}" "`date`";
printf "\nStarting directory was %s\n" "${PBS_PWD}";
printf "Working directory is %s\n" "${PBS_O_WORKDIR}";
printf "The PWD is %s\n" "`pwd`";
printf "\nThis job runs on the following processors:\n\n\t";
printf "%s " `cat ${PBS_NODEFILE} | sort`;
printf "\n\n";
printf "This job has allocated %s nodes/processors.\n" "${NPROCS}";
hr;
}
clean_ipcs()
{
for NODE in `cat ${PBS_NODEFILE} | sort -u`; do
ssh ${NODE} ${CLEANIPCS_BIN};
done;
}
run_mpirun()
{
clean_ipcs;
MPI_CMD="${MPIRUN_BIN} -nolocal -np ${NPROCS} -machinefile ${PBS_NODEFILE}
${CPI_BIN
}";
printf "%s\n\n" "${MPI_CMD}";
time ${MPI_CMD};
sleep 5;
}
run_mpiexec()
{
clean_ipcs;
MPIEXEC_CMD="${MPIEXEC_BIN} ${CPI_BIN}";
printf "%s\n\n" "${MPIEXEC_CMD}";
time ${MPIEXEC_CMD};
sleep 5;
}
main()
{
print_job_info;
#run_mpirun;
run_mpiexec;
hr;
}
time main;
|