Skip to content

Commit b15fc3d

Browse files
committed
Update bot build script to support whether GPU is available or not
1 parent f788ca3 commit b15fc3d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

bot/build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,15 @@ mkdir -p ${TARBALL_TMP_BUILD_STEP_DIR}
223223
BUILD_STEP_ARGS+=("--save" "${TARBALL_TMP_BUILD_STEP_DIR}")
224224
BUILD_STEP_ARGS+=("--storage" "${STORAGE}")
225225
# add options required to handle NVIDIA support
226-
BUILD_STEP_ARGS+=("--nvidia" "all")
226+
if command_exists "nvidia-smi"; then
227+
echo "Command 'nvidia-smi' found, using available GPU"
228+
BUILD_STEP_ARGS+=("--nvidia" "all")
229+
else
230+
echo "No 'nvidia-smi' found, no available GPU but allowing overriding this check"
231+
BUILD_STEP_ARGS+=("--nvidia" "install")
232+
fi
233+
# Retain location for host injections so we don't reinstall CUDA
234+
# (Always need to run the driver installation as available driver may change)
227235
if [[ ! -z ${SHARED_FS_PATH} ]]; then
228236
BUILD_STEP_ARGS+=("--host-injections" "${SHARED_FS_PATH}/host-injections")
229237
fi

scripts/utils.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ function create_directory_structure() {
7878
return $return_code
7979
}
8080

81+
# Function to check if a command exists
82+
function command_exists() {
83+
command -v "$1" >/dev/null 2>&1
84+
}
85+
8186
function get_path_for_tool {
8287
tool_name=$1
8388
tool_envvar_name=$2

0 commit comments

Comments
 (0)