Commit b8deabc2 authored by Aggelos Giantsios's avatar Aggelos Giantsios

Write output also to file

parent 510f8e9f
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import subprocess, time from __future__ import print_function
import sys, subprocess, time
f = open('par.log', 'a+')
def print_all(s):
print (s, file=f)
f.flush()
print (s, file=sys.stdout)
reps = 1 reps = 1
versions = ["short", "intermediate", "long"] versions = ["short", "intermediate", "long"]
...@@ -10,27 +17,27 @@ cores = [1,2,4] ...@@ -10,27 +17,27 @@ cores = [1,2,4]
workersPerCore = 1 workersPerCore = 1
node = {"host": "127.0.0.1", "port": 5050} node = {"host": "127.0.0.1", "port": 5050}
print "Parallel Orbit" print_all("Parallel Orbit")
print "----------------------------------------------------------------------" print_all("----------------------------------------------------------------------")
print "Versions: %s" % versions print_all("Versions: %s" % versions)
print "Parallel Image Computation: %s" % iwps print_all("Parallel Image Computation: %s" % iwps)
print "Repetitions per Configuration: %s" % reps print_all("Repetitions per Configuration: %s" % reps)
print "Using Cores: %s" % cores print_all("Using Cores: %s" % cores)
print "Workers Per Core: %s" % workersPerCore print_all("Workers Per Core: %s" % workersPerCore)
print "Node @ %s" % node print_all("Node @ %s" % node)
print "======================================================================" print_all("======================================================================")
for iwp in iwps: for iwp in iwps:
for vsn in versions: for vsn in versions:
for core in cores: for core in cores:
for rep in range(reps): for rep in range(reps):
workers = workersPerCore * core workers = workersPerCore * core
print "Version: %s, IWP: %s, Cores: %s, Workers: %s, Execution: %s" % (vsn, iwp, core, workers, rep) print_all("Version: %s, IWP: %s, Cores: %s, Workers: %s, Execution: %s" % (vsn, iwp, core, workers, rep))
t1 = time.time() t1 = time.time()
cmd = "./orbit +RTS -N%s -RTS par %s %s %s %s %s > /dev/null" % (core, iwp, vsn, workers, node["host"], node["port"]) cmd = "./orbit +RTS -N%s -RTS par %s %s %s %s %s > /dev/null" % (core, iwp, vsn, workers, node["host"], node["port"])
p = subprocess.Popen(cmd, shell=True) p = subprocess.Popen(cmd, shell=True)
p.wait() p.wait()
t2 = time.time() t2 = time.time()
print " %s sec(s)" % (t2 - t1) print_all(" %s sec(s)" % (t2 - t1))
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import subprocess, time from __future__ import print_function
import sys, subprocess, time
f = open('seq.log', 'a+')
def print_all(s):
print (s, file=f)
f.flush()
print (s, file=sys.stdout)
reps = 1 reps = 1
versions = ["short", "intermediate", "long"] versions = ["short", "intermediate", "long"]
node = {"host": "127.0.0.1", "port": 5050} node = {"host": "127.0.0.1", "port": 5050}
print "Sequential Orbit" print_all("Sequential Orbit")
print "----------------------------------------------------------------------" print_all("----------------------------------------------------------------------")
print "Versions: %s" % versions print_all("Versions: %s" % versions)
print "Repetitions per Configuration: %s" % reps print_all("Repetitions per Configuration: %s" % reps)
print "Node @ %s" % node print_all("Node @ %s" % node)
print "======================================================================" print_all("======================================================================")
for vsn in versions: for vsn in versions:
for rep in range(reps): for rep in range(reps):
print "Version: %s, Execution: %s" % (vsn, rep) print_all("Version: %s, Execution: %s" % (vsn, rep))
t1 = time.time() t1 = time.time()
cmd = "./orbit seq %s %s %s > /dev/null" % (vsn, node["host"], node["port"]) cmd = "./orbit seq %s %s %s > /dev/null" % (vsn, node["host"], node["port"])
p = subprocess.Popen(cmd, shell=True) p = subprocess.Popen(cmd, shell=True)
p.wait() p.wait()
t2 = time.time() t2 = time.time()
print " %s sec(s)" % (t2 - t1) print_all(" %s sec(s)" % (t2 - t1))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment