diff --git a/CUDA_install.json b/CUDA_install.json new file mode 100644 index 000000000..288cb0ab6 --- /dev/null +++ b/CUDA_install.json @@ -0,0 +1,130 @@ +{ + "WSL" : [ + "wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin", + "mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600", + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-wsl-ubuntu-12-6-local_12.6.2-1_amd64.deb", + "dpkg -i cuda-repo-wsl-ubuntu-12-6-local_12.6.2-1_amd64.deb", + "cp /var/cuda-repo-wsl-ubuntu-12-6-local/cuda-*-keyring.gpg /usr/share/keyrings/", + "apt-get update", + "apt-get -y install cuda-toolkit-12-6" + ], + "Ubuntu_24.04_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin", + "mv cuda-ubuntu2404.pin /etc/apt/preferences.d/cuda-repository-pin-600", + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-ubuntu2404-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "dpkg -i cuda-repo-ubuntu2404-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "cp /var/cuda-repo-ubuntu2404-12-6-local/cuda-*-keyring.gpg /usr/share/keyrings/", + "apt-get update", + "apt-get -y install cuda-toolkit-12-6", + "apt-get install -y nvidia-open" + ], + "Ubuntu_22.04_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin", + "mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600", + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-ubuntu2204-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "dpkg -i cuda-repo-ubuntu2204-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "cp /var/cuda-repo-ubuntu2204-12-6-local/cuda-*-keyring.gpg /usr/share/keyrings/", + "apt-get update", + "apt-get -y install cuda-toolkit-12-6", + "apt-get install -y nvidia-open" + ], + "Ubuntu_20.04_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin", + "mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600", + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-ubuntu2004-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "dpkg -i cuda-repo-ubuntu2004-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "cp /var/cuda-repo-ubuntu2004-12-6-local/cuda-*-keyring.gpg /usr/share/keyrings/", + "apt-get update", + "apt-get -y install cuda-toolkit-12-6", + "apt-get install -y nvidia-open" + ], + "SLES_15_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-sles15-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-sles15-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "zypper refresh", + "zypper install -y cuda-toolkit-12-6", + "zypper install -y nvidia-open" + ], + "Rocky_8_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-rhel8-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-rhel8-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "dnf clean all", + "dnf -y install cuda-toolkit-12-6", + "dnf -y module install nvidia-driver:open-dkms" + ], + "Rocky_9_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-rhel9-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-rhel9-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "dnf clean all", + "dnf -y install cuda-toolkit-12-6", + "dnf -y module install nvidia-driver:open-dkms" + ], + "RHEL_8_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-rhel8-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-rhel8-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "dnf clean all", + "dnf -y install cuda-toolkit-12-6", + "dnf -y module install nvidia-driver:open-dkms" + ], + "RHEL_9_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-rhel9-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-rhel9-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "dnf clean all", + "dnf -y install cuda-toolkit-12-6", + "dnf -y module install nvidia-driver:open-dkms" + ], + "OpenSUSE_15_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-opensuse15-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-opensuse15-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "zypper refresh", + "zypper install -y cuda-toolkit-12-6", + "zypper install -y nvidia-open" + ], + "KylinOS_10_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-kylin10-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-kylin10-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "dnf clean all", + "dnf -y install cuda-toolkit-12-6", + "dnf -y module install nvidia-driver:open-dkms" + ], + "Fedora_39_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-fedora39-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-fedora39-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "dnf clean all", + "dnf -y install cuda-toolkit-12-6", + "dnf -y module install nvidia-driver:open-dkms" + ], + "Debian_11_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-debian11-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "dpkg -i cuda-repo-debian11-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "cp /var/cuda-repo-debian11-12-6-local/cuda-*-keyring.gpg /usr/share/keyrings/", + "add-apt-repository contrib", + "apt-get update", + "apt-get -y install cuda-toolkit-12-6", + "apt-get install -y nvidia-open" + ], + "Debian_12_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-debian12-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "dpkg -i cuda-repo-debian12-12-6-local_12.6.2-560.35.03-1_amd64.deb", + "cp /var/cuda-repo-debian12-12-6-local/cuda-*-keyring.gpg /usr/share/keyrings/", + "add-apt-repository contrib", + "apt-get update", + "apt-get -y install cuda-toolkit-12-6", + "apt-get install -y nvidia-open" + ], + "Azure-Linux_2_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-cm2-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-cm2-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "tdnf -y install mariner-repos-extended", + "tdnf clean all", + "tdnf -y install cuda-toolkit-12-6", + "tdnf -y install nvidia-open" + ], + "Amazon-Linux_2023_x86_64" : [ + "wget https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda-repo-amzn2023-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "rpm -i cuda-repo-amzn2023-12-6-local-12.6.2_560.35.03-1.x86_64.rpm", + "dnf clean all", + "dnf -y install cuda-toolkit-12-6", + "dnf -y module install nvidia-driver:open-dkms" + ] +} diff --git a/dependencies.sh b/dependencies.sh new file mode 100644 index 000000000..fa5ac4252 --- /dev/null +++ b/dependencies.sh @@ -0,0 +1,233 @@ +#!/usr/bin/env bash + +################################################ +## Install package dependencies for Helios. ## +# +## Use one of the following arguments to choose +## which dependencies to install. Default (if +## no argument provided) is "all". +# +# ARGUMENT +# option: Choice of which dependencies to +# install (default is "all"). +# See below. +# +# OPTIONS +# BASE: Install GCC, G++, and CMake +# Required to run Helios. +# VIS: Install base dependencies + X11/xorg +# Required for Visualizer plugin. +# CUDA: Install base dependencies + CUDA +# Required for 1. Radiation, 2. Energy +# Balance, 3. LiDAR, 4. Aerial LiDAR, +# and 5. Voxel Intersection plugins. +# ALL: Install dependencies for ALL plugins +# +# EXAMPLE +# source dependencies.sh BASE +# +################################################ + +DEPENDENCIES_PATH=("gcc" "g++" "cmake" "wget" "jq" "pybind11") # Base PATH dependencies + +# Run bash script as root +if command -v nvcc &> /dev/null; then + ROOT="sudo" +else + echo "'sudo' command not found. Please run this script as root." + ROOT="" +fi + +# Runs command and clears output from terminal after completion. +run_command_clear_output() { + run_command="$1" + out_file=$(mktemp) + # Install package and store output to temporary file + eval "$run_command" 2>&1 | tee "$out_file" + # Clear output from terminal + num_lines=$(wc -l < "$out_file") + for ((i=0; i /dev/null; then + PACKAGE_MANAGER="$ROOT apt-get" + CHECK_EXISTS="dpkg -l | grep -w -m 1" + elif command -v yum &> /dev/null; then + PACKAGE_MANAGER="$ROOT yum" + CHECK_EXISTS="rpm -qa | grep -w -m 1" + elif command -v dnf &> /dev/null; then + PACKAGE_MANAGER="$ROOT dnf" + CHECK_EXISTS="rpm -qa | grep -w -m 1" + elif command -v tdnf &> /dev/null; then + PACKAGE_MANAGER="$ROOT tdnf" + CHECK_EXISTS="rpm -qa | grep -w -m 1" + elif command -v zypper &> /dev/null; then + PACKAGE_MANAGER="$ROOT zypper" + CHECK_EXISTS="zypper se --installed-only | grep -w -m 1" + elif command -v pacman &> /dev/null; then + PACKAGE_MANAGER="$ROOT pacman" + CHECK_EXISTS="pacman -Qs | grep -w -m 1" + else + echo "No package manager detected. Exiting..." + exit 1 + fi + if [[ "$MODE" == "all" || "$MODE" == "vis" ]]; then + DEPENDENCIES_PATH+=("libx11-dev" "xorg-dev" "libgl1-mesa-dev" "libglu1-mesa-dev" "libxrandr-dev" "python3-dev") + fi + FLAG="-y" + export DEBIAN_FRONTEND=noninteractive # Avoid timezone prompts +else + echo "Unsupported OS." + exit 1 +fi + +# Update package list +run_command_clear_output "$PACKAGE_MANAGER update $FLAG" + +# Install PATH dependencies +for package in "${DEPENDENCIES_PATH[@]}"; do + if command -v "$package" &> /dev/null; then + echo "$package already installed at: $(command -v $package)" + elif eval "$CHECK_EXISTS \"$package\" &> /dev/null"; then + echo "$package already installed." + else + echo "Installing $package..." + run_command_clear_output "$PACKAGE_MANAGER install $FLAG $package" + if command -v "$package" &> /dev/null; then + echo "$package installed at: $(command -v $package)" + else + echo "$package installed." + fi + fi +done + +# If host is macOS or host is Linux and CUDA not needed, dependencies already installed successfully. +if [[ "$OSTYPE" == "darwin"* || "$MODE" == "base" || "$MODE" == "vis" ]]; then + echo "Finished installing dependencies." + exit 0 +fi + +# Get Linux distribution & version +os_name=$(cat /etc/os-release | grep "^NAME=" | cut -d '"' -f 2 | awk '{print $1}') +version_id=$(cat /etc/os-release | grep "^VERSION_ID=" | cut -d '"' -f 2) +architecture=$(uname -m) +distro="${os_name}_${version_id}_${architecture}" +if cat /proc/version | grep -o WSL &> /dev/null; then + if cat /proc/version | grep -o WSL2 &> /dev/null; then + distro="WSL" + else + echo "Install the latest version of WSL2 for running Linux GUI applications!" + exit 1 + fi +fi + +# If host is Linux, need to install CUDA +if command -v nvcc &> /dev/null; then + echo "CUDA version $( nvcc --version | grep -oP 'V\d+\.\d+\.\d+' | awk -F'V' '{print $2}' ) already installed at $(command -v nvcc)" +else + echo "Installing CUDA for $distro..." + mapfile -t CUDA_COMMANDS < <(jq -r ".\"$distro\"[]" CUDA_install.json) + + # Verify that CUDA_COMMANDS were loaded correctly + if [ ${#CUDA_COMMANDS[@]} -eq 0 ]; then + echo "Error: No CUDA installation for $distro found in CUDA_install.json. Exiting..." + exit 1 + fi + + # Install CUDA + for install_command in "${CUDA_COMMANDS[@]}"; do + run_command_clear_output "$ROOT $install_command" + done +fi + +# Add nvcc to path +export PATH=/usr/local/cuda/bin:$PATH + +# Fix OptiX drivers for WSL +if [[ "$distro" == "WSL" ]]; then + # Automatically install Linux drivers version 470.256.02 + DRIVER_URL="https://us.download.nvidia.com/XFree86/Linux-x86_64/470.256.02/NVIDIA-Linux-x86_64-470.256.02.run" + DRIVER_FILE="NVIDIA-Linux-x86_64-470.256.02.run" + wget -O $DRIVER_FILE $DRIVER_URL + + LINUX_DRIVER=$(find . -name "NVIDIA-Linux-x86_64-*.run" -print -quit) + if [[ -n "$LINUX_DRIVER" ]]; then + VERSION=$(echo "$LINUX_DRIVER" | sed -E 's/.*NVIDIA-Linux-x86_64-([0-9.]+)\.run/\1/') + echo "Linux Driver Version $VERSION Found. Installing..." + run_command_clear_output "./$LINUX_DRIVER -x" + LINUX_DRIVER_PATH="${LINUX_DRIVER%.run}" + else + echo "Linux Driver not found. Please place Linux Driver .run file in Helios root directory and rerun this script." + echo -e "Linux drivers can be downloaded \e]8;;https://www.nvidia.com/en-in/drivers/unix/\aHERE\e]8;;\a. Version \e]8;;https://www.nvidia.in/Download/driverResults.aspx/227064/en-in\a470.256.02\e]8;;\a (https://www.nvidia.in/Download/driverResults.aspx/227064/en-in) recommended." + exit 1 + fi + LXSS="/mnt/c/Windows/System32/lxss/lib/" + OPTIX_DRIVERS_PATH="$(pwd)/$LINUX_DRIVER_PATH/" + DRIVERS=("libnvoptix.so.1" "libnvidia-ptxjitcompiler.so.1") + if [[ ! -f "$LXSS/libnvidia-ptxjitcompiler.so.1" || ! -f "$LXSS/libnvoptix.so.1" ]]; then + mkdir -p "$LXSS" + ln -s "$OPTIX_DRIVERS_PATH/libnvidia-rtcore.so.$VERSION" "$LXSS/libnvidia-rtcore.so.$VERSION" + ln -s "$OPTIX_DRIVERS_PATH/libnvidia-ptxjitcompiler.so.$VERSION" "$LXSS/libnvidia-ptxjitcompiler.so.1" + ln -s "$OPTIX_DRIVERS_PATH/libnvoptix.so.$VERSION" "$LXSS/libnvoptix.so.1" + export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH + fi +fi + +echo "Finished installing $MODE dependencies." +exit 0 diff --git a/doc/UserGuide.dox b/doc/UserGuide.dox index 82e581e37..471174cb3 100755 --- a/doc/UserGuide.dox +++ b/doc/UserGuide.dox @@ -223,10 +223,28 @@ $ git pull 4. Double-click TdrDelay and add 600 for the Value data and make it a Decimal (instead of Hexadecimal). Click OK. If you encounter the same "Display driver stopped responding and has recovered" error in the future, increase the value. 5. Close the registry editor and restart the computer for the changes to take effect. + \subsubsection Automatically Installing Helios Dependencies + + Running Helios requires several packages to be installed. To install all required packages for all plugins automatically, simply run the following shell script with the argument "ALL" (or with no arguments): `source dependencies.sh` + + There are a few additional options for installing dependencies if it is not necessary to use all plugins. + + To install only the dependencies required to run Helios with no plugins (or plugins that require no packages), use the argument "BASE": `source dependencies.sh BASE` + + To install only the dependencies required to run Helios with the visualizer plugin, use the argument "VIS": `source dependencies.sh VIS` + + To install only the dependencies required to run Helios with CUDA (required for the Radiation, Energy Balance, LiDAR, Aerial LiDAR, and Voxel Intersection plugins), use the argument "CUDA": `source dependencies.sh CUDA` + + Note that this script only works for macOS and Linux operating systems. Windows users must install dependencies manually. Also note that CUDA is incompatible with macOS, and Mac users cannot run or install dependencies for the plugins that require CUDA. + \subsubsection OptiXWSL Manually installing OptiX if using Windows Subsystem for Linux (WSL) OptiX is normally packaged with Helios, such that you do not have to worry about installing it. However, if you are using Windows Subsystem for Linux (WSL), you will need to manually install OptiX since the version included with Helios does not have the required drivers for WSL. You can follow the instructions on this site to perform the installation: https://forums.developer.nvidia.com/t/problem-running-optix-7-6-in-wsl/239355/7. + Alternatively, simply run the dependencies script: `source dependencies.sh` + + This will automatically install and configure the Linux drivers (version 470.256.02) to run OptiX. + \section SetupLinux Set-up on Linux \subsection SetupLinuxCLion Setting up basic build functionality diff --git a/plugins/syntheticannotation/src/SyntheticAnnotation.cpp b/plugins/syntheticannotation/src/SyntheticAnnotation.cpp index 012112902..87898c5ac 100644 --- a/plugins/syntheticannotation/src/SyntheticAnnotation.cpp +++ b/plugins/syntheticannotation/src/SyntheticAnnotation.cpp @@ -317,7 +317,7 @@ void SyntheticAnnotation::render( const char* outputdir ) { vis_RGB.plotUpdate( true ); - wait(5); + helios::wait(5); outfile.clear(); outfile.str("");