diff --git a/start.bat b/start.bat new file mode 100755 index 0000000..dd04e14 --- /dev/null +++ b/start.bat @@ -0,0 +1,23 @@ +@echo off + +REM Change directory to where the script is +cd /d "%~dp0" + +REM Check for Nvidia GPU using wmic, only NVIDIA check is supported +wmic path win32_VideoController get name | findstr /i "NVIDIA" >nul + +REM Capture the exit code +set gpu_available=%errorlevel% + +REM Execute commands based on GPU availability +if %gpu_available% equ 0 ( + echo NVIDIA GPU is available + docker.exe compose --env-file .env -f compose.yml -f compose-gpu.yml up --no-recreate --no-build -d +) else ( + echo NVIDIA GPU is not available + docker.exe compose --env-file .env -f compose.yml up --no-recreate --no-build -d +) + +REM EOF + + diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..83ee528 --- /dev/null +++ b/start.sh @@ -0,0 +1,29 @@ +#!/bin/sh +CURRENT_FILE=`readlink -f $0` +CURRENT_DIR=`dirname $CURRENT_FILE` +cd $CURRENT_DIR + +# Check if nvidia-smi is available +if command -v nvidia-smi &> /dev/null; then + if nvidia-smi > /dev/null 2>&1; then + echo "Nvidia GPU found." + # Run the command for when GPU is available + docker compose --env-file .env \ + -f compose.yml -f compose-gpu.yml \ + up --no-recreate --no-build -d + else + echo "Nvidia GPU not found." + # Run the command for when GPU is not available + docker compose --env-file .env \ + -f compose.yml \ + up --no-recreate --no-build -d + fi +else + echo "nvidia-smi command not found. Nvidia GPU not available." + # Run the command for when GPU is not available + docker compose --env-file .env \ + -f compose.yml \ + up --no-recreate --no-build -d +fi + +# EOF