Skip to content
Snippets Groups Projects
Commit 3c362a49 authored by Simon Schwitanski's avatar Simon Schwitanski :slight_smile:
Browse files

Updates on paths add Corrbench support

parent 4118322f
No related branches found
No related tags found
No related merge requests found
......@@ -167,8 +167,8 @@ def cmd_build(rootdir, toolname):
def cmd_run(rootdir, toolname, batchinfo):
# Go to the tools' logs directory on need
rootdir = os.path.dirname(os.path.abspath(__file__))
os.makedirs(f'{rootdir}/{args.logs_dir}/{toolname}', exist_ok=True)
os.chdir(f'{rootdir}/{args.logs_dir}/{toolname}')
os.makedirs(f'{args.logs_dir}/{toolname}', exist_ok=True)
os.chdir(f'{args.logs_dir}/{toolname}')
print(f"Run tool {toolname} from {os.getcwd()} (batch {batchinfo}).")
tools[toolname].set_rootdir(rootdir)
......
......@@ -90,16 +90,30 @@ class V18(AbstractTool):
def run(self, execcmd, filename, binary, id, number, timeout, batchinfo, loglevel=logging.INFO):
cachefile = f'{binary}_{id}'
base_file = os.path.basename(filename)
# split folder until "level-0" is found
# this is the first folder in the path, which is used as a base for the
# llvm profile file name
# e.g. /path/to/level-0/test.c -> level-0
# e.g. /path/to/level-0/subfolder/test.c -> level-
# Hack for CorrBench execution
if execcmd == "" or execcmd.startswith("-I"):
compile_flags = f'{execcmd} -DEXCLUDE_TYPEART_UNSUPPORTED_FUNCTIONS=1'
# Hard code execcmd with two ranks for CorrBench
execcmd = f"mustrun {self.must_arguments} -np 2 ./{binary}"
cov_subfolder = os.path.dirname(filename).split("0-level")[1]
else:
execcmd = re.sub(
"mpirun", f"mustrun {self.must_arguments}", execcmd)
execcmd = re.sub('\${EXE}', f'./{binary}', execcmd)
execcmd = re.sub('\$zero_buffer', "", execcmd)
execcmd = re.sub('\$infty_buffer', "", execcmd)
compile_flags = ""
cov_subfolder = os.path.dirname(filename).split(os.sep)[-1]
self.coverage_profraw_file = f"{self.llvm_profile_folder}/{base_file}/{base_file}.%p.profraw"
self.coverage_profraw_file_pattern = f"{self.llvm_profile_folder}/{base_file}/*.profraw"
self.coverage_merged_file = f"{self.llvm_profile_folder}/{base_file}.profdata"
self.coverage_profraw_file = f"{self.llvm_profile_folder}/{cov_subfolder}/{base_file}/{base_file}.%p.profraw"
self.coverage_profraw_file_pattern = f"{self.llvm_profile_folder}/{cov_subfolder}/{base_file}/*.profraw"
self.coverage_merged_file = f"{self.llvm_profile_folder}/{cov_subfolder}/{base_file}.profdata"
with tempfile.TemporaryDirectory() as tmpdirname:
current_env = os.environ.copy()
current_env['GTI_CRASH_SLEEP_TIME'] = "0"
......@@ -113,7 +127,7 @@ class V18(AbstractTool):
tsan_flag = ""
ran = self.run_cmd(
buildcmd=f"typeart-mpicc -g -fPIC {tsan_flag} -fprofile-instr-generate -fcoverage-mapping {filename} -o {tmpdirname}/{binary}",
buildcmd=f"typeart-mpicc -g -fPIC {tsan_flag} {compile_flags} -fprofile-instr-generate -fcoverage-mapping {filename} -o {tmpdirname}/{binary}",
execcmd=execcmd,
cachefile=cachefile,
filename=filename,
......@@ -214,7 +228,7 @@ class V18(AbstractTool):
here = os.getcwd()
os.chdir(self.llvm_profile_folder)
subprocess.run(
f"llvm-profdata merge -sparse *.profdata -o {self.coverage_profile}",
f"llvm-profdata merge -sparse **/*.profdata -o {self.coverage_profile}",
shell=True,
check=True,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment