Changeset 779 for trunk/platforms/tsar_generic_xbar/scripts/run_simus.py
- Timestamp:
- Aug 28, 2014, 6:04:44 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/platforms/tsar_generic_xbar/scripts/run_simus.py
r752 r779 6 6 import shutil 7 7 8 #TODO : recopier les fichiers d'entrees dans le script en fonction de l'appli selectionnee8 #TODO (?): recopier les fichiers d'entrees dans le script en fonction de l'appli selectionnee 9 9 # Par exemple, tk14.O pour LU, img.raw pour ep_filter, etc. 10 10 11 data_dir = 'data' 12 log_init_name = 'log_init_' 13 log_term_name = 'log_term_' 14 15 11 12 # User parameters 16 13 nb_procs = [ 4 ] 17 14 #nb_procs = [ 16, 32, 64, 128, 256 ] 18 rerun_stats = True15 rerun_stats = False 19 16 use_omp = False 17 protocol = 'rwt' 20 18 21 19 #apps = [ 'histogram', 'mandel', 'filter', 'radix_ga', 'fft_ga', 'kmeans' ] 22 20 #apps = [ 'histogram', 'mandel', 'filter', 'radix_ga', 'fft_ga' ] 23 21 apps = [ 'radix' ] 22 23 24 # Variables which could be changed but ought not to because they are reflected in the create_graphs.py script 25 data_dir = 'data' 26 log_init_name = protocol + '_stdo_' 27 log_term_name = protocol + '_term_' 28 29 # Global Variables 24 30 25 31 all_apps = [ 'cholesky', 'fft', 'fft_ga', 'filter', 'filt_ga', 'histogram', 'kmeans', 'lu', 'mandel', 'mat_mult', 'pca', 'radix', 'radix_ga', 'showimg', ] 26 32 # to come: 'barnes', 'fmm', 'ocean', 'raytrace', 'radiosity', 'waters', 'watern' 27 33 28 a pps = [ 'cholesky' ]29 30 34 all_protocols = [ 'dhccp', 'rwt', 'mesi' ] 35 36 top_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..") 31 37 config_name = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.py") 38 39 scripts_path = os.path.join(top_path, 'scripts') 40 almos_path = os.path.join(top_path, 'almos') 41 soclib_conf_name = os.path.join(top_path, "soclib.conf") 42 topcell_name = os.path.join(top_path, "top.cpp") 43 arch_info_name = os.path.join(almos_path, "arch-info-gen.info") 44 arch_info_bib_name = os.path.join(almos_path, 'arch-info.bib') 45 hdd_img_file_name = os.path.join(almos_path, "hdd-img.bin") 46 shrc_file_name = os.path.join(almos_path, "shrc") 47 hard_config_name = os.path.join(almos_path, "hard_config.h") 48 49 50 # Checks 51 if 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 58 for 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 32 63 if not os.path.isfile(config_name): 33 help_str = '''64 help_str = ''' 34 65 You should create a file named config.py in this directory with the following definitions: 35 66 - apps_dir: path to almos-tsar-mipsel/apps directory … … 38 69 *** Stopping execution 39 70 ''' 40 print help_str 41 sys.exit() 42 71 print help_str 72 sys.exit() 73 74 # Loading config 43 75 exec(file(config_name)) 44 76 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 78 for 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 86 if 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 94 if 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 56 103 57 104 … … 65 112 #splash_app_dir['watern'] = 'apps/water-nsquared' 66 113 #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'76 114 77 115 78 116 def 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 129 def 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() 90 189 91 190 … … 97 196 #define _HD_CONFIG_H 98 197 99 #define 100 #define 101 #define 102 #define 103 #define 104 105 #define 106 #define 107 108 #define 109 #define 110 #define 111 #define 112 113 #define 114 #define 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 115 214 116 215 #define IRQ_PER_PROCESSOR 1 … … 194 293 # subprocess.call([ 'make' ]) 195 294 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 203 295 #else: 204 296 # print "make clean" … … 212 304 213 305 print "make TARGET=tsar" 214 subprocess.call([ 'make', 'TARGET=tsar' ]) 306 retval = subprocess.call([ 'make', 'TARGET=tsar' ]) 307 if retval != 0: 308 sys.exit() 215 309 216 310 # Creation/Modification du shrc de almos … … 281 375 282 376 gen_sym_links() 377 gen_soclib_conf() 283 378 284 379 for i in nb_procs: … … 293 388 subprocess.call([ 'touch', topcell_name ]) 294 389 print "make" 295 subprocess.call([ 'make' ]) 296 390 retval = subprocess.call([ 'make' ]) 391 if retval != 0: 392 sys.exit() 393 297 394 for app in apps: 298 395 print "cd", top_path
Note: See TracChangeset
for help on using the changeset viewer.