示例#1
0
def test_network(backend,
                 network,
                 level,
                 split_nums=1,
                 split_idx=0,
                 check_performance=False):
    pwd = os.path.dirname(os.path.abspath(__file__))
    script_file = os.path.join(pwd, "run_composite_json.py")

    def prepare_script(pwd, script_file):
        if os.path.isfile(script_file):
            return
        src = os.path.join(pwd, "../composite/test_composite_json.py")
        subprocess.call("cp %s %s" % (src, script_file), shell=True)

    prepare_script(pwd, script_file)
    output = os.path.join(pwd, "output" + "_" + backend, network, level)
    if not os.path.isdir(output):
        os.makedirs(output, exist_ok=True)
    files_path = os.path.join(pwd, backend, network, level)
    all_files = os.listdir(files_path)
    all_files.sort()
    files = get_splitted_cases(all_files, split_nums, split_idx)
    for item in files:
        file_path = os.path.join(files_path, item)
        if not check_performance:
            poly = True
            attrs = None
            test_single_file(file_path, attrs, poly, profiling=False)
        else:
            file_name = item.split('.')[0]
            file_result = os.path.join(output, file_name + ".csv")
            if os.path.isfile(file_result):
                os.remove(file_result)
            if subprocess.call("nvprof --csv --log-file %s python3 %s -f %s" %
                               (file_result, script_file, file_path),
                               shell=True):
                raise ValueError("Test %s failed" % file_path)
            if not compare_base_line(pwd, file_result, network, level,
                                     file_name):
                raise ValueError("Performance degradation of %s!" % file_path)
示例#2
0
def test_feature(dir, level, split_nums=1, split_idx=0):
    pwd = os.path.dirname(os.path.abspath(__file__))
    script_file = os.path.join(pwd, "run_composite_json.py")

    def prepare_script(pwd, script_file):
        if os.path.isfile(script_file):
            return
        src = os.path.join(pwd, "../composite/test_composite_json.py")
        subprocess.call("cp %s %s" % (src, script_file), shell=True)

    prepare_script(pwd, script_file)
    output = os.path.join(pwd, "output" + "_" + dir, level)
    if not os.path.isdir(output):
        os.makedirs(output, exist_ok=True)
    files_path = os.path.join(pwd, dir, level)
    all_files = os.listdir(files_path)
    all_files.sort()
    files = get_splitted_cases(all_files, split_nums, split_idx)
    for item in files:
        file_path = os.path.join(files_path, item)
        poly = True
        attrs = None
        test_single_file(file_path, attrs, poly, profiling=False)
示例#3
0
 def test_level1(self, split_nums, split_idx):
     self.common_run(
         get_splitted_cases(self.testarg_level1, split_nums, split_idx))
示例#4
0
 def test(self, split_nums, split_idx):
     self.common_run(get_splitted_cases(self.testarg, split_nums,
                                        split_idx))