Last active
March 31, 2016 20:18
-
-
Save larsvilhuber/e9f3d641702ad11b744907135a45d662 to your computer and use it in GitHub Desktop.
Minimal qsub should work for large-scale MPI runs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -l | |
# Output (log) and errors will go into the system-defined stdout file | |
#PBS -j oe | |
############################################################################## | |
# Based on http://csc.cnsi.ucsb.edu/docs/running-jobs-torque | |
# IMPORTANT: the next line determines how many nodes to run on | |
# nodes is number of nodes, ppn= processors (cores) per node | |
# | |
#PBS -l nodes=2:ppn=32 | |
# | |
# Make sure that we are in the same subdirectory as where the qsub command | |
# is issued. | |
# | |
cd $PBS_O_WORKDIR | |
source /etc/profile.d/modules.sh | |
module load intel/intel-mpi-5.0.3 | |
# | |
# make a list of allocated nodes(cores) | |
# Note that if multiple jobs run in same directory, use different names | |
# for example, add on jobid nmber. | |
cat $PBS_NODEFILE > hostfile | |
# How many cores total do we have? | |
NO_OF_CORES=`cat hostfile | egrep -v '^#'\|'^$' | wc -l | awk '{print $1}'` | |
NODE_LIST=`cat hostfile | sort | uniq ` | |
# | |
# Just for kicks, see which nodes we got. | |
# Just for kicks, see which nodes we got. | |
echo "Nodes: $NODE_LIST" | |
echo "Cores: $NO_OF_CORES" | |
# | |
# Run the executable. *DO NOT PUT* a '&' at the end!! | |
# | |
mpirun -np $NO_OF_CORES -machinefile ./hostfile ./myprog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment