-
Notifications
You must be signed in to change notification settings - Fork 0
/
par.py
executable file
·51 lines (44 loc) · 1.57 KB
/
par.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys, subprocess, time
# Path to the file that will hold the results.
fname = 'par.log'
f = open(fname, 'a+')
def print_all(s):
print (s, file=f)
f.flush()
print (s, file=sys.stdout)
# Number of repetitions per configuration.
reps = 1
# List of versions.
versions = ["short", "intermediate", "long"]
# Perform parallel image computations
iwps = [False, True]
# No of cores used
cores = [1,2,4,8,16]
# Ratio of No of workers to No of cores.
workersPerCore = 1
# Host information.
node = {"host": "127.0.0.1", "port": 5050}
print_all("Parallel Orbit")
print_all("----------------------------------------------------------------------")
print_all("Versions: %s" % versions)
print_all("Parallel Image Computation: %s" % iwps)
print_all("Repetitions per Configuration: %s" % reps)
print_all("Using Cores: %s" % cores)
print_all("Workers Per Core: %s" % workersPerCore)
print_all("Node @ %s" % node)
print_all("======================================================================")
for iwp in iwps:
for vsn in versions:
for core in cores:
for rep in range(reps):
workers = workersPerCore * core
print_all("Version: %s, IWP: %s, Cores: %s, Workers: %s, Execution: %s" % (vsn, iwp, core, workers, rep))
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"])
p = subprocess.Popen(cmd, shell=True)
p.wait()
t2 = time.time()
print_all(" %s sec(s)" % (t2 - t1))