-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathscaling.py
More file actions
50 lines (39 loc) · 1.53 KB
/
scaling.py
File metadata and controls
50 lines (39 loc) · 1.53 KB
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
#!/usr/bin/env python
#
# Very simple script to perform timing measurements on disributed moses.
# Print out the speedup, the parallelizable fraction, and the max speedup.
#
import os
import sys
import time
from datetime import datetime
def toflt(delta):
return float(delta.seconds) + 0.000001 * float(delta.microseconds)
num_to_do = 6
for nodes in range(2,12):
before = datetime.now()
tot_time = before - before
for rseed in range (1,1+num_to_do) :
cmd = "mpirun -n " + str(nodes) + " --hostfile ~/mpd.hosts ./moses/moses/main/moses -Hit -Y1 -u2 -i ./wdbc.data -W1 -x1 -n sin -n log -n exp -Z1 -v12 --hc-max-nn-evals=5000 -r" + str(rseed) + " -j12 -m320000 --mpi=1 -fmspeed.log"
print cmd
# measure wallcock time.
before = datetime.now()
os.system(cmd)
after = datetime.now()
elapsed = after - before
print "seed=", rseed, " elapsed wallclock time: ", elapsed
tot_time += elapsed
sys.stdout.flush()
time.sleep(15)
elapsed = tot_time
bsecs = toflt(elapsed) / num_to_do
if nodes == 2:
baseline = elapsed
print "Baseline time: ", baseline, " seconds=", bsecs
if nodes != 2:
speedup = toflt(baseline) / toflt(elapsed)
parallel = (1.0 - 1.0 / speedup) / (1.0 - 1.0 / float(nodes-1))
maxspeed = 1.0 / (1.0 - parallel)
print "workers=", nodes-1, " elapsed=", bsecs, " speedup=", speedup, " parallelizable fraction=", parallel, " max speedup=", maxspeed
sys.stdout.flush()
time.sleep(15)