source: branches/reconfiguration/platforms/tsar_generic_iob/scripts/run.py @ 778

Last change on this file since 778 was 778, checked in by cfuguet, 10 years ago

reconfiguration/tsar_generic_iob: fixing python version incompatibility issues

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#!/usr/bin/python
2# @date   25 August, 2014
3# @author cfuguet <cesar.fuguet-tortolero@lip6.fr>
4
5import sys
6import os
7import subprocess
8import arch
9import faultyprocs
10
11# define constants
12configs = []
13configs.append([2 ,2 ])
14configs.append([4 ,4 ])
15configs.append([8 ,8 ])
16configs.append([16,16])
17
18faultylist = [[(0,0,1), (0,1,1), (1,0,1), (1,0,2), (1,0,3), (1,1,1), (1,1,3)]]
19
20nprocs = 4
21
22assert len(sys.argv) > 1, "Introduce platform base directory path"
23
24# translate the relative path (if needed) into an absolute path
25basedir = os.path.abspath(sys.argv[1])
26print "[ run.py ] platform base directory: {0}".format(basedir)
27
28# repeat while configurations is not empty
29for faulty in faultylist:
30    for x,y in configs:
31        confdir = "{0}/conf/config_{1}c".format(basedir, x*y)
32        print "[ run.py ] generating files for {0}".format(confdir)
33
34        # 1. generate configuration and ouput directories
35        try:
36            os.makedirs(confdir + "/config", 0755)
37        except OSError:
38            pass # directory already exists => do nothing
39
40        # 2. generate hard_config.h and fault_config.h files
41        arch.main( x = x, y = y, p = nprocs,
42                   hard_path = confdir + "/config/hard_config.h",
43                   xml_path = confdir + "/config/map.xml" )
44        faultyprocs.generate(faulty, confdir + "/config/fault_config.h")
45
46        # 3. compile simulator executable
47        dst = basedir + "/hard_config.h"
48        if os.path.lexists(dst): os.unlink(dst)
49        os.symlink(confdir + "/config/hard_config.h", dst)
50        subprocess.call(["make",
51            "-C", basedir
52            ])
53
54        # 4. compile distributed boot executable
55        dst = confdir + "/config/boot_config.h"
56        if os.path.lexists(dst): os.unlink(dst)
57        os.symlink(basedir + "/soft/config/boot_config.h", dst)
58        subprocess.call(["make",
59            "-C", basedir + "/soft",
60            "CONFDIR=" + confdir
61            ])
62
63        # 5. execute simulator
64        os.environ["DISTRIBUTED_BOOT"] = "1"
65        os.environ["SOCLIB_TTY"] = "FILES"
66
67        if x*y <= 4: ompthreads = x*y
68        else:        ompthreads = 4
69        with open(confdir + "/log", "w") as logfile:
70            print "executing simul.x"
71            subprocess.call([basedir + "/simul.x",
72                "-SOFT"   , basedir + "/soft/build/soft.elf",
73                "-DISK"   , "/dev/null",
74                "-THREADS", str(ompthreads),
75                "-NCYCLES", "1000000"],
76                stdout=logfile,
77                stderr=logfile,
78                )
79
80        # 6. move simulation terminal output into the target config dir
81        os.rename("term0", confdir + "/term")
82
83        # end for each config
84    #end for each faulty
85
86# vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracBrowser for help on using the repository browser.