-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstantiate.py
More file actions
54 lines (52 loc) · 1.66 KB
/
instantiate.py
File metadata and controls
54 lines (52 loc) · 1.66 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
49
50
51
52
53
54
#!/usr/bin/python
"""
Experiment manager Library for EURACE
Author: Mehmet Gencer, mgencer@cs.bilgi.edu.tr
Bulent Ozel, bulent.ozel@gmail.com, Reykjavik University
"""
import sys,pickle,getopt
from poplib import *
if __name__=="__main__":
try:
setDebugValue(0)
except:setDebug(0)
optlist, args = getopt.getopt(sys.argv[1:],"rg")
for o in optlist:
o,v=o
if o=="-r":
setReplaceId()
print "USING '",getReplaceId(), "' AS ID PREFIX"
if o=="-g":
setRegionReplaceId()
print "USING '",getRegionReplaceId(), "' AS ID PREFIX"
try:
popfile=args[0]
zerofile=args[1]
except:
print "usage:\n %s [-rg] popfile 0.xml"%sys.argv[0]
print "OPTIONS: \n -r : Prefix IDs with replacement markers"
print "OPTIONS: \n -g : Prefix region IDs with string 'REPLACE_REGIONID_'"
sys.exit()
try:
numthreads=int(sys.argv[3])
print "WILL USE NUMBER OF THREADS:",numthreads
except:
try:
if MULTIPROC:
import multiprocessing
numthreads=multiprocessing.cpu_count()
else:
numthreads=0
except:
numthreads=0
pop=pickle.load(open(popfile,"rb"))
globalSetNumRegions(pop.numregions)
global popguinumregions
popguinumregions=pop.numregions
print "popguinumregions",popguinumregions
#try:
# pop.instantiateMEMEFF(open(zerofile,"w"),numthreads=numthreads)
#except:
# pop.instantiate(open(zerofile,"w"))
pop.instantiate(open(zerofile,"w"))
print "POPULATION IS INSTANTIATED SUCCESSFULLY IN ",zerofile