Ignore:
Timestamp:
Dec 8, 2014, 6:16:46 PM (9 years ago)
Author:
cfuguet
Message:

reconf: improve the random fault generation

  • Improve portability of python scripts by using env
Location:
branches/reconfiguration/platforms/tsar_generic_iob/scripts
Files:
6 edited

Legend:

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

    r890 r902  
    1 #!/usr/bin/python
     1#!/usr/bin/env python
    22# @date   26 August, 2014
    33# @author cfuguet <cesar.fuguet-tortolero@lip6.fr>
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/onerun.py

    r900 r902  
    1 #!/usr/bin/python
     1#!/usr/bin/env python
    22# @date   22 September, 2014
    33# @author cfuguet <cesar.fuguet-tortolero@lip6.fr>
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/parse.py

    r784 r902  
    1 #!/usr/bin/python
     1#!/usr/bin/env python
    22# @author Cesar Fuguet <cesar.fuguet-tortolero@lip6.fr>
    33# @date   28 August, 2014
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/plot_ffstend.py

    r784 r902  
    1 #!/usr/bin/python
     1#!/usr/bin/env python
    22# @author Cesar Fuguet <cesar.fuguet-tortolero@lip6.fr>
    33# @date   28 August, 2014
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/random_faulty_core_router.py

    r894 r902  
    1 #!/usr/bin/python
     1#!/usr/bin/env python
    22
    33import onerun
     
    8181        return self.get_totalclusters() * self.nprocs
    8282
    83 for xsize, ysize in ((3, 3), (4, 4), (4, 8), (8, 8), (8, 16), (16, 16)):
    84     # --------------------------------------------------------------------
    85     # simulation without faults
    86     # --------------------------------------------------------------------
    87     cfgname = 'output_{0}_{1}'.format(xsize, ysize)
    88     args = RunArguments(cfgname, xsize, ysize)
    89     onerun.run(args)
     83# activate the different kinds of simulation
     84SIM_FAULTFREE = False
     85SIM_FAULTCORES = False
     86SIM_FAULTROUTERS = False
     87SIM_FAULTMIXED = True
    9088
    91     for pct in (10, 20, 30, 40, 50, 60):
    92         # --------------------------------------------------------------------
    93         # simulation with random faulty cores
    94         # --------------------------------------------------------------------
    95         cfgname = 'output_core_{0}_{1}_{2}'.format(xsize, ysize, pct)
     89# probability of faulty router (for mixed simul)
     90SIM_FAULTMIXED_PROBROUTER = 0.05 # 5%
     91
     92for xsize, ysize in [(4, 4), (4, 8), (8, 8), (8, 16), (16, 16)]:
     93    if SIM_FAULTFREE:
     94        # ---------------------------------------------------------------------
     95        # simulation without faults
     96        # ---------------------------------------------------------------------
     97        cfgname = 'output_{0}_{1}'.format(xsize, ysize)
    9698        args = RunArguments(cfgname, xsize, ysize)
    97 
    98         faultycount = args.get_faultycorecount(pct)
    99         print "{0}/{1} faulty cores\n".\
    100             format(faultycount, args.get_totalcores())
    101 
    102         n = 0
    103         while n < faultycount:
    104             cx = random.randint(0, args.xmax)
    105             cy = random.randint(0, args.ymax)
    106             cl = random.randint(0, args.pmax)
    107             if args.add_faultycore((cx, cy, cl)): n += 1
    108 
    10999        onerun.run(args)
    110100
    111         # --------------------------------------------------------------------
    112         # simulation with random faulty routers
    113         # --------------------------------------------------------------------
    114         cfgname = 'output_router_{0}_{1}_{2}'.format(xsize, ysize, pct)
    115         args = RunArguments(cfgname, xsize, ysize)
     101    for pct in xrange(5, 60, 5): # 5, 10, ..., 55
     102        if SIM_FAULTCORES:
     103            # -----------------------------------------------------------------
     104            # simulation with random faulty cores
     105            # -----------------------------------------------------------------
     106            cfgname = 'output_core_{0}_{1}_{2}'.format(xsize, ysize, pct)
     107            args = RunArguments(cfgname, xsize, ysize)
    116108
    117         faultycount = args.get_faultyroutercount(pct)
    118         print "{0}/{1} faulty routers\n".\
    119             format(faultycount, args.get_totalclusters())
     109            faultycount = args.get_faultycorecount(pct)
     110            print "{0}/{1} faulty cores\n".\
     111                  format(faultycount, args.get_totalcores())
    120112
    121         n = 0
    122         while n < faultycount:
    123             cx = random.randint(0, args.xmax)
    124             cy = random.randint(0, args.ymax)
    125             if args.add_faultyrouter((cx, cy)): n += 1
     113            n = 0
     114            while n < faultycount:
     115                cx = random.randint(0, args.xmax)
     116                cy = random.randint(0, args.ymax)
     117                cl = random.randint(0, args.pmax)
     118                if args.add_faultycore((cx, cy, cl)): n += 1
    126119
    127         onerun.run(args)
     120            onerun.run(args)
    128121
    129         # --------------------------------------------------------------------
    130         # simulation with random faulty routers and cores
    131         # --------------------------------------------------------------------
    132         cfgname = 'output_mixed_{0}_{1}_{2}'.format(xsize, ysize, pct)
    133         args = RunArguments(cfgname, xsize, ysize)
     122        if SIM_FAULTROUTERS:
     123            # -----------------------------------------------------------------
     124            # simulation with random faulty routers
     125            # -----------------------------------------------------------------
     126            cfgname = 'output_router_{0}_{1}_{2}'.format(xsize, ysize, pct)
     127            args = RunArguments(cfgname, xsize, ysize)
    134128
    135         total = args.get_totalclusters() + args.get_totalcores()
    136         faultycount = args.get_faultycount(total, pct)
    137         print "{0}/{1} faulty routers/cores\n".\
    138                 format(faultycount, total)
     129            faultycount = args.get_faultyroutercount(pct)
     130            print "{0}/{1} faulty routers\n".\
     131                  format(faultycount, args.get_totalclusters())
    139132
    140         n = 0
    141         while n < faultycount:
    142             cx = random.randint(0, args.xmax)
    143             cy = random.randint(0, args.ymax)
    144             if (random.random() < 0.05):    # faulty router: 5% of probability
    145                 if not args.add_faultyrouter((cx, cy)):
    146                     continue
     133            n = 0
     134            while n < faultycount:
     135                cx = random.randint(0, args.xmax)
     136                cy = random.randint(0, args.ymax)
     137                if args.add_faultyrouter((cx, cy)): n += 1
    147138
    148             else:                           # faulty core: 95% of probability
    149                 cl = random.randint(0, args.pmax)
    150                 if not args.add_faultycore((cx, cy, cl)):
    151                     continue
     139            onerun.run(args)
    152140
    153             n += 1
     141        if SIM_FAULTMIXED:
     142            # -----------------------------------------------------------------
     143            # simulation with random faulty routers and cores
     144            # -----------------------------------------------------------------
     145            cfgname = 'output_mixed_{0}_{1}_{2}'.format(xsize, ysize, pct)
     146            args = RunArguments(cfgname, xsize, ysize)
    154147
    155         onerun.run(args)
     148            total = args.get_totalclusters() + args.get_totalcores()
     149            faultycount = args.get_faultycount(total, pct)
    156150
     151            print "\nprobability of faulty routers: {0}".\
     152                  format(SIM_FAULTMIXED_PROBROUTER)
     153            fr = 0
     154            fc = 0
     155            while (fr + fc) < faultycount:
     156                cx = random.randint(0, args.xmax)
     157                cy = random.randint(0, args.ymax)
     158                if (random.random() < SIM_FAULTMIXED_PROBROUTER):
     159                    # add faulty router
     160                    fr += 1
     161                    while not args.add_faultyrouter((cx, cy)):
     162                        cx = random.randint(0, args.xmax)
     163                        cy = random.randint(0, args.ymax)
     164
     165                else:
     166                    # add faulty core
     167                    fc += 1
     168                    cl = random.randint(0, args.pmax)
     169                    while not args.add_faultycore((cx, cy, cl)):
     170                        cx = random.randint(0, args.xmax)
     171                        cy = random.randint(0, args.ymax)
     172                        cl = random.randint(0, args.pmax)
     173
     174            print "faulty routers / faulty cores = {0} / {1}".format(fr, fc)
     175            onerun.run(args)
     176
     177# vim: ts=4 : sts=4 : sw=4 : et
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/run.py

    r893 r902  
    1 #!/usr/bin/python
     1#!/usr/bin/env python
    22# @date   25 August, 2014
    33# @author cfuguet <cesar.fuguet-tortolero@lip6.fr>
Note: See TracChangeset for help on using the changeset viewer.