Hallo zusammen,
ich entwickel gerade eine Prozesskettensimulation unter Verwendung von DAKOTA (Optimierer). In einem run.sh Skript starte ich ein paar Dinge und letzten Endes wird folgendes aufgerufen (wichtig ist die erste Zeile, da hier DAKOTA als Hintergrundprozess gestartet wird. Alles was danach kommt, ist lediglich eine Prüfung ob der Prozess noch läuft um eine Ausgabe der derzeitigen Optimierungssimulation zu erhalten – geht sicherlich auch besser aber so ist derzeit meine Lösung:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | dakota -i $dakotaInputFile -o $dakotaOutputFile > $optimizationLogFile & # Check if DAKOTA option for graphic output is set # + check this with pstree | other option would be nicer with checking # the dakotaDict if the option is set or unset # + if the option is set, we have two processes if not we have one # this is important for quitting the loop at least #---------------------------------------------------------------------- dakotaGrapics=`pstree $! | grep -c '{dakota}'` if [ $dakotaGrapics -eq 1 ]; then i=2 else i=1 fi # Output the results of the optimization loop # + if DAKOTA is finished, then cancel the infty while loop # + to check out if DAKOTA is finished we use the variable >i< #---------------------------------------------------------------------- oldLoop_=0 while [ $i -eq `pstree $! | grep -c 'dakota'` ] do # Get the number of the actual optimization loop with the dumy file #------------------------------------------------------------------ actualLoop=`cat .optimizationLoop` remelted_=`cat .remelted | cut -d' ' -f2` # If there is a new loop proceeding, output the last results #------------------------------------------------------------------ if [ $actualLoop -gt $oldLoop_ ] && [ `cat .remelted` -eq 0 ] then echo -n " *** Optimization Loop #$actualLoop..." oldLoop_=$actualLoop elif [ $actualLoop -gt $oldLoop_ ] && [ `cat .remelted` -eq 1 ] then echo " *** Optimization Loop #$actualLoop... remelting, stop" oldLoop_=$actualLoop echo "0" > .remelted fi # Sleep for x seconds till recheck again #------------------------------------------------------------------ sleep $dakotaOutputTime done echo -e "\n" # Exit the while loop if the pstree shows no DAKOTA activity anymore #---------------------------------------------------------------------- break fi done |
Starte ich jetzt das Skript erhalte ich in einem x-beliebigen Terminal folgende Ausgabe wenn ich prüfe ob DAKOTA läuft:
1 2 | shorty@toolbox: pstree | grep dakota | | | |-gnome-terminal-+-bash---run.sh-+-dakota---dakota.sh-+-6*[mcc] |
Nach einer unbestimmten Anzahl von Loops, bricht das Programm einfach ab. Allerdings weiß ich nicht
warum es abbricht
wieso es sich in sleep Mode begibt
Eine erneute Prüfung in einem Terminal ergibt:
1 2 | shorty@toolbox: pstree | grep dakota | | | |-dakota---dakota.sh---sleep |
Das passiert mir ständig wenn ich die Simulation über nach laufen lasse. Ich habe hier aber keine Erklärung.
Ggf. ist diese Information noch wichtig. Dakota selbst führt eine weiteres Bash-Skript aus, dass dann wieder andere Programme (bspw. OpenFOAM etc) aufruft. Sobald das aufgerufene Bash-Skript zuende ist, wertet Dakota die Ergebnisse aus, ändert Parameter und startet erneut. Die Fragen die sich mir stellen:
ist es möglich irgendwie nach zu vollziehen warum das in den sleep Modus geht
hat irgendwer eine Idee warum das passierten könnte?
Grüße Tobi