Ignore:
Timestamp:
Aug 28, 2014, 6:04:44 PM (10 years ago)
Author:
meunier
Message:

Trunk:

  • Updating python scripts for simulations and graphs for tsar_generic_xbar (support for rwt and mesi)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/platforms/tsar_generic_xbar/scripts/run_simus.py

    r752 r779  
    66import shutil
    77
    8 #TODO: recopier les fichiers d'entrees dans le script en fonction de l'appli selectionnee
     8#TODO (?): recopier les fichiers d'entrees dans le script en fonction de l'appli selectionnee
    99# Par exemple, tk14.O pour LU, img.raw pour ep_filter, etc.
    1010
    11 data_dir = 'data'
    12 log_init_name = 'log_init_'
    13 log_term_name = 'log_term_'
    14 
    15 
     11
     12# User parameters
    1613nb_procs = [ 4 ]
    1714#nb_procs = [ 16, 32, 64, 128, 256 ]
    18 rerun_stats = True
     15rerun_stats = False
    1916use_omp = False
     17protocol = 'rwt'
    2018
    2119#apps = [ 'histogram', 'mandel', 'filter', 'radix_ga', 'fft_ga', 'kmeans' ]
    2220#apps = [ 'histogram', 'mandel', 'filter', 'radix_ga', 'fft_ga' ]
    23 
     21apps = [ 'radix' ]
     22
     23
     24# Variables which could be changed but ought not to because they are reflected in the create_graphs.py script
     25data_dir = 'data'
     26log_init_name = protocol + '_stdo_'
     27log_term_name = protocol + '_term_'
     28
     29# Global Variables
    2430
    2531all_apps = [ 'cholesky', 'fft', 'fft_ga', 'filter', 'filt_ga', 'histogram', 'kmeans', 'lu', 'mandel', 'mat_mult', 'pca', 'radix', 'radix_ga', 'showimg', ]
    2632# to come: 'barnes', 'fmm', 'ocean', 'raytrace', 'radiosity', 'waters', 'watern'
    2733
    28 apps = [ 'cholesky' ]
    29 
    30 
     34all_protocols = [ 'dhccp', 'rwt', 'mesi' ]
     35
     36top_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
    3137config_name = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.py")
     38
     39scripts_path       = os.path.join(top_path, 'scripts')
     40almos_path         = os.path.join(top_path, 'almos')
     41soclib_conf_name   = os.path.join(top_path, "soclib.conf")
     42topcell_name       = os.path.join(top_path, "top.cpp")
     43arch_info_name     = os.path.join(almos_path, "arch-info-gen.info")
     44arch_info_bib_name = os.path.join(almos_path, 'arch-info.bib')
     45hdd_img_file_name  = os.path.join(almos_path, "hdd-img.bin")
     46shrc_file_name     = os.path.join(almos_path, "shrc")
     47hard_config_name   = os.path.join(almos_path, "hard_config.h")
     48
     49
     50# Checks
     51if protocol not in all_protocols:
     52    help_str = '''
     53*** Error: variable protocol has an unsupported value
     54'''
     55    print help_str
     56    sys.exit()
     57
     58for the_app in apps:
     59    if the_app not in all_apps:
     60        print "*** Error: application %s is not defined" % (the_app)
     61        sys.exit()
     62
    3263if not os.path.isfile(config_name):
    33    help_str = '''
     64    help_str = '''
    3465You should create a file named config.py in this directory with the following definitions:
    3566 - apps_dir:      path to almos-tsar-mipsel/apps directory
     
    3869*** Stopping execution
    3970'''
    40    print help_str
    41    sys.exit()
    42 
     71    print help_str
     72    sys.exit()
     73
     74# Loading config
    4375exec(file(config_name))
    4476
    45 top_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
    46 
    47 scripts_path       = os.path.join(top_path, 'scripts')
    48 almos_path         = os.path.join(top_path, 'almos')
    49 arch_info_name     = os.path.join(almos_path, "arch-info-gen.info")
    50 arch_info_bib_name = os.path.join(almos_path, 'arch-info.bib')
    51 hdd_img_file_name  = os.path.join(almos_path, "hdd-img.bin")
    52 shrc_file_name     = os.path.join(almos_path, "shrc")
    53 hard_config_name   = os.path.join(almos_path, "hard_config.h")
    54 
    55 topcell_name = "top.cpp"
     77# Check that variables and paths exist
     78for var in [ 'apps_dir', 'almos_src_dir', 'hdd_img_name', 'tsar_dir' ]:
     79    if eval(var) == "":
     80        print "*** Error: variable %s not defined in config file" % (var)
     81        sys.exit()
     82    if not os.path.exists(eval(var)):
     83        print "*** Error: variable %s does not define a valid path" % (var)
     84        sys.exit()
     85
     86if protocol == "rwt":
     87    if rwt_dir == "":
     88        print "*** Error: variable rwt_dir not defined in config file"
     89        sys.exit()
     90    if not os.path.exists(rwt_dir):
     91        print "*** Error: variable rwt_dir does not define a valid path"
     92        sys.exit()
     93
     94if protocol == "mesi":
     95    if mesi_dir == "":
     96        print "*** Error: variable mesi_dir not defined in config file"
     97        sys.exit()
     98    if not os.path.exists(mesi_dir):
     99        print "*** Error: variable mesi_dir does not define a valid path"
     100        sys.exit()
     101
     102
    56103
    57104
     
    65112#splash_app_dir['watern'] = 'apps/water-nsquared'
    66113#splash_app_dir['waters'] = 'apps/water-spatial'
    67 #
    68 #splash_app_dir['cholesky'] = 'kernels/cholesky'
    69 #splash_app_dir['fft'] = 'kernels/fft'
    70 #splash_app_dir['lu'] = 'kernels/lu/contiguous_blocks'
    71 #splash_app_dir['radix'] = 'kernels/radix'
    72 #
    73 #splash_ga_app_dir = {}
    74 #splash_ga_app_dir['radix_ga'] = 'apps/radix'
    75 #splash_ga_app_dir['fft_ga'] = 'apps/fft'
    76114
    77115
    78116def get_x_y(nb_procs):
    79    x = 1
    80    y = 1
    81    to_x = True
    82    while (x * y * 4 < nb_procs):
    83       if to_x:
    84          x = x * 2
    85       else:
    86          y = y * 2
    87       to_x = not to_x
    88    return x, y
    89 
     117    x = 1
     118    y = 1
     119    to_x = True
     120    while (x * y * 4 < nb_procs):
     121        if to_x:
     122            x = x * 2
     123        else:
     124            y = y * 2
     125        to_x = not to_x
     126    return x, y
     127
     128
     129def gen_soclib_conf():
     130
     131    if os.path.isfile(soclib_conf_name):
     132        print "Updating file %s" % (soclib_conf_name)
     133        # First, remove lines containing "addDescPath"
     134        f = open(soclib_conf_name, "r")
     135        lines = f.readlines()
     136        f.close()
     137
     138        f = open(soclib_conf_name, "w")
     139
     140        for line in lines:
     141            if not ("addDescPath" in line):
     142                f.write(line)
     143        f.close()
     144    else:
     145        print "Creating file %s" % (soclib_conf_name)
     146        f = open(soclib_conf_name, "w")
     147        f.close()
     148
     149    # Defining common and specific modules
     150    common_modules = [
     151            'lib/generic_llsc_global_table',
     152            'modules/dspin_router_tsar',
     153            'modules/sdmmc',
     154            'modules/vci_block_device_tsar',
     155            'modules/vci_ethernet_tsar',
     156            'modules/vci_io_bridge',
     157            'modules/vci_iox_network',
     158            'modules/vci_spi'
     159            'platforms/tsar_generic_xbar/tsar_xbar_cluster'
     160    ]
     161
     162    specific_modules = [
     163            'communication',
     164            'lib/generic_cache_tsar',
     165            'modules/vci_cc_vcache_wrapper',
     166            'modules/vci_mem_cache'
     167    ]
     168
     169    f = open(soclib_conf_name, "a")
     170    # Adding common modules
     171    for common_module in common_modules:
     172        f.write("config.addDescPath(\"%s/%s\")\n" % (tsar_dir, common_module))
     173    #f.write("\n")
     174
     175    if protocol == "dhccp":
     176        arch_dir = tsar_dir
     177    elif protocol == "rwt":
     178        arch_dir = rwt_dir
     179    elif protocol == "mesi":
     180        archi_dir = mesi_dir
     181    else:
     182        assert(False)
     183
     184    for specific_module in specific_modules:
     185        f.write("config.addDescPath(\"%s/%s\")\n" % (arch_dir, specific_module))
     186
     187    #f.write("\n")
     188    f.close()
    90189
    91190
     
    97196#define _HD_CONFIG_H
    98197
    99 #define  X_SIZE              %(x)d
    100 #define  Y_SIZE              %(y)d
    101 #define  NB_CLUSTERS         %(nb_clus)d
    102 #define  NB_PROCS_MAX        4
    103 #define  NB_TASKS_MAX        8
    104 
    105 #define  NB_TIM_CHANNELS     32
    106 #define  NB_DMA_CHANNELS     1
    107 
    108 #define  NB_TTY_CHANNELS     4
    109 #define  NB_IOC_CHANNELS     1
    110 #define  NB_NIC_CHANNELS     0
    111 #define  NB_CMA_CHANNELS     0
    112 
    113 #define  USE_XICU            1
    114 #define  IOMMU_ACTIVE        0
     198#define X_SIZE              %(x)d
     199#define Y_SIZE              %(y)d
     200#define NB_CLUSTERS         %(nb_clus)d
     201#define NB_PROCS_MAX        4
     202#define NB_TASKS_MAX        8
     203
     204#define NB_TIM_CHANNELS     32
     205#define NB_DMA_CHANNELS     1
     206
     207#define NB_TTY_CHANNELS     4
     208#define NB_IOC_CHANNELS     1
     209#define NB_NIC_CHANNELS     0
     210#define NB_CMA_CHANNELS     0
     211
     212#define USE_XICU            1
     213#define IOMMU_ACTIVE        0
    115214
    116215#define   IRQ_PER_PROCESSOR   1
     
    194293   #   subprocess.call([ 'make' ])
    195294
    196    #elif app_name in splash2_ga:
    197    #   print "make clean"
    198    #   subprocess.call([ 'make', 'clean' ])
    199 
    200    #   print "make"
    201    #   subprocess.call([ 'make' ])
    202 
    203295   #else:
    204296   #   print "make clean"
     
    212304 
    213305   print "make TARGET=tsar"
    214    subprocess.call([ 'make', 'TARGET=tsar' ])
     306   retval = subprocess.call([ 'make', 'TARGET=tsar' ])
     307   if retval != 0:
     308       sys.exit()
    215309   
    216310   # Creation/Modification du shrc de almos
     
    281375
    282376gen_sym_links()
     377gen_soclib_conf()
    283378
    284379for i in nb_procs:
     
    293388   subprocess.call([ 'touch', topcell_name ])
    294389   print "make"
    295    subprocess.call([ 'make' ])
    296    
     390   retval = subprocess.call([ 'make' ])
     391   if retval != 0:
     392       sys.exit()
     393
    297394   for app in apps:
    298395      print "cd", top_path
Note: See TracChangeset for help on using the changeset viewer.