Skip to content
Snippets Groups Projects
Commit 5dfa69f6 authored by Akash Kothari's avatar Akash Kothari
Browse files

Add code to install NVDLA compiler

parent 3291eae1
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,14 @@ MODEL_PARAMS_TAR = Path("model_params.tar.gz")
MODEL_PARAMS_DIR = ROOT_DIR / "test/dnn_benchmarks/model_params"
MODEL_PARAMS_LINK = "https://databank.illinois.edu/datafiles/o3izd/download"
NVDLA_URL = "https://github.com/nvdla/sw.git"
NVDLA_DIR = ROOT_DIR / "sw"
NVDLA_UMD_DIR = NVDLA_DIR / "umd"
PROTOBUF_DIR = NVDLA_UMD_DIR / "external/protobuf-2.6"
PROTOBUF_STATIC_LIB = PROTOBUF_DIR / "src/.libs/libprotobuf.a"
COMPILER_APPS_DIR = NVDLA_UMD_DIR / "apps/compiler"
COMPILER_CORE_DIR = NVDLA_UMD_DIR / "core/src/compiler"
LINKS = [
"CMakeLists.txt",
"cmake",
......@@ -262,6 +270,14 @@ def check_download_model_params():
if MODEL_PARAMS_TAR.is_file():
MODEL_PARAMS_TAR.unlink()
def check_download_nvdla_sw():
if NVDLA_DIR.is_dir():
print("Found NVDLA compiler, not downloading it again.")
return
print(f"Downloading the NVDLA compiler...")
print(f"=============================")
check_call(["git", "clone", NVDLA_URL])
def link_and_patch():
from os import symlink
......@@ -282,6 +298,17 @@ def link_and_patch():
chdir(cwd)
def build_nvdla_compiler():
print("Building NVDLA compiler...")
chdir(PROTOBUF_DIR)
check_call(["./autogen.sh"])
check_call(["./configure"])
check_call(["make"])
check_call(["cp", PROTOBUF_STATIC_LIB, COMPILER_CORE_DIR])
check_call(["cp", PROTOBUF_STATIC_LIB, COMPILER_APPS_DIR])
chdir(NVDLA_UMD_DIR)
check_call(["make", "TOP=" + str(NVDLA_UMD_DIR)])
def build(
build_dir: Path,
nthreads: int,
......@@ -295,6 +322,7 @@ def build(
cwd = Path.cwd()
chdir(build_dir)
build_nvdla_compiler()
cmake_args = [
"cmake",
str(ROOT_DIR / "llvm"),
......@@ -359,6 +387,7 @@ def main():
if not args.no_pypkg:
check_python_version()
print_args(args)
check_download_nvdla_sw()
check_download_llvm_clang()
link_and_patch()
if not args.no_params:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment