1#!/bin/bash
2#
3#$ -pe mpi 2
4#$ -cwd
5#$ -j y
6#$ -S /bin/bash
7#$ -V
8#
9echo "This job executes in: "
10cat $TMPDIR/machines
11#
12HOST=`hostname`
13echo Local MPD console on $HOST
14#
15# Make a list of unique host names
16#
17grep -v $HOST $TMPDIR/machines | sort | uniq  > mpd.hosts
18NODES=`wc mpd.hosts | awk '{print $1}'`
19#
20# Boot the MPI2 engine.
21#
22mpdboot --rsh=ssh --totalnum=$NODES --file=mpd.hosts
23sleep 10
24#
25# Inspect if all MPI nodes have been activated.
26#
27mpdtrace -l
28#
29# Check the connectivity.
30#
31mpdringtest 100
32#
33# Check if you can run trivial non-MPI jobs.
34#
35mpdrun -l -n $NSLOTS hostname
36#
37# Execute your MPI program.
38#
39prog_default="../../../Src/siesta"
40prog=${SIESTA:-${prog_default}}
41#
42make SIESTA="mpiexec -n $NSLOTS $prog"
43#
44# Shut down the MPI2 engine and exit the script.
45#
46echo "shutting down mpd..."
47mpdallexit
48exit 0
49