Ignore:
Timestamp:
Oct 21, 2015, 11:48:40 AM (9 years ago)
Author:
meunier
Message:
  • Update the scripts to use a common file hard_params.py in both gen_arch_info and gen_hdd
  • Adding the P_WIDTH parameter in the topcell
File:
1 edited

Legend:

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

    r1012 r1023  
    1515
    1616# User parameters
    17 bscpu = 0
    18 #nb_procs = [ 4 ]
    19 nb_procs = [ 1, 4, 8, 16, 32, 64, 128, 256 ]
    20 rerun_stats = True
    21 use_omp = True
     17bscpu = 0 # bootstrap CPU
     18nb_procs = [ 4 ]
     19#nb_procs = [ 1, 4, 8, 16, 32, 64, 128, 256 ]
     20rerun_stats = False
     21use_omp = False
    2222protocol = 'rwt'
    2323cpu_per_cluster = 4
    2424# mode must be one of 'test' and 'simu'
    25 mode = 'simu'
     25mode = 'test'
    2626
    2727#apps = [ 'cholesky', 'fft', 'fft_ga', 'filter', 'filt_ga', 'histogram', 'kmeans', 'lu', 'mandel', 'mat_mult', 'pca', 'radix_ga' ]
    2828#apps = [ 'histogram', 'mandel', 'filter', 'radix_ga', 'fft_ga', 'kmeans' ]
    29 apps = [ 'blackscholes', 'linear_regression', 'string_match', 'swaptions', 'fluidanimate' ]
     29#apps = [ 'blackscholes', 'linear_regression', 'string_match', 'swaptions', 'fluidanimate' ]
     30apps = [ 'hello', 'taquin', '2048' ]
    3031
    3132
     
    4041# Global Variables
    4142
    42 all_apps = [ 'blackscholes', 'boot_only', 'cholesky', 'fft', 'fft_ga', 'filter', 'filt_ga', 'fluidanimate', 'histogram', 'histo-opt', 'kmeans', 'kmeans-opt', 'linear_regression', 'lu', 'mandel', 'mat_mult', 'mat_mult-opt', 'pca', 'pca-opt', 'radix', 'radix_ga', 'showimg', 'string_match', 'swaptions', ]
     43all_apps = [ '2048', 'blackscholes', 'boot_only', 'cholesky', 'fft', 'fft_ga', 'filter', 'filt_ga', 'fluidanimate', 'hello', 'histogram', 'histo-opt', 'kmeans', 'kmeans-opt', 'linear_regression', 'lu', 'mandel', 'mat_mult', 'mat_mult-opt', 'pca', 'pca-opt', 'radix', 'radix_ga', 'showimg', 'string_match', 'swaptions', 'taquin']
    4344# to come: 'barnes', 'fmm', 'ocean', 'raytrace', 'radiosity', 'waters', 'watern'
    4445
    4546all_protocols = [ 'dhccp', 'rwt', 'hmesi', 'wtidl', 'snoop' ]
    4647
    47 top_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
     48top_path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))
    4849config_name = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.py")
    4950
    50 scripts_path         = os.path.join(top_path, 'scripts')
    51 almos_path           = os.path.join(top_path, 'almos')
    52 soclib_conf_name     = os.path.join(top_path, "soclib.conf")
    53 topcell_name         = os.path.join(top_path, "top.cpp")
    54 partition_root_path  = os.path.join(top_path, "hdd_root")
    55 arch_info_name       = os.path.join(almos_path, "arch-info-gen.info")
    56 arch_info_bib_name   = os.path.join(almos_path, 'arch-info.bib')
    57 hdd_img_file_name    = os.path.join(almos_path, "hdd-img.bin")
    58 shrc_file_name       = os.path.join(almos_path, "shrc")
    59 hard_config_name     = os.path.join(almos_path, "hard_config.h")
    60 bootloader_link_name = os.path.join(almos_path, "bootloader-tsar-mipsel.bin")
     51scripts_path          = os.path.join(top_path, 'scripts')
     52almos_path            = os.path.join(top_path, 'almos')
     53soclib_conf_name      = os.path.join(top_path, "soclib.conf")
     54topcell_name          = os.path.join(top_path, "top.cpp")
     55partition_root_path   = os.path.join(top_path, "hdd_root")
     56arch_info_name        = os.path.join(almos_path, "arch-info.info")
     57arch_info_bib_name    = os.path.join(almos_path, 'arch-info.bib')
     58hdd_img_file_name     = os.path.join(almos_path, "hdd-img.bin")
     59shrc_file_name        = os.path.join(almos_path, "shrc")
     60hard_config_name      = os.path.join(almos_path, "hard_config.h")
     61bootloader_file_name  = os.path.join(almos_path, "bootloader-tsar-mipsel.bin")
     62preloader_file_name   = os.path.join(almos_path, "preloader.elf")
     63preloader_build_path  = os.path.join(almos_path, "build_preloader")
     64bootloader_build_path = os.path.join(almos_path, "build_bootloader")
    6165
    6266
     
    8791 - almos_src_dir:     path to almos source directory (for kernel and bootloader binaries)
    8892 - preloader_src_dir: path to the preloader main directory (where to run make)
    89  - hdd_img_name:      path to the hdd image to use (will be copied but not modified)
    9093 - tsar_dir:          path to tsar repository
    9194Optional definitions (necessary if you want to use alternative protocols):
     
    102105
    103106# Check that variables and paths exist
    104 for var in [ 'apps_dir', 'almos_src_dir', 'hdd_img_name', 'tsar_dir' ]:
     107for var in [ 'apps_dir', 'almos_src_dir', 'tsar_dir' ]:
    105108    if eval(var) == "":
    106109        print "*** Error: variable %s not defined in config file" % (var)
     
    183186def gen_soclib_conf():
    184187    if os.path.isfile(soclib_conf_name):
    185         print "Updating file %s" % (soclib_conf_name)
     188        print "# Updating file %s" % (soclib_conf_name)
    186189        # First, remove lines containing "addDescPath"
    187190        f = open(soclib_conf_name, "r")
     
    196199        f.close()
    197200    else:
    198         print "Creating file %s" % (soclib_conf_name)
     201        print "# Creating file %s" % (soclib_conf_name)
    199202        f = open(soclib_conf_name, "w")
    200203        f.close()
     
    245248
    246249
    247 def gen_arch_info_bib(x, y, arch_info, arch_info_bib):
     250def gen_arch_info_bib(x, y, x_width, y_width):
     251    print "### Generating arch-info files"
    248252    old_path = os.getcwd()
    249253
    250254    print "cd", scripts_path
    251255    os.chdir(scripts_path)
    252     gen_arch_info(x, y, x_width, y_width, bscpu, arch_info)
     256    gen_arch_info(x, y, x_width, y_width, cpu_per_cluster, bscpu, arch_info_name)
    253257    os.chdir(almos_path)
    254258   
    255     cmd = ['./info2bib', '-i', arch_info, '-o', arch_info_bib]
     259    cmd = ['./info2bib', '-i', arch_info_name, '-o', arch_info_bib_name]
    256260    print_and_call(cmd)
    257261
    258262    print "cd", old_path
    259263    os.chdir(old_path)
     264
     265    print "### End of arch-info files generation"
    260266   
    261267
    262 def gen_sym_links():
    263     target = os.path.join(almos_src_dir, 'tools/soclib-bootloader/bootloader-tsar-mipsel.bin')
    264     if not os.path.isfile(bootloader_link_name):
    265         print "ln -s", target, bootloader_link_name
    266         os.symlink(target, bootloader_link_name)
    267 
    268     #target = os.path.join(almos_src_dir, 'kernel/obj.tsar/almix-tsar-mipsel.bin')
    269     #link_name = 'kernel-soclib.bin'
    270     #if not os.path.isfile(link_name):
    271     #    print "ln -s", target, link_name
    272     #    os.symlink(target, link_name)
     268#def gen_sym_links():
     269#    print "### Generating symbolic links"
     270#    target = os.path.join(almos_src_dir, 'tools/soclib-bootloader/bootloader-tsar-mipsel.bin')
     271#    if not os.path.isfile(bootloader_link_name):
     272#        print "ln -s", target, bootloader_link_name
     273#        os.symlink(target, bootloader_link_name)
     274#
     275#    print "### End of symbolic links generation"
     276#    #target = os.path.join(almos_src_dir, 'kernel/obj.tsar/almix-tsar-mipsel.bin')
     277#    #link_name = 'kernel-soclib.bin'
     278#    #if not os.path.isfile(link_name):
     279#    #    print "ln -s", target, link_name
     280#    #    os.symlink(target, link_name)
    273281
    274282
    275283def compile_almos():
     284    print "### Compiling Almos"
    276285    old_path = os.getcwd()
    277286
     
    279288    os.chdir(almos_src_dir)
    280289    cmd = ['make']
    281     print_and_call(cmd)
     290    retval = print_and_call(cmd)
     291    if retval != 0:
     292        sys.exit()
     293
     294    print "cd", old_path
     295    os.chdir(old_path)
     296
     297    print "### End of Almos compilation"
     298 
     299
     300def compile_bootloader():
     301    # This function depends upon the file arch-info.bib and should be called
     302    # every time it is modified
     303    print "### Compiling Almos bootloader"
     304    old_path = os.getcwd()
     305
    282306    bootloader_dir = os.path.join(almos_src_dir, 'tools/soclib-bootloader')
    283307    print "cd", bootloader_dir
    284308    os.chdir(bootloader_dir)
    285     print_and_call(cmd)
     309    cmd = ['make', 'ARCH_BIB=%s' % (arch_info_bib_name), 'BUILD_DIR=%s' % (bootloader_build_path), 'TARGET_DIR=%s' % (almos_path)]
     310    retval = print_and_call(cmd)
     311    if retval != 0:
     312        sys.exit()
    286313
    287314    print "cd", old_path
    288315    os.chdir(old_path)
    289  
     316
     317    print "### End of Almos bootloader compilation"
     318 
     319
    290320
    291321def compile_preloader():
     322    # This function depends upon the file hard_config.h, and should be called
     323    # every time it is modified
     324    print "### Compiling preloader"
    292325    old_path = os.getcwd()
     326
    293327    hard_conf_path_set = "HARD_CONFIG_PATH=" + almos_path
    294328    bscpu_set = "BS_PROC=%d" % bscpu
     
    296330    print "cd", preloader_src_dir
    297331    os.chdir(preloader_src_dir)
    298     cmd = ['make', hard_conf_path_set, bscpu_set, 'USE_DT=0']
    299     print_and_call(cmd)
     332    cmd = ['make', hard_conf_path_set, bscpu_set, 'USE_DT=0', 'BUILD_DIR=%s' % (preloader_build_path)]
     333    retval = print_and_call(cmd)
     334    if retval != 0:
     335        sys.exit()
    300336
    301337    print "cd", old_path
    302338    os.chdir(old_path)
    303339
     340    print "### End of preloader compilation"
     341
    304342
    305343
    306344
    307345def compile_app(app_name):
     346    print "### Compiling application %s" % (app_name)
    308347
    309348    #if app_name in splash2:
     
    352391    print "cd", old_path
    353392    os.chdir(old_path)
     393
     394    print "### End of compilation for application %s" % (app_name)
    354395# end of compile_app
    355396
     
    358399
    359400def gen_shrc(app_name, nprocs):
    360     # Creation/Modification du shrc de almos
     401    # Creation/Modification of almos shrc file
     402    print "### Generating shrc for application %s and %d threads" % (app_name, nprocs)
    361403    if mode == 'test':
    362404        if (app_name == "blackscholes"):
     
    374416        elif (app_name == "fluidanimate"):
    375417            shrc = "exec -p 0 /bin/fluidani -n%(nproc)d -i /etc/flui_15K.flu\n" % dict(nproc = nprocs)
     418        elif (app_name == "hello"):
     419            shrc = "exec -p 0 /bin/hello -n%(nproc)d\n" % dict(nproc = nprocs)
    376420        elif (app_name == "histogram"):
    377421            shrc = "exec -p 0 /bin/histogra -n%(nproc)d /etc/histo_s.bmp\n" % dict(nproc = nprocs)
     
    480524    cmd = ['cp', shrc_file_name, os.path.join(partition_root_path, "etc", "shrc")]
    481525    print_and_call(cmd)
     526
     527    print "### End of shrc generation for application %s and %d threads" % (app_name, nprocs)
    482528# end of gen_shrc
    483529
     
    487533print_and_call(cmd)
    488534
    489 gen_sym_links()
     535#gen_sym_links()
    490536gen_soclib_conf()
    491 compile_preloader()
    492537compile_almos()
    493538# Compile application once at the beginning not to intererfere with
     
    507552    x_width = get_nb_bits(x)
    508553    y_width = get_nb_bits(y)
    509     nthreads = min(4, x * y)
     554    nthreads = min(4, x * y) # thread number for parallel systemcass
    510555    hard_config(x, y, x_width, y_width, cpu_per_cluster, hard_config_name, protocol)
    511     gen_arch_info_bib(x, y, arch_info_name, arch_info_bib_name)
     556    gen_arch_info_bib(x, y, x_width, y_width)
     557    # We must recompile the preloader because we modified the hard_config file
     558    # and the bootloader because we modified the arch-info.bib file
     559    compile_preloader()
     560    compile_bootloader()
    512561
    513562    cmd = ['touch', topcell_name]
     
    523572        gen_shrc(app, i)
    524573
    525         # Remove current disk image
    526         print "rm", hdd_img_file_name
    527         os.remove(hdd_img_file_name)
    528 
    529574        # Regenerate disk image
    530         hdd_img(partition_root_path, hdd_img_file_name, "fat32", bootloader_link_name)
     575        hdd_img(partition_root_path, hdd_img_file_name, "fat32", bootloader_file_name)
    531576
    532577        # Launch simulation
     
    560605            assert(start2_found and end_found)
    561606         
    562             # Regenerate shrc and hdd to ensure having the same hdd image
    563             gen_shrc(app, i)
     607            # Regenerate hdd to ensure having the same hdd image
     608            hdd_img(partition_root_path, hdd_img_file_name, "fat32", bootloader_file_name)
    564609 
    565610            # Relauching simulation with reset and dump of counters
     
    581626            file.write(output)
    582627            file.close()
    583  
    584628
    585629## End of simulations
Note: See TracChangeset for help on using the changeset viewer.