forked from ROCm/Tensile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
50 lines (44 loc) · 1.45 KB
/
Copy pathtasks.py
File metadata and controls
50 lines (44 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from invoke.tasks import task
dir = "build_hostlibtest"
def cmake_configure(c, coverage):
cov = "ON" if coverage else "OFF"
command = (
"cmake "
f"-B `pwd`/{dir} "
"-S `pwd`/HostLibraryTests "
"-DCMAKE_BUILD_TYPE=Debug "
"-DCMAKE_CXX_COMPILER=amdclang++ "
'-DCMAKE_CXX_FLAGS="-D__HIP_HCC_COMPAT_MODE__=1" '
"-DTensile_CPU_THREADS=8 "
"-DTensile_ROOT=`pwd`/Tensile "
"-DTensile_VERBOSE=1 "
f"-DTENSILE_ENABLE_COVERAGE={cov}"
)
c.run(command, pty=True)
def cmake_build(c):
c.run(f"cmake --build `pwd`/{dir} -j4", pty=True)
def run_tests(c, coverage):
if coverage:
c.run(f"cmake --build `pwd`/{dir} --target coverage --parallel", pty=True)
else:
c.run("./{dir}/TensileTests")
def clean_build(c):
c.run(f"rm -rf {dir}")
@task(
help={
"clean": "Remove the build directory before building.",
"configure": "Run CMake configuration step.",
"build": "Compile the Tensile HostLib tests.",
"run": "Run tests or generate coverage depending on the flag.",
"coverage": "Enable code coverage and reporting.",
}
)
def hostlibtest(c, clean=False, configure=False, build=False, run=False, coverage=False):
if clean:
clean_build(c)
if configure:
cmake_configure(c, coverage)
if build:
cmake_build(c)
if run:
run_tests(c, coverage)