Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-27 09:18:17

0001 #!/usr/bin/env bash
0002 #
0003 #############################################################################################################################
0004 #####               This is an example of slurm file to  submit a job to execute dsbandrepair on cluster                #####
0005 ##### In this example, each node on cluster has memory of 31 Gb. And there are 16 cpus per node. In phycal stage, the   #####
0006 ##### parallel proceeses running on each node (buy setting num_ranks_pernode) is sett based the memory required to hold #####
0007 ##### geometry. For instance, with geometry set provided along this dsbandrepair, fbroblast and endothelium needs~4.5Gb,#####
0008 #####  while yeast need ~4.5Gb and ~1.2GB respectively. Therefore, with a node of 31Gb memory, num_ranks_pernodeP       #####
0009 ##### can be set to 6 for fiborblast and endothelium, and 16 for yeast. For chemical stage, it is better to set the     #####    
0010 ##### number of chemical proceses on each node equal to the number of cpus. User should edit this file according to     #####
0011 ##### their need.                                                                                                       #####
0012 #############################################################################################################################
0013 ##--------------------------------------------------------------------------------------------------------------------------##
0014 #SBATCH --job-name="dsbandrepair"
0015 #SBATCH --partition=std
0016 #SBATCH --exclusive
0017 #SBATCH --nodes=5  
0018 ##SBATCH --mem=190Gb 
0019 ##SBATCH --nodelist=node118
0020 num_ranks_pernodeP=6 ## Number of Physical processes on each node. 
0021 num_ranks_pernodeC=16  ## Number of chemical processes on all nodes. should be 1 cpu for 1 process
0022 ## You can change above setting for your need.
0023 ##--------------------------------------------------------------------------------------------------------------------------##
0024 ## for physical stage:
0025 totalnumRankP=$(( $num_ranks_pernodeP*$SLURM_NNODES ))
0026 ## for chemicall stage:
0027 totalnumRankC=$(( $num_ranks_pernodeC*$SLURM_NNODES ))
0028 ##--------------------------------------------------------------------------------------------------------------------------##
0029 #" Check some requried files && folders
0030 physmacfile="dsbandrepair.in"  #change it if you use other files for default
0031 chemmacfile="chem.in" #change it if you use other files for default
0032 flag="all"
0033 ##Read input arguments
0034 for i in "$@"
0035 do
0036     if [ $i = "-f" ] ;then shift;unset flag;flag=$1;shift;fi
0037     if [ $i = "-mP" ] ; then shift;unset physmacfile; physmacfile=$1;shift;fi
0038     if [ $i = "-mC" ] ; then shift;unset chemmacfile; chemmacfile=$1;shift;fi
0039 done
0040 ##--------------------------------------------------------------------------------------------------------------------------##
0041 
0042 
0043 logfolder="logs"
0044 inputfolder="chem_input"
0045 outputfolder="chem_output"
0046 if [ ! -d $logfolder ]; then 
0047 # folder to contain logfiles
0048     mkdir "$logfolder"
0049     mkdir "$logfolder/phys"
0050     mkdir "$logfolder/chem"
0051 fi  
0052 ##--------------------------------------------------------------------------------------------------------------------------##
0053 #START_TIME=$SECONDS
0054 ##--------------------------------------------------------------------------------------------------------------------------##
0055 ##If $flag = "phys", then run the physStage part
0056 if [ $flag = "phys" ] || [ $flag = "all" ]; then          
0057     echo "Start running physical stage................."
0058     echo "This job will run with: "
0059     echo "=====> Number of nodes: $SLURM_NNODES"
0060     echo "=====> Number of Ranks: $numRanks"   
0061     mpiexec -np $totalnumRankP -npernode $num_ranks_pernodeP ./dsbandrepair $physmacfile 
0062     wait
0063     echo "End running physical stage................."
0064 fi
0065 ##--------------------------------------------------------------------------------------------------------------------------##
0066 ##If $flag = "chem", then run the chemStage part
0067 wait # make sure all above processes finish before chemStage starts
0068 #sleep 1s
0069 if [ $flag = "chem" ] || [ $flag = "all" ]; then
0070     if [ -d $logfolder/chem ]; then find $logfolder/chem/ -type f -delete;fi
0071     if [ -d $outputfolder ]; then
0072     find $outputfolder/ -type f -delete
0073     else
0074     mkdir $outputFolder
0075     fi
0076     echo "Start running chemical stage................."
0077     echo "with number of $totalnumRankC tasks.!!"
0078     echo "See $logfolder/* for running details"
0079     mpiexec -np $totalnumRankC ./dsbandrepair $chemmacfile chem $inputFolder > $logfolder/chem/log.dat
0080     wait
0081     echo "End running chemical stage on all tasks  ................."
0082 fi
0083 ##--------------------------------------------------------------------------------------------------------------------------##
0084 #echo "Elasped timed for $flag stage: $(($SECONDS - $START_TIME)) sec!!!"
0085 ##--------------------------------------------------------------------------------------------------------------------------##