#!/bin/bash
#$ -cwd          #
#$ -V            #
#$ -pe mpi16 96  # Request 96 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 MPI/multithread hybrid programs.

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

# Configuration for the pairwise alignment stage:
export  MAFFT_N_THREADS_PER_PROCESS=8
export  MAFFT_MPIRUN="mpirun -n 12"
# 8 threads per process x 12 processes = 96 threads
# Add environment-specific options, such as -perhost 2 -binding none

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