Skip to content

Commit

Permalink
added non-interactive build option
Browse files Browse the repository at this point in the history
  • Loading branch information
dusty-nv committed Apr 16, 2020
1 parent a50d510 commit 9c7ec45
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ endif()
# setup tensorRT flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-write-strings -Wno-deprecated-declarations") # -std=c++14
set(BUILD_DEPS "YES" CACHE BOOL "If YES, will install dependencies into sandbox. Automatically reset to NO after dependencies are installed.")
set(BUILD_INTERACTIVE "YES" CACHE BOOL "If NO, will download/install the default DNN models without prompting the user, and skip installation of PyTorch.")


# copy configuration tools to build dir
Expand All @@ -37,8 +38,9 @@ file(COPY "tools/install-pytorch.rc" DESTINATION ${PROJECT_BINARY_DIR})
# if this is the first time running cmake, perform pre-build dependency install script (or if the user manually triggers re-building the dependencies)
if( ${BUILD_DEPS} )
message("-- Launching pre-build dependency installer script...")
message("-- Build interactive: ${BUILD_INTERACTIVE}")

execute_process(COMMAND sh ../CMakePreBuild.sh
execute_process(COMMAND sh ../CMakePreBuild.sh ${BUILD_INTERACTIVE}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
RESULT_VARIABLE PREBUILD_SCRIPT_RESULT)

Expand Down
8 changes: 5 additions & 3 deletions CMakePreBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
# this script is automatically run from CMakeLists.txt

BUILD_ROOT=$PWD
BUILD_INTERACTIVE=$1

echo "[Pre-build] dependency installer script running..."
echo "[Pre-build] build root directory: $BUILD_ROOT"
echo "[Pre-build] build root directory: $BUILD_ROOT"
echo "[Pre-build] build interactive: $BUILD_INTERACTIVE"
echo " "


Expand All @@ -22,11 +24,11 @@ sudo apt-get update


# run the model downloader
./download-models.sh
./download-models.sh $BUILD_INTERACTIVE


# run the pytorch installer
./install-pytorch.sh
./install-pytorch.sh $BUILD_INTERACTIVE


echo "[Pre-build] Finished CMakePreBuild script"
29 changes: 29 additions & 0 deletions tools/download-models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ APP_TITLE="Hello AI World (jetson-inference)"
OUTPUT_DIR="../data/networks"
LOG="[jetson-inference] "
WGET_QUIET="--quiet"
BUILD_INTERACTIVE=$1


#
Expand Down Expand Up @@ -588,6 +589,34 @@ function install_deb_package()
}


#
# non-interactive mode
#
echo "$LOG BUILD_INTERACTVE=$BUILD_INTERACTIVE"

if [[ "$BUILD_INTERACTIVE" != "YES" ]]; then

echo "$LOG Downloading default models..."

download_googlenet
download_resnet18

download_ssd_mobilenet_v2
download_pednet
download_facenet
download_detectnet_coco_dog

download_fcn_resnet18_cityscapes_512x256
download_fcn_resnet18_cityscapes_1024x512
download_fcn_resnet18_deepscene_576x320
download_fcn_resnet18_mhp_512x320
download_fcn_resnet18_pascal_voc_320x320
download_fcn_resnet18_sun_rgbd_512x400

exit_message 0
fi


# check for dialog package
install_deb_package "dialog" FOUND_DIALOG
echo "$LOG FOUND_DIALOG=$FOUND_DIALOG"
Expand Down
16 changes: 14 additions & 2 deletions tools/install-pytorch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
APP_TITLE="Hello AI World (jetson-inference)"
LOG="[jetson-inference] "
WGET_QUIET="--quiet"
BUILD_INTERACTIVE=$1


#
Expand Down Expand Up @@ -353,6 +354,17 @@ function check_L4T_version()
}


#
# non-interactive mode
#
echo "$LOG BUILD_INTERACTVE=$BUILD_INTERACTIVE"

if [[ "$BUILD_INTERACTIVE" != "YES" ]]; then
echo "$LOG non-interactive mode, skipping PyTorch install..."
exit_message 0
fi


# check for dialog package
install_deb_package "dialog" FOUND_DIALOG
echo "$LOG FOUND_DIALOG=$FOUND_DIALOG"
Expand All @@ -371,9 +383,9 @@ while true; do

packages_selected=$(dialog --backtitle "$APP_TITLE" \
--title "PyTorch Installer (L4T R$JETSON_L4T_VERSION)" \
--cancel-label "Quit" \
--cancel-label "Skip" \
--colors \
--checklist "If you want to train DNN models on your Jetson, this tool will download and install PyTorch. Select the desired versions of pre-built packages below, or see \Zbhttp://eLinux.org/Jetson_Zoo\Zn for instructions to build from source. \n\nYou can skip this step and select Quit if you don't want to install PyTorch.\n\n\ZbKeys:\Zn\n ↑↓ Navigate Menu\n Space to Select \n Enter to Continue\n\n\ZbPackages to Install:\Zn" 20 80 2 \
--checklist "If you want to train DNN models on your Jetson, this tool will download and install PyTorch. Select the desired versions of pre-built packages below, or see \Zbhttp://eLinux.org/Jetson_Zoo\Zn for instructions to build from source. \n\nYou can skip this step and select Skip if you don't want to install PyTorch.\n\n\ZbKeys:\Zn\n ↑↓ Navigate Menu\n Space to Select \n Enter to Continue\n\n\ZbPackages to Install:\Zn" 20 80 2 \
--output-fd 1 \
1 "PyTorch v1.1.0 for Python 2.7" off \
2 "PyTorch v1.1.0 for Python 3.6" off \
Expand Down

0 comments on commit 9c7ec45

Please sign in to comment.