A very useful shell script for parallel executions ofEnergyPlus on a Windows system, with the command-line Git-Bash (!)
#!/bin/bash ################################################################## #_______ ______ _______ _______ #| _ || _ | | || | #| |_| || | || | ___|| _ | #| || |_||_ | |___ | |_| | #| || __ || ___|| ___| #| _ || | | || |___ | | #|__| |__||___| |_||_______||___| # ################################################################## # ce script en bash lance energypus en parallele #(tout est dans le "&" esperluette) # ################################################################## # Last modification : 01/04/2018 # ################################################################## # Copyright (C) 2018 Alexis SAUVAGEON # # This program is free software; you can redistribute it and/or # # modify it under the terms of the GNU General Public License # # as published by the Free Software Foundation; either version # # of the License, or (at your option) any later version. # ################################################################## # Contact : alexis[dot]sauvageon[at]arep[dot]com ################################################################## cd ${0%/*} || exit 1 # un peu de magie au debut (tire de openfoam) # define nbr cpus ncpus=$1 ncpus=30 if [ -z "${1}" ]; then ncpus=30 fi # pour tout fichier "f" dans le dossier courant "*/" for f in Trajectoire*/ do # faire : echo '----- lancement energyplus pour ' $f \n # ecrire qu'on commence avec le fichier "f" # lancer energyplus (meme cmd que dans python) g=${f::-1} # j'enleve le "/" final pour eviter sa redondance dans la ligne suivante avec celui de "/Simulation_*.idf" # on execute E+ pour tous les dossiers au meme niveau que le script : # > IDF de chaque dossier # > EPW au meme niveau que le script exec C:/EnergyPlusV8-3-0/energyplus.exe -d $f -w ./in.epw $g/Simulation_*.idf & # > on check si E+ tourne et on l'affiche dans le terminal process=$(ps cax | grep energyplus) if [ $? -eq 0 ]; then echo "Process is running." else echo "Process is not running." fi # > on compte le nombre de processus actif E+ numproc=$(ps -ef | grep -v grep | grep energyplus | wc -l) # > tant que nbr E+ actif > ncpu autorise, on attend et on met a jour numproc while [[ $numproc -ge $ncpus ]] do sleep 5 numproc=$(ps -ef | grep -v grep | grep energyplus | wc -l) echo $numproc done done