#!/bin/bash # # HMMER runtime environment script for Nordugrid ARC # # Runtime environment scripts are called (bash source) # from NorduGrid ARC with argument 0,1 or 2. # First call with argument "0" is made before the the batch # job submission script is written. # Second call is made with argument "1" just prior to execution of the # user specified executable. # Third "clean-up" call is made with argument "2" after the user # specified executable has returned. # # author: Olli Tourunen # # internal variable for setting the number of threads num_threads=2 # shared directory for application installation application_base_path=/home/opt/ case "$1" in 0 ) # Here we can reserve a whole node (with $num_thread cores) for running HMMer threaded. # This can be done for example by reserving memory worth of one node, if no # more elegant ways are available. # The reservation is done below by using a parallel environment 'threaded' # Requires ARC with new SGE backend (0.6.1 or newer) if [ "xxx$CONFIG_sge_jobopts" = "xxx" ]; then CONFIG_sge_jobopts="-pe threaded $num_threads" else CONFIG_sge_jobopts="$CONFIG_sge_jobopts -pe threaded $num_threads" fi # Append a stack option to the SGE job script needed for running threaded. if [ "xxx$CONFIG_sge_jobopts" = "xxx" ]; then CONFIG_sge_jobopts="-l h_stack=10M" else CONFIG_sge_jobopts="$CONFIG_sge_jobopts -l h_stack=10M" fi ;; 1 ) # no TMPDIR set up by PBS? Create one here and clean it up in stage 2 #export TMPDIR=`mktemp -d -p /scratch` # include HMMer binaries in the path export PATH=$PATH:$application_base_path/hmmer/3.0/bin # set the number of threads used by HMMer # NOTE: if HMMER_NCPU is not set, HMMer will run on all CPUs on the node, # so set this even if you intend to allow serial jobs only! export HMMER_NCPU=$num_threads # create the database directory to local scratch if [ ! -d $TMPDIR/database ]; then mkdir $TMPDIR/database if [ $? != 0 ]; then echo "ERROR: Can't create database directory!" 1>&2 ; exit 1; fi fi # export the database directory location export HMMER_DB_DIR=$TMPDIR/database ;; 2 ) # Nothing here ;; * ) # Now, calling argument is wrong or missing. # If call was made from NorduGrid ARC, it is considered # an error. If this script is to be used also to initialize # MPI environment for local jobs in cluster, raising error here # could be improper. return 1 ;; esac