Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-14 08:06:15

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 if [ ! -d $logfolder ]; then 
0046 # folder to contain logfiles
0047     mkdir "$logfolder"
0048     mkdir "$logfolder/phys"
0049     mkdir "$logfolder/chem"
0050 fi  
0051 ##--------------------------------------------------------------------------------------------------------------------------##
0052 #START_TIME=$SECONDS
0053 ##--------------------------------------------------------------------------------------------------------------------------##
0054 ##If $flag = "phys", then run the physStage part
0055 if [ $flag = "phys" ] || [ $flag = "all" ]; then          
0056     echo "Start running physical stage................."
0057     echo "This job will run with: "
0058     echo "=====> Number of nodes: $SLURM_NNODES"
0059     echo "=====> Number of Ranks: $numRanks"   
0060     mpiexec -np $totalnumRankP -npernode $num_ranks_pernodeP ./dsbandrepair $physmacfile 
0061     wait
0062     echo "End running physical stage................."
0063 fi
0064 ##--------------------------------------------------------------------------------------------------------------------------##
0065 ##If $flag = "chem", then run the chemStage part
0066 wait # make sure all above processes finish before chemStage starts
0067 #sleep 1s
0068 if [ $flag = "chem" ] || [ $flag = "all" ]; then
0069     if [ -d $logfolder/chem ]; then find $logfolder/chem/ -type f -delete;fi
0070     echo "Start running chemical stage................."
0071     echo "with number of $totalnumRankC tasks.!!"
0072     echo "See $logfolder/* for running details"
0073     mpiexec -np $totalnumRankC ./dsbandrepair $chemmacfile chem $inputFolder > $logfolder/chem/log.dat
0074     wait
0075     echo "End running chemical stage on all tasks  ................."
0076 fi
0077 ##--------------------------------------------------------------------------------------------------------------------------##
0078 #echo "Elasped timed for $flag stage: $(($SECONDS - $START_TIME)) sec!!!"
0079 ##--------------------------------------------------------------------------------------------------------------------------##