Changeset 1023 for trunk/platforms/tsar_generic_xbar/scripts/run_simus.py
- Timestamp:
- Oct 21, 2015, 11:48:40 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/platforms/tsar_generic_xbar/scripts/run_simus.py
r1012 r1023 15 15 16 16 # User parameters 17 bscpu = 0 18 #nb_procs = [ 4 ]19 nb_procs = [ 1, 4, 8, 16, 32, 64, 128, 256 ]20 rerun_stats = True21 use_omp = True17 bscpu = 0 # bootstrap CPU 18 nb_procs = [ 4 ] 19 #nb_procs = [ 1, 4, 8, 16, 32, 64, 128, 256 ] 20 rerun_stats = False 21 use_omp = False 22 22 protocol = 'rwt' 23 23 cpu_per_cluster = 4 24 24 # mode must be one of 'test' and 'simu' 25 mode = ' simu'25 mode = 'test' 26 26 27 27 #apps = [ 'cholesky', 'fft', 'fft_ga', 'filter', 'filt_ga', 'histogram', 'kmeans', 'lu', 'mandel', 'mat_mult', 'pca', 'radix_ga' ] 28 28 #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' ] 30 apps = [ 'hello', 'taquin', '2048' ] 30 31 31 32 … … 40 41 # Global Variables 41 42 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',]43 all_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'] 43 44 # to come: 'barnes', 'fmm', 'ocean', 'raytrace', 'radiosity', 'waters', 'watern' 44 45 45 46 all_protocols = [ 'dhccp', 'rwt', 'hmesi', 'wtidl', 'snoop' ] 46 47 47 top_path = os.path. join(os.path.dirname(os.path.realpath(__file__)), "..")48 top_path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")) 48 49 config_name = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.py") 49 50 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") 51 scripts_path = os.path.join(top_path, 'scripts') 52 almos_path = os.path.join(top_path, 'almos') 53 soclib_conf_name = os.path.join(top_path, "soclib.conf") 54 topcell_name = os.path.join(top_path, "top.cpp") 55 partition_root_path = os.path.join(top_path, "hdd_root") 56 arch_info_name = os.path.join(almos_path, "arch-info.info") 57 arch_info_bib_name = os.path.join(almos_path, 'arch-info.bib') 58 hdd_img_file_name = os.path.join(almos_path, "hdd-img.bin") 59 shrc_file_name = os.path.join(almos_path, "shrc") 60 hard_config_name = os.path.join(almos_path, "hard_config.h") 61 bootloader_file_name = os.path.join(almos_path, "bootloader-tsar-mipsel.bin") 62 preloader_file_name = os.path.join(almos_path, "preloader.elf") 63 preloader_build_path = os.path.join(almos_path, "build_preloader") 64 bootloader_build_path = os.path.join(almos_path, "build_bootloader") 61 65 62 66 … … 87 91 - almos_src_dir: path to almos source directory (for kernel and bootloader binaries) 88 92 - 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)90 93 - tsar_dir: path to tsar repository 91 94 Optional definitions (necessary if you want to use alternative protocols): … … 102 105 103 106 # Check that variables and paths exist 104 for var in [ 'apps_dir', 'almos_src_dir', ' hdd_img_name', 'tsar_dir' ]:107 for var in [ 'apps_dir', 'almos_src_dir', 'tsar_dir' ]: 105 108 if eval(var) == "": 106 109 print "*** Error: variable %s not defined in config file" % (var) … … 183 186 def gen_soclib_conf(): 184 187 if os.path.isfile(soclib_conf_name): 185 print " Updating file %s" % (soclib_conf_name)188 print "# Updating file %s" % (soclib_conf_name) 186 189 # First, remove lines containing "addDescPath" 187 190 f = open(soclib_conf_name, "r") … … 196 199 f.close() 197 200 else: 198 print " Creating file %s" % (soclib_conf_name)201 print "# Creating file %s" % (soclib_conf_name) 199 202 f = open(soclib_conf_name, "w") 200 203 f.close() … … 245 248 246 249 247 def gen_arch_info_bib(x, y, arch_info, arch_info_bib): 250 def gen_arch_info_bib(x, y, x_width, y_width): 251 print "### Generating arch-info files" 248 252 old_path = os.getcwd() 249 253 250 254 print "cd", scripts_path 251 255 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) 253 257 os.chdir(almos_path) 254 258 255 cmd = ['./info2bib', '-i', arch_info , '-o', arch_info_bib]259 cmd = ['./info2bib', '-i', arch_info_name, '-o', arch_info_bib_name] 256 260 print_and_call(cmd) 257 261 258 262 print "cd", old_path 259 263 os.chdir(old_path) 264 265 print "### End of arch-info files generation" 260 266 261 267 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) 273 281 274 282 275 283 def compile_almos(): 284 print "### Compiling Almos" 276 285 old_path = os.getcwd() 277 286 … … 279 288 os.chdir(almos_src_dir) 280 289 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 300 def 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 282 306 bootloader_dir = os.path.join(almos_src_dir, 'tools/soclib-bootloader') 283 307 print "cd", bootloader_dir 284 308 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() 286 313 287 314 print "cd", old_path 288 315 os.chdir(old_path) 289 316 317 print "### End of Almos bootloader compilation" 318 319 290 320 291 321 def 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" 292 325 old_path = os.getcwd() 326 293 327 hard_conf_path_set = "HARD_CONFIG_PATH=" + almos_path 294 328 bscpu_set = "BS_PROC=%d" % bscpu … … 296 330 print "cd", preloader_src_dir 297 331 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() 300 336 301 337 print "cd", old_path 302 338 os.chdir(old_path) 303 339 340 print "### End of preloader compilation" 341 304 342 305 343 306 344 307 345 def compile_app(app_name): 346 print "### Compiling application %s" % (app_name) 308 347 309 348 #if app_name in splash2: … … 352 391 print "cd", old_path 353 392 os.chdir(old_path) 393 394 print "### End of compilation for application %s" % (app_name) 354 395 # end of compile_app 355 396 … … 358 399 359 400 def 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) 361 403 if mode == 'test': 362 404 if (app_name == "blackscholes"): … … 374 416 elif (app_name == "fluidanimate"): 375 417 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) 376 420 elif (app_name == "histogram"): 377 421 shrc = "exec -p 0 /bin/histogra -n%(nproc)d /etc/histo_s.bmp\n" % dict(nproc = nprocs) … … 480 524 cmd = ['cp', shrc_file_name, os.path.join(partition_root_path, "etc", "shrc")] 481 525 print_and_call(cmd) 526 527 print "### End of shrc generation for application %s and %d threads" % (app_name, nprocs) 482 528 # end of gen_shrc 483 529 … … 487 533 print_and_call(cmd) 488 534 489 gen_sym_links()535 #gen_sym_links() 490 536 gen_soclib_conf() 491 compile_preloader()492 537 compile_almos() 493 538 # Compile application once at the beginning not to intererfere with … … 507 552 x_width = get_nb_bits(x) 508 553 y_width = get_nb_bits(y) 509 nthreads = min(4, x * y) 554 nthreads = min(4, x * y) # thread number for parallel systemcass 510 555 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() 512 561 513 562 cmd = ['touch', topcell_name] … … 523 572 gen_shrc(app, i) 524 573 525 # Remove current disk image526 print "rm", hdd_img_file_name527 os.remove(hdd_img_file_name)528 529 574 # 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) 531 576 532 577 # Launch simulation … … 560 605 assert(start2_found and end_found) 561 606 562 # Regenerate shrc andhdd to ensure having the same hdd image563 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) 564 609 565 610 # Relauching simulation with reset and dump of counters … … 581 626 file.write(output) 582 627 file.close() 583 584 628 585 629 ## End of simulations
Note: See TracChangeset
for help on using the changeset viewer.