#!/bin/bash
#$ -cwd          #
#$ -V            #
#$ -pe mpi16 160 # Request 160 cores in a parallel environment (PE) named "mpi16". 
                 # Suppose that 16 cores in each node are assigned in this PE.
                 # Ask sys admin if an appropriate PE is available 
                 # for such a purpose.

# Configure MPI as necessary.
#. /foo/bar/mpivars.sh

# Configuration for the pairwise alignment stage:
export  MAFFT_N_THREADS_PER_PROCESS=1
export  MAFFT_MPIRUN="mpirun -n 160"
# 1 thread per process x 16 processes = 16 threads run on each node.
# Add environment-specific options, such as -perhost 16 -binding none

# Configuration for progressive alignment stage:
/somewhere/bin/mafft --mpi --large --globalpair --thread 16 input > output
# 8 threads run on one of the machines assigned by scheduler.
# --globalpair can be replaced by --genafpair, --localpair, --oldgenafpair
