Rungen: Difference between revisions

From Wiki
Jump to navigation Jump to search
Rgarcia (talk | contribs)
Rgarcia (talk | contribs)
mNo edit summary
Line 11: Line 11:
*This script has a security control to avoid sending a calculation with the wrong number of processors.
*This script has a security control to avoid sending a calculation with the wrong number of processors.
*Please verify the default version of VASP that you want to use on each queue.
*Please verify the default version of VASP that you want to use on each queue.
*By default I use Infiniband in the c12m28ib queue, with 24 or more processors.
*I put another security control, named [[savecalc]] that is run before VASP, in case you need to do a long optimization.
*I put another security control, named [[savecalc]] that is run before VASP, in case you need to do a long optimization.



Revision as of 16:09, 21 May 2013

go back to Main Page, Group Pages, Núria López and Group, Scripts_for_VASP

Instructions: 1) Put this script as executable on your ~/bin/ folder (recomended name: rungen). 2) Put your email instead of youremail@iciq.es. 3) To use it, write on a terminal:

$ rungen <<name_of_job>> <<queue>> <<number_of_processors>> <<vasp_version>> 

Notes:

  • <<name_of_job>> should start with a letter, not a number or another special character.
  • Queues c (or c0) and q (or q0) are part of tekla.
  • Queues 4 8 and 12 are interpreted as c4m8... etc, on tekla2.
  • Queues 16a 16b and 16c are interpreted as class_a, class_b and class_c on MareNostrum.
  • This script has a security control to avoid sending a calculation with the wrong number of processors.
  • Please verify the default version of VASP that you want to use on each queue.
  • By default I use Infiniband in the c12m28ib queue, with 24 or more processors.
  • I put another security control, named savecalc that is run before VASP, in case you need to do a long optimization.


rungen

#!/bin/bash 

##########################################
# Rodrigo García-Muelas @ iciq-Tgn       #
# Created: Jan 11, 2013                  #
# Edit 1 : Apr 06, 2013                  #
##########################################

# Input ##################################   
# 1 # name of job                        #
# 2 # queue id                           #
# 3 # number of processors               #
# 4 # version of VASP (optional)         #
##########################################

# To run in local, write on command line: mpirun -np 2 vasp                                       

# tekla1, tekla2 or marenostrum ##########
tk1=0 ; tk2=0 ; mar=0
case $2 in
 c|c0) queue=c0       ; tk1=1 ; procqueue=1  ;;
 q|q0) queue=q0       ; tk1=1 ; procqueue=4  ;;
 4)    queue=c4m8     ; tk2=1 ; procqueue=4  ;;
 8)    queue=c8m24    ; tk2=1 ; procqueue=8  ;;
 12)   queue=c12m48ib ; tk2=1 ; procqueue=12 ;;
 16a)  queue=class_a  ; mar=1 ; procqueue=16 ; maxhours=47 ;;
 16b)  queue=class_b  ; mar=1 ; procqueue=16 ; maxhours=23 ;;  
 16c)  queue=class_c  ; mar=1 ; procqueue=16 ; maxhours=23 ;; 
 *)    echo "Error in queue name!!! " ; exit ;;
esac

# Before generating the run.sh file, see if the number of processors is correct
# MOD should be 0 ########################
let AAA=`expr $3 % $procqueue`
#echo $AAA
if [ 0 -ne $AAA ] ; then echo "Error in number of processors" ;  exit ; fi
##########################################

# version 

if [ -z $4 ] ; then
  if   [ $mar = 1 ] ; then vaspversion="5.3.3"
  elif [  $2 =  4 ] ; then vaspversion="5.3.3"
  elif [  $2 =  8 ] ; then vaspversion="5.3.3"
  elif [  $2 = 12 ] ; then if [ $3 -gt 12 ] ; then vaspversion="5.3.3-IB" ; else vaspversion="5.3.3" ; fi
  elif [ $tk1 = 1 ] ; then vaspversion="4.6" ; fi
else vaspversion=$4 ; fi 


##########################################


# queues of tekla1 #######################
if [ $tk1 = 1 ] ; then mpi=_mpi ; 
E=`pwd`; ofile=`echo $E/o_\\$JOB_NAME.\\$JOB_ID` ; efile=`echo $E/e_\\$JOB_NAME.\\$JOB_ID` ; 
cat >run.sh<<!
#!/bin/bash

#$ -N $1

#   pe request
#$ -pe $queue $3
#$ -M youremail@iciq.es
#$ -o $ofile
#$ -e $efile 

cd $E ; /home/rgarcia/bin/savecalc   
/usr/bin/mpirun -np $3 -machinefile \$TMPDIR/machines /usr/local/bin/vasp ; rm CHG 

!
fi
##########################################


# queues of tekla2 #######################
if [ $tk2 = 1 ] ; then mpi=_mpi ; cat >run.sh<<!
#!/bin/bash
#  - Dr. Nuria Lopez Group -
##########################################
# SGE Parameters
##########################################
#$ -S /bin/bash
#$ -N $1
#$ -cwd
#$ -masterq $queue.q
#$ -pe $queue$mpi $3
#$ -m ae
#$ -M youremail@iciq.es
#$ -o o_\$JOB_NAME.\$JOB_ID
#$ -e e_\$JOB_NAME.\$JOB_ID
##########################################
# Load Evironment Variables
##########################################
. /etc/profile.d/modules.sh
module load vasp/$vaspversion
##########################################
# Running Job
##########################################
export OMP_NUM_THREADS=1 

echo \$PWD >> o_\$JOB_NAME.\$JOB_ID
echo \$TMP >> o_\$JOB_NAME.\$JOB_ID

savecalc ; mpirun -np \$NSLOTS vasp ; rm CHG 

!
fi
##########################################


# queues of Marenostrum ##################
if [ $mar = 1 ] ; then cat >run.sh<<!
#!/bin/bash
#BSUB -J $1
#BSUB -q $queue 
#BSUB -n $3 
#BSUB -W $maxhours:59
#BSUB -o o_$1.%J
#BSUB -e e_$1.%J
#BSUB -u youremail@iciq.es
#BSUB -R"span[ptile=16]"

### Load environment variables ###########
module load VASP/$vaspversion 

### Run job ##############################
savecalc ; mpirun vasp.complex ; rm CHG 

!
fi
 
# End of script ##########################