Skip to content
Snippets Groups Projects
Commit 4278dc68 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Make output logging work in the Python testsuite

By using the same mechanism as in the shell script:  piping everything through
the 'tee' program.  This may not be the most elegant way from a Python standpoint,
but it seems to work.

Since now my Python testsuite seems to do everything the shell version did,
this commit also removes the shell version.
parent 06b9baee
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -14,9 +14,11 @@ for order in range(1,4):
## run the actual simulation
executable = "./harmonicmaps-" + str(order)
p = subprocess.Popen([executable, "harmonicmaps-skyrmions-hexagon.parset", "-numLevels", str(numLevels)])
#p = subprocess.Popen([executable, "harmonicmaps-skyrmions-hexagon.parset", "-numLevels", str(numLevels)])
p = subprocess.Popen(executable + " harmonicmaps-skyrmions-hexagon.parset -numLevels " + str(numLevels) + " | tee " + LOGFILE, shell=True)
processList.append(p)
# Wait for all simulation subprocesses before proceeding to the error measurement step
exit_codes = [p.wait() for p in processList]
subprocess.call(["echo", "Now measuring errors"])
......@@ -26,11 +28,18 @@ for order in range(1,4):
# Measure the discretization errors against the solution on the finest grid
LOGFILE = "./compute-disc-error_" + str(order) + "_" + str(numLevels) + ".log"
subprocess.Popen(["../build-cmake/src/compute-disc-error", "compute-disc-error-skyrmions-hexagon.parset",
"-order", str(order),
"-numLevels", str(numLevels),
"-numReferenceLevels", str(maxLevel),
"-simulationData", "harmonicmaps-result-" + str(order) + "-" + str(numLevels) + ".data",
"-referenceData", "harmonicmaps-result-" + str(order) + "-" + str(maxLevel) + ".data"])
#subprocess.Popen(["../build-cmake/src/compute-disc-error", "compute-disc-error-skyrmions-hexagon.parset",
#"-order", str(order),
#"-numLevels", str(numLevels),
#"-numReferenceLevels", str(maxLevel),
#"-simulationData", "harmonicmaps-result-" + str(order) + "-" + str(numLevels) + ".data",
#"-referenceData", "harmonicmaps-result-" + str(order) + "-" + str(maxLevel) + ".data"])
subprocess.Popen("../build-cmake/src/compute-disc-error compute-disc-error-skyrmions-hexagon.parset"
+ " -order " + str(order)
+ " -numLevels " + str(numLevels)
+ " -numReferenceLevels " + str(maxLevel)
+ " -simulationData harmonicmaps-result-" + str(order) + "-" + str(numLevels) + ".data"
+ " -referenceData harmonicmaps-result-" + str(order) + "-" + str(maxLevel) + ".data"
+ " | tee " + LOGFILE, shell=True)
#!/bin/bash
set -e
runComputation(){
numLevels=$1
order=$2
LOGFILE="./harmonicmaps_${order}_${numLevels}.log"
# run the actual simulation
./harmonicmaps-${order} harmonicmaps-skyrmions-hexagon.parset -numLevels ${numLevels} | tee ${LOGFILE}
}
MAXPROCS=1
order=1
numReferenceLevels=10
for numLevels in $(seq 5 ${numReferenceLevels}); do
# Do one simulation run
runComputation $numLevels ${order}
# Measure the discretization errors against the solution on the finest grid
LOGFILE="./compute-disc-error_${order}_${numLevels}.log"
../build-cmake/src/compute-disc-error compute-disc-error-skyrmions-hexagon.parset \
-order ${order} \
-numLevels ${numLevels} \
-numReferenceLevels ${numReferenceLevels} \
-simulationData harmonicmaps-result-${order}-${numLevels}.data \
-referenceData harmonicmaps-result-${order}-${numReferenceLevels}.data | tee ${LOGFILE}
done
order=2
numReferenceLevels=9
for numLevels in $(seq 4 ${numReferenceLevels}); do
# Do one simulation run
runComputation $numLevels $order
# Measure the discretization errors against the solution on the finest grid
LOGFILE="./compute-disc-error_${order}_${numLevels}.log"
../build-cmake/src/compute-disc-error compute-disc-error-skyrmions-hexagon.parset \
-order ${order} \
-numLevels ${numLevels} \
-numReferenceLevels ${numReferenceLevels} \
-simulationData harmonicmaps-result-${order}-${numLevels}.data \
-referenceData harmonicmaps-result-${order}-${numReferenceLevels}.data | tee ${LOGFILE}
done
order=3
numReferenceLevels=8
for numLevels in $(seq 3 $numReferenceLevels); do
# Do one simulation run
runComputation $numLevels $order
# Measure the discretization errors against the solution on the finest grid
LOGFILE="./compute-disc-error_${order}_${numLevels}.log"
../build-cmake/src/compute-disc-error compute-disc-error-skyrmions-hexagon.parset \
-order ${order} \
-numLevels ${numLevels} \
-numReferenceLevels ${numReferenceLevels} \
-simulationData harmonicmaps-result-${order}-${numLevels}.data \
-referenceData harmonicmaps-result-${order}-${numReferenceLevels}.data | tee ${LOGFILE}
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment