예제 #1
0
 def __init__(self, tb_name,
              fct_list=None,
              modes=['scalar','simd'],
              parts=["unit","cover"],
              platform='sse',
              show=True,
              write_files=False,
              check_on_write=True,
              backup_on_write=True,
              verbose=False) :
     self.tb_name =tb_name
     Nt2_tb_props.__init__(self,tb_name)
     if fct_list is None :
         self.fcts = self.get_fcts_list()
     elif isinstance(fct_list,str ) :
         self.fcts = [fct_list]
     else :
         self.fcts = fct_list
     self.parts = parts
     if  isinstance(self.parts,str ) : self.parts = [self.parts]
     self.modes = modes
     if  isinstance(self.modes,str ) : self.modes = [self.modes]
     self.platform=platform
     self.show = show
     self.write_files =write_files
     self.check_on_write = check_on_write
     self.backup_on_write = backup_on_write
     self.verbose=verbose
예제 #2
0
 def __init__(self,
              tb_name,
              fct_list=None,
              modes=['scalar', 'simd'],
              parts=["unit", "cover"],
              platform='sse',
              show=True,
              write_files=False,
              check_on_write=True,
              backup_on_write=True,
              verbose=False):
     self.tb_name = tb_name
     Nt2_tb_props.__init__(self, tb_name)
     if fct_list is None:
         self.fcts = self.get_fcts_list()
     elif isinstance(fct_list, str):
         self.fcts = [fct_list]
     else:
         self.fcts = fct_list
     self.parts = parts
     if isinstance(self.parts, str): self.parts = [self.parts]
     self.modes = modes
     if isinstance(self.modes, str): self.modes = [self.modes]
     self.platform = platform
     self.show = show
     self.write_files = write_files
     self.check_on_write = check_on_write
     self.backup_on_write = backup_on_write
     self.verbose = verbose
예제 #3
0
    def __init__(self, tb_name, fct_name, mode="scalar", submode="") :
        Nt2_tb_props.__init__(self, tb_name)
#        Nt2_base_infos.__init__(self)
#        Nt2_tb_struct.__init__(self)
#        self.__tb_name = tb_name
        self.__fct_name = fct_name
        self.__mode = mode
        self.__fct_arities = self.__read_arities()
        self.__fct_ret_arity = self.__read_ret_arity()
예제 #4
0
def create_bench(tb_name,
                 fct_list=None,
                 modes=('scalar', 'simd'),
                 show=True,
                 write_files=False,
                 check_on_write=True,
                 backup_on_write=True,
                 simd_type='sse'):
    bg = Nt2_modules()
    ##    print(bg.get_module_style(tb_name))
    if bg.get_module_style(tb_name) == 'usr': modes = ['scalar']
    if fct_list is None:
        fcts = Nt2_tb_props(tb_name).get_fcts_list()
    elif isinstance(fct_list, str):
        fcts = [fct_list]
    else:
        fcts = fct_list
    if isinstance(modes, str): modes = [modes]
    for fct in fcts:
        for mode in modes:
            ##            print("fct=%s,mode=%s"%(fct,mode))
            r = create_one_bench(tb_name, fct, mode, simd_type)
            if r is None:
                print('error for %s' % fct)
            elif len(r) == 0:
                print(
                    'no regeneration possible for %s %s-tests, please do it manually'
                    % (fct, mode))
            else:
                just = "just" if show and not write_files else ""
                if show:
                    print("%s showing text of %s.cpp for %s-test" %
                          (just, fct, mode))
                    print("<" + "=" * 40)
                    PrettyPrinter().pprint(r)
                    print("=" * 40 + ">")
                if write_files:
                    print("writing text of %s.cpp for %s-test" % (fct, mode))
                    write_bench(tb_name,
                                fct,
                                mode,
                                r,
                                check=check_on_write,
                                backup=backup_on_write)
예제 #5
0
 def __init__(self, tb_name, fct_name, mode="scalar", submode="") :
     Nt2_tb_props.__init__(self, tb_name)
     self.__fct_name = fct_name
     self.__mode = mode
     self.__fct_arities = self.__read_arities()
     self.__fct_ret_arity = self.__read_ret_arity()
예제 #6
0
                while True:
                    pi = p + '.' + str(i) + '.bak'
                    if not (exist(pi)): break
                    i += 1
                if self.verbose: print("to %s" % pi)
                shutil.copy(p, pi)
            elif self.verbose:
                print "writing to %s" % p
            write(p, s, self.check_on_write)
            p1 = os.path.join(os.path.split(p)[0], 'CMakeLists.txt')
            addline = Add_line(p1, fct_name)
            addline.update_file("SET\( *SOURCES")
        elif self.verbose:
            print("%s directory\n  does not exist " % os.path.split(p)[0])


if __name__ == "__main__":
    tb_name = "operator"
    fcts = Nt2_tb_props(tb_name).get_fcts_list()
    fcts = ["splat"]
    ct = Create_tests(tb_name,
                      fcts,
                      modes=['scalar', 'simd'],
                      parts=["unit"],
                      show=True,
                      write_files=False,
                      check_on_write=True,
                      backup_on_write=True,
                      verbose=False)
    ct.create_units()
예제 #7
0
 def __init__(self, tb_name) :
     Nt2_tb_props.__init__(self,tb_name)
예제 #8
0
 def __init__(self, tb_name, fct_name, mode="scalar", submode="") :
     Nt2_tb_props.__init__(self, tb_name)
     self.__fct_name = fct_name
     self.__mode = mode
     self.__fct_arities = self.__read_arities()
     self.__fct_ret_arity = self.__read_ret_arity()