def __init__(self, tool_box_name) : Functor.__init__(self, tool_box_name,'check') self.logger = Mylogging("nt2.fctor_lists.Fctr_list") st = self.check_tbox() if not st : self.logger.error( "\ntoolbox %s does not exists\n" % self.get_tb_name() + "in path: %s\n" % self.get_tb_abs_path() )
def treat_variant(self,s,variant) : mode = "simd" tb_name = s[0] fct = Functor(tb_name,'modify','sys') for ss in s[1:] : ss = re.sub('\b',' ',ss) if len(ss) == 0 : continue l = ss.split() if len(l) == 0 : continue fct_name = l[0] arity = 1 if len(l) <=1 else int(l[1]) path = "simd/sse/"+variant fct.add_functor(fct_name,arity) st = fct.read_functor(fct_name,path) src = os.path.join(Recover.Pname,path,fct_name+'.hpp') if exist(src) and (os.path.getsize(src) > 1536) : print "adding functor %s of arity %d in variant %s (size %s)" % (fct_name, arity, variant,os.path.getsize(src)) sys.stdout.flush() # print"orig-----------------" #show(st) d = read(src) # print"src-----------------" #show(d) v = get_struct(d,"validate") c = get_struct(d,"call") i = self.get_includes(d,tb_name,mode,fct.get_path_to_nt2()) st = self.insert_variants(st,v,c,i, fct.get_tb_style(), fct.get_tb_name(), fct_name, mode) # print"avant-----------------" #show(st) # print"apr-Aès-----------------"-b fct.write_functor(fct_name,path,st,False)
def treat_one_tb(self,s,mode) : if mode == 'simd' : path = mode+'/common' else : path = mode tb_name = s[0] fct = Functor(tb_name,'modify','sys') for ss in s[1:] : ss = re.sub('\b',' ',ss) if len(ss) == 0 : continue l = ss.split() if len(l) == 0 : continue fct_name = l[0] arity = 1 if len(l) <=1 else int(l[1]) fct.add_functor(fct_name,arity) st = fct.read_functor(fct_name,path) print "in toolbox %s adding functor %s of arity %d" % (tb_name,fct_name, arity) sys.stdout.flush() src = os.path.join(Recover.Pname,path,fct_name+'.hpp') if exist(src) : d = read(src) v = get_struct(d,"validate") c = get_struct(d,"call") i = self.get_includes(d,tb_name,mode,fct.get_path_to_nt2()) st = self.insert_validate_and_call(st,v,c,i, fct.get_tb_style(), fct.get_tb_name(), fct_name, mode) # show(st) fct.write_functor(fct_name,path,st,False)
def modify_toolbox(tb_name) : fct = Functor(tb_name,mode='modify') print ("opening toolbox %s" %fct.get_tb_name())+ \ " with %s mode" % fct.get_tb_mode() return fct
def __init__(self, tb_name, style="sys"): Functor.__init__(self, tb_name, "modify", "sys") self.__tb_name = tb_name self.__unit_simd_path = os.path.join(self.get_path_to_nt2(), "nt2/toolbox", tb_name, "unit/simd") self.__mk_list_simd_units()
def __init__(self, tb_name, style='sys') : Functor.__init__(self,tb_name,'modify','sys') p = os.path.join(self.get_path_to_nt2(),'nt2/toolbox',tb_name) self.__mk_list_dirs() self.__mk_list_hpps()