Ignore:
Timestamp:
Aug 28, 2014, 6:47:35 PM (10 years ago)
Author:
cfuguet
Message:

reconfiguration/tsar_generic_iob: adding script for plotting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/run.py

    r778 r782  
    88import arch
    99import faultyprocs
     10from parse import parse_ffstend
    1011
    1112# define constants
     13# list of mesh dimensions
    1214configs = []
    13 configs.append([2 ,2 ])
    14 configs.append([4 ,4 ])
    15 configs.append([8 ,8 ])
    16 configs.append([16,16])
     15configs.append([2 , 2 ]) # 4   clusters
     16configs.append([4 , 2 ]) # 8   clusters
     17configs.append([4 , 4 ]) # 16  clusters
     18configs.append([8 , 4 ]) # 32  clusters
     19configs.append([8 , 8 ]) # 64  clusters
     20configs.append([16, 8 ]) # 128 clusters
     21configs.append([16, 16]) # 256 clusters
    1722
    18 faultylist = [[(0,0,1), (0,1,1), (1,0,1), (1,0,2), (1,0,3), (1,1,1), (1,1,3)]]
     23# list of faulty cores
     24faultylist = []
     25faultylist.append([])                           # 0 faulty core
     26faultylist.append([(0,0,1)])                    # 1 faulty core
     27faultylist.append([(0,0,1), (0,0,3)])           # 2 faulty cores
     28faultylist.append([(1,0,0), (1,0,2), (1,0,3)])  # 1 faulty cluster
     29faultylist.append([(1,0,0), (1,0,2), (1,0,3),
     30                   (1,1,1), (1,1,2), (1,1,3)])  # 2 faulty cluster
    1931
     32# number of processors per cluster
    2033nprocs = 4
    2134
     
    2740
    2841# repeat while configurations is not empty
    29 for faulty in faultylist:
     42for f in xrange(len(faultylist)):
    3043    for x,y in configs:
    31         confdir = "{0}/conf/config_{1}c".format(basedir, x*y)
     44        confname = "conf/config_{0}c{1}f".format(x*y, f)
     45        confdir  = os.path.join(basedir, confname)
    3246        print "[ run.py ] generating files for {0}".format(confdir)
    3347
    3448        # 1. generate configuration and ouput directories
    3549        try:
    36             os.makedirs(confdir + "/config", 0755)
     50            os.makedirs(os.path.join(confdir, "config"), 0755)
    3751        except OSError:
    3852            pass # directory already exists => do nothing
    3953
    4054        # 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")
     55        hardpath  = os.path.join(confdir, "config/hard_config.h")
     56        xmlpath   = os.path.join(confdir, "config/map.xml")
     57        faultpath = os.path.join(confdir, "config/fault_config.h")
     58        arch.main( x, y, nprocs, hardpath, xmlpath)
     59        faultyprocs.generate(faultylist[f], faultpath)
    4560
    4661        # 3. compile simulator executable
    47         dst = basedir + "/hard_config.h"
     62        dst = os.path.join(basedir, "hard_config.h")
    4863        if os.path.lexists(dst): os.unlink(dst)
    49         os.symlink(confdir + "/config/hard_config.h", dst)
     64        os.symlink(hardpath, dst)
    5065        subprocess.call(["make",
    5166            "-C", basedir
     
    5368
    5469        # 4. compile distributed boot executable
    55         dst = confdir + "/config/boot_config.h"
     70        dst = os.path.join(confdir, "config/boot_config.h")
    5671        if os.path.lexists(dst): os.unlink(dst)
    57         os.symlink(basedir + "/soft/config/boot_config.h", dst)
     72        os.symlink(os.path.join(basedir, "soft/config/boot_config.h"), dst)
    5873        subprocess.call(["make",
    59             "-C", basedir + "/soft",
     74            "-C", os.path.join(basedir, "soft"),
    6075            "CONFDIR=" + confdir
    6176            ])
     
    6580        os.environ["SOCLIB_TTY"] = "FILES"
    6681
    67         if x*y <= 4: ompthreads = x*y
    68         else:        ompthreads = 4
    69         with open(confdir + "/log", "w") as logfile:
     82        if   x*y <= 4 : ompthreads = x*y
     83        elif x*y <= 16: ompthreads = 4
     84        else:           ompthreads = 8
     85        with open(os.path.join(confdir, "log"), "w") as logfile:
    7086            print "executing simul.x"
    71             subprocess.call([basedir + "/simul.x",
    72                 "-SOFT"   , basedir + "/soft/build/soft.elf",
     87            subprocess.call([os.path.join(basedir, "simul.x"),
     88                "-SOFT"   , os.path.join(basedir, "soft/build/soft.elf"),
    7389                "-DISK"   , "/dev/null",
    7490                "-THREADS", str(ompthreads),
     
    7995
    8096        # 6. move simulation terminal output into the target config dir
    81         os.rename("term0", confdir + "/term")
     97        os.rename("term0", os.path.join(confdir, "term"))
    8298
    8399        # end for each config
    84100    #end for each faulty
    85101
     102# parse terminal logs to obtain statistics
     103statsdir = os.path.join(basedir, 'stats')
     104try:
     105    os.makedirs(statsdir, 0755)
     106except OSError:
     107    pass # directory already exists => do nothing
     108
     109parse_ffstend(configs,
     110             len(faultylist),
     111             os.path.join(basedir, 'conf'),
     112             os.path.join(statsdir, 'ffst_stats.dat'))
     113
    86114# vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracChangeset for help on using the changeset viewer.