From 938c02539a1cd25cf7b56fb91f2509d48b951611 Mon Sep 17 00:00:00 2001 From: Hashim Sharif <hsharif3@miranda.cs.illinois.edu> Date: Wed, 31 Mar 2021 21:25:52 -0500 Subject: [PATCH] Restoring hpvm_installer fixes made by Yifan --- hpvm/scripts/hpvm_installer.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hpvm/scripts/hpvm_installer.py b/hpvm/scripts/hpvm_installer.py index cafc35720a..255b2864ea 100755 --- a/hpvm/scripts/hpvm_installer.py +++ b/hpvm/scripts/hpvm_installer.py @@ -5,10 +5,9 @@ from pathlib import Path from subprocess import CalledProcessError, check_call from typing import List - VERSION = "9.0.0" URL = "http://releases.llvm.org" -WGET = "wget" +DOWNLOADER = "curl" CLANG_DIR = f"cfe-{VERSION}.src" CLANG_TARBALL = f"{CLANG_DIR}.tar.xz" LLVM_DIR = f"llvm-{VERSION}.src" @@ -150,11 +149,10 @@ def prompt_args(): Example: "DCMAKE_BUILD_TYPE=Release DCMAKE_INSTALL_PREFIX=install". Arguments: """ ) - args.cmake_args = input() if args.cmake_args.strip() != "": args.cmake_args = [f"-{arg}" for arg in args.cmake_args.split(" ")] - + args.no_params = not input_with_check( "Download DNN weights (recommended)? [y/n]: ", parse_yn, "Please enter y or n" ) @@ -184,7 +182,7 @@ def check_download_llvm_clang(): else: print(f"Downloading {LLVM_TARBALL}...") print(f"=============================") - check_call([WGET, f"{URL}/{VERSION}/{LLVM_TARBALL}"]) + download(f"{URL}/{VERSION}/{LLVM_TARBALL}", LLVM_TARBALL) check_call(["tar", "xf", LLVM_TARBALL]) check_call(["mv", LLVM_DIR, "llvm"]) tools = Path("llvm/tools") @@ -199,7 +197,7 @@ def check_download_llvm_clang(): chdir(tools) print(f"Downloading {CLANG_TARBALL}...") print(f"=============================") - check_call([WGET, f"{URL}/{VERSION}/{CLANG_TARBALL}"]) + download(f"{URL}/{VERSION}/{CLANG_TARBALL}", CLANG_TARBALL) check_call(["tar", "xf", CLANG_TARBALL]) check_call(["mv", CLANG_DIR, "clang"]) assert Path("clang/").is_dir(), "Problem with clang download. Exiting!" @@ -217,7 +215,7 @@ def check_download_model_params(): else: print(f"Downloading DNN model parameters: {MODEL_PARAMS_TAR}...") print(f"=============================") - check_call([WGET, MODEL_PARAMS_LINK, "-O", MODEL_PARAMS_TAR]) + download(MODEL_PARAMS_LINK, MODEL_PARAMS_TAR) print( f"Extracting DNN model parameters {MODEL_PARAMS_TAR} => {MODEL_PARAMS_DIR}..." ) @@ -313,6 +311,10 @@ def input_with_check(prompt: str, parse, prompt_when_invalid: str): return value +def download(link: str, output: Path): + check_call(["curl", "-L", link, "-o", output]) + + def main(): from sys import argv -- GitLab