Changeset 782
- Timestamp:
- Aug 28, 2014, 6:47:35 PM (10 years ago)
- Location:
- branches/reconfiguration/platforms/tsar_generic_iob/scripts
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/reconfiguration/platforms/tsar_generic_iob/scripts/parse.py
r777 r782 1 #!/usr/bin/python 2 # @author Cesar Fuguet <cesar.fuguet-tortolero@lip6.fr> 3 # @date 28 August, 2014 4 # @desc generate output file containing a table with the format below: 5 # 6 # fault configurations 7 # | faultconfig 0 | faultconfig 1 | faultconfig M 8 # ---------------------------------------------------- 9 # 4 | cycles | cycles | cycles 10 # # clusters 16 | cycles | cycles | cycles 11 # 64 | cycles | cycles | cycles 12 # N | cycles | cycles | cycles 13 1 14 import os 2 15 import sys 3 16 4 def parse_ffstend(configs, confpath, outpath):17 def parse_ffstend(configs, faultconfigs, confpath, outpath): 5 18 # write header 6 19 ffst_end = open(outpath, "w") 7 ffst_end.writelines([ 8 "# ffst end (cycles)\n", 9 "# clusters cycles\n", 10 "\n"]) 20 ffst_end.write("# ffst end (cycles)\n") 11 21 12 22 # repeat while configurations is not empty 23 quit = 0 13 24 for x,y in configs: 14 confdir = confpath + "/config_{}c/".format(x*y) 25 ffst_end.write("\n") 26 ffst_end.write(str(x*y)) 27 for f in xrange(faultconfigs): 28 temp = "config_{0}c{1}f/".format(x*y, f) 29 confdir = os.path.join(confpath, temp) 15 30 16 # parse term log and get relevant information 17 with open(confdir + "term", "r") as termlog: 31 # parse term log and get relevant information 32 termname = os.path.join(confdir, "term") 33 try: 34 termlog = open(termname, "r") 35 except IOError as e: 36 print "IOError {0}: {1}".format(termname, e.strerror) 37 quit = 1 38 break 39 40 found = False 18 41 for line in termlog: 19 42 partitions = line.partition(':') 20 43 if partitions[0].strip() == "FFST (END)": 44 found = True 21 45 value = int(partitions[2]) 22 ffst_end.write(" {} {}\n".format(x*y,value))46 ffst_end.write(" {0}".format(value)) 23 47 break 24 48 49 if not found: ffst_end.write(" -1") 50 # end for faultconfig 51 52 if quit: break 53 # end for configs 54 25 55 ffst_end.close() 56 # end def parse_ffstend 26 57 27 58 if __name__ == "__main__": … … 32 63 configs.append([16, 16]) 33 64 34 assert len(sys.argv) > 2, "Introduce config path and output path" 65 assert len(sys.argv) > 3,\ 66 "Introduce number of faulty configs, config path and output path" 35 67 36 parse_ffstend(configs, sys.argv[1], sys.argv[2]) 68 parse_ffstend(configs, int(sys.argv[1]), sys.argv[2], sys.argv[3]) 69 70 # vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab -
branches/reconfiguration/platforms/tsar_generic_iob/scripts/run.py
r778 r782 8 8 import arch 9 9 import faultyprocs 10 from parse import parse_ffstend 10 11 11 12 # define constants 13 # list of mesh dimensions 12 14 configs = [] 13 configs.append([2 ,2 ]) 14 configs.append([4 ,4 ]) 15 configs.append([8 ,8 ]) 16 configs.append([16,16]) 15 configs.append([2 , 2 ]) # 4 clusters 16 configs.append([4 , 2 ]) # 8 clusters 17 configs.append([4 , 4 ]) # 16 clusters 18 configs.append([8 , 4 ]) # 32 clusters 19 configs.append([8 , 8 ]) # 64 clusters 20 configs.append([16, 8 ]) # 128 clusters 21 configs.append([16, 16]) # 256 clusters 17 22 18 faultylist = [[(0,0,1), (0,1,1), (1,0,1), (1,0,2), (1,0,3), (1,1,1), (1,1,3)]] 23 # list of faulty cores 24 faultylist = [] 25 faultylist.append([]) # 0 faulty core 26 faultylist.append([(0,0,1)]) # 1 faulty core 27 faultylist.append([(0,0,1), (0,0,3)]) # 2 faulty cores 28 faultylist.append([(1,0,0), (1,0,2), (1,0,3)]) # 1 faulty cluster 29 faultylist.append([(1,0,0), (1,0,2), (1,0,3), 30 (1,1,1), (1,1,2), (1,1,3)]) # 2 faulty cluster 19 31 32 # number of processors per cluster 20 33 nprocs = 4 21 34 … … 27 40 28 41 # repeat while configurations is not empty 29 for f aulty in faultylist:42 for f in xrange(len(faultylist)): 30 43 for x,y in configs: 31 confdir = "{0}/conf/config_{1}c".format(basedir, x*y) 44 confname = "conf/config_{0}c{1}f".format(x*y, f) 45 confdir = os.path.join(basedir, confname) 32 46 print "[ run.py ] generating files for {0}".format(confdir) 33 47 34 48 # 1. generate configuration and ouput directories 35 49 try: 36 os.makedirs( confdir + "/config", 0755)50 os.makedirs(os.path.join(confdir, "config"), 0755) 37 51 except OSError: 38 52 pass # directory already exists => do nothing 39 53 40 54 # 2. generate hard_config.h and fault_config.h files 41 arch.main( x = x, y = y, p = nprocs, 42 hard_path = confdir + "/config/hard_config.h", 43 xml_path = confdir + "/config/map.xml" ) 44 faultyprocs.generate(faulty, confdir + "/config/fault_config.h") 55 hardpath = os.path.join(confdir, "config/hard_config.h") 56 xmlpath = os.path.join(confdir, "config/map.xml") 57 faultpath = os.path.join(confdir, "config/fault_config.h") 58 arch.main( x, y, nprocs, hardpath, xmlpath) 59 faultyprocs.generate(faultylist[f], faultpath) 45 60 46 61 # 3. compile simulator executable 47 dst = basedir + "/hard_config.h"62 dst = os.path.join(basedir, "hard_config.h") 48 63 if os.path.lexists(dst): os.unlink(dst) 49 os.symlink( confdir + "/config/hard_config.h", dst)64 os.symlink(hardpath, dst) 50 65 subprocess.call(["make", 51 66 "-C", basedir … … 53 68 54 69 # 4. compile distributed boot executable 55 dst = confdir + "/config/boot_config.h"70 dst = os.path.join(confdir, "config/boot_config.h") 56 71 if os.path.lexists(dst): os.unlink(dst) 57 os.symlink( basedir + "/soft/config/boot_config.h", dst)72 os.symlink(os.path.join(basedir, "soft/config/boot_config.h"), dst) 58 73 subprocess.call(["make", 59 "-C", basedir + "/soft",74 "-C", os.path.join(basedir, "soft"), 60 75 "CONFDIR=" + confdir 61 76 ]) … … 65 80 os.environ["SOCLIB_TTY"] = "FILES" 66 81 67 if x*y <= 4: ompthreads = x*y 68 else: ompthreads = 4 69 with open(confdir + "/log", "w") as logfile: 82 if x*y <= 4 : ompthreads = x*y 83 elif x*y <= 16: ompthreads = 4 84 else: ompthreads = 8 85 with open(os.path.join(confdir, "log"), "w") as logfile: 70 86 print "executing simul.x" 71 subprocess.call([ basedir + "/simul.x",72 "-SOFT" , basedir + "/soft/build/soft.elf",87 subprocess.call([os.path.join(basedir, "simul.x"), 88 "-SOFT" , os.path.join(basedir, "soft/build/soft.elf"), 73 89 "-DISK" , "/dev/null", 74 90 "-THREADS", str(ompthreads), … … 79 95 80 96 # 6. move simulation terminal output into the target config dir 81 os.rename("term0", confdir + "/term")97 os.rename("term0", os.path.join(confdir, "term")) 82 98 83 99 # end for each config 84 100 #end for each faulty 85 101 102 # parse terminal logs to obtain statistics 103 statsdir = os.path.join(basedir, 'stats') 104 try: 105 os.makedirs(statsdir, 0755) 106 except OSError: 107 pass # directory already exists => do nothing 108 109 parse_ffstend(configs, 110 len(faultylist), 111 os.path.join(basedir, 'conf'), 112 os.path.join(statsdir, 'ffst_stats.dat')) 113 86 114 # vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracChangeset
for help on using the changeset viewer.