diff --git a/hpvm/scripts/llvm_installer.sh b/hpvm/scripts/llvm_installer.sh index 9c71f865c0799c3f380c21c0c45a31b8ba53dcb3..6867cf64f4d8cb7c28a43ed3c3b85e4dc1b403cf 100755 --- a/hpvm/scripts/llvm_installer.sh +++ b/hpvm/scripts/llvm_installer.sh @@ -1,5 +1,14 @@ #!/bin/bash +function read_yn { + read -p "$1 [y/n]: " read_value + while [ ! $read_value == "y" ] && [ ! $read_value == "n" ]; do + echo "Please answer y or n; got $read_value" + read -p "$1 [y/n]:" read_value + done + eval $2=$read_value +} + VERSION="9.0.0" URL="http://releases.llvm.org" @@ -19,14 +28,7 @@ LLVM_SRC="llvm-$VERSION.src" HPVM_RT=hpvm-rt/hpvm-rt.bc -AUTOMATE="y" - -read -p "Build and install HPVM automatically? (y or n): " AUTOMATE - -if [ ! $AUTOMATE == "y" ] && [ ! $AUTOMATE == "n" ]; then - echo invalid input! - exit -1 -fi +read_yn "Build and install HPVM automatically?" AUTOMATE echo read -p "Number of threads: " NUM_THREADS @@ -141,6 +143,21 @@ echo make -j$NUM_THREADS make -j$NUM_THREADS #make install +read_yn "Download weights necessary to run DNN benchmarks?" DOWNLOAD_WEIGHTS +if [ $DOWNLOAD_WEIGHTS == "y" ]; then + # First get hands on gdown -- google drive downloader + wget https://raw.githubusercontent.com/circulosmeos/gdown.pl/master/gdown.pl -O gdown.pl + chmod +x ./gdown.pl + # Download the zip file from google drive + ./gdown.pl 'https://drive.google.com/file/d/1V_yd9sKcZQ7zhnO5YhRpOsaBPLEEvM9u' model_params.zip + unzip model_params.zip # should give a "model_params" folder + mv model_params $BUILD_DIR + # All our benchmarks also know to look for parameters in <build_dir>/model_params. + # Cleanup: + rm gdown.pl model_params.zip +else + echo "Skipping weight download" +fi if [ -f $BUILD_DIR/tools/hpvm/projects/$HPVM_RT ]; then true