Skip to content

Commit 757acbf

Browse files
committed
Improve GPU install scripts
1 parent 98be827 commit 757acbf

File tree

2 files changed

+57
-9
lines changed

2 files changed

+57
-9
lines changed

gpu/scripts/install_ViennaPS_linux.sh

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
# 2. VTK >= 9.0.0
66
# (on Ubuntu 24.04, you can install them using the command: sudo apt install -y libvtk9-dev libembree-dev)
77

8+
# Check if the script is run with bash
9+
if [ -z "$BASH_VERSION" ]; then
10+
echo "This script must be run with bash. Please run it using: bash install_ViennaPS_linux.sh <-v|--verbose>"
11+
exit 1
12+
fi
13+
14+
# Check if verbose mode is enabled
15+
verbose_flag=""
16+
if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then
17+
echo "Verbose mode is enabled."
18+
verbose_flag="-v"
19+
else
20+
echo "Verbose mode is disabled."
21+
fi
22+
823
# Directory for the virtual environment
924
read -r -p "Enter the path to the virtual environment directory (default: .venv): " venv_dir
1025
if [ -z "$venv_dir" ]; then
@@ -58,18 +73,36 @@ fi
5873
source $venv_dir/bin/activate
5974

6075
# Check if ViennaLS Python package is installed
76+
viennals_version_required="4.3.2"
6177
if ! pip show ViennaLS &> /dev/null; then
6278
echo "ViennaLS Python package is not installed. Local ViennaLS build is required."
63-
read -r -p "Enter the path to the ViennaLS directory (e.g., /path/to/ViennaLS): " viennals_dir
79+
read -r -p "Enter the path to the ViennaLS directory (e.g., /path/to/ViennaLS, press enter to download): " viennals_dir
6480
if [ -z "$viennals_dir" ]; then
65-
echo "No ViennaLS directory specified. Please provide a path."
66-
exit 1
81+
echo "No ViennaLS directory specified. Downloading version $viennals_version_required."
82+
mkdir ViennaLS_tmp_install
83+
git clone https://github.com/ViennaTools/ViennaLS.git ViennaLS_tmp_install
84+
cd ViennaLS_tmp_install || { echo "Failed to change directory to ViennaLS_tmp_install"; exit 1; }
85+
git checkout v$viennals_version_required &> /dev/null
86+
CC=gcc-12 CXX=g++-12 pip install . $verbose_flag
87+
cd ..
88+
rm -rf ViennaLS_tmp_install
6789
fi
6890
cd "$viennals_dir" || { echo "Failed to change directory to $viennals_dir"; exit 1; }
69-
CC=gcc-12 CXX=g++-12 pip install .
91+
CC=gcc-12 CXX=g++-12 pip install . $verbose_flag
7092
else
71-
echo "ViennaLS Python package is already installed. Local build is required."
72-
echo "If you want to reinstall, please uninstall it first using: pip uninstall ViennaLS"
93+
viennals_version=$(pip show ViennaLS | grep Version | awk '{print $2}')
94+
echo -e "\033[1;33m""ViennaLS Python package is already installed ($viennals_version). Local build is required.\033[0m"
95+
echo -e "\033[1;33m""If you want to reinstall, please uninstall it first using: pip uninstall ViennaLS\033[0m"
96+
read -r -p "Continue with the current version ($viennals_version)? (y/n): " continue_install
97+
if [[ "$continue_install" != "y" && "$continue_install" != "Y" ]]; then
98+
echo "Installation aborted."
99+
exit 1
100+
fi
101+
if [ "$viennals_version" != "$viennals_version_required" ]; then
102+
echo -e "\033[1;33m""Note: The version of ViennaLS is not $viennals_version_required, which may cause compatibility issues.\033[0m"
103+
echo -e "\033[1;33m""Please ensure you have the correct version installed.\033[0m"
104+
exit 1
105+
fi
73106
fi
74107

75108
# Check if current directory is ViennaPS
@@ -84,7 +117,7 @@ if [ "$viennaps_dir" != "ViennaPS" ]; then
84117
fi
85118

86119
# Install ViennaPS with GPU support (using gcc-12 and g++-12)
87-
OptiX_INSTALL_DIR=$optix_dir CC=gcc-12 CXX=g++-12 CMAKE_ARGS=-DVIENNAPS_FORCE_GPU=ON pip install . -v
120+
OptiX_INSTALL_DIR=$optix_dir CC=gcc-12 CXX=g++-12 CMAKE_ARGS=-DVIENNAPS_FORCE_GPU=ON pip install . $verbose_flag
88121

89122
echo "Installation complete. To activate the virtual environment, run:"
90123
echo "source $venv_dir/bin/activate"

gpu/scripts/install_ViennaTools_ubuntu.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@
33
# This script installs the ViennaTools package on Ubuntu 24.04 with GPU support.
44
# It attempts to install the required dependencies on the system, therefore sudo privileges are required.
55

6+
# Check if the script is run with bash
7+
if [ -z "$BASH_VERSION" ]; then
8+
echo "This script must be run with bash. Please run it using: bash install_ViennaTools_ubuntu.sh <-v|--verbose>"
9+
exit 1
10+
fi
11+
12+
# Check if verbose mode is enabled
13+
verbose_flag=""
14+
if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then
15+
echo "Verbose mode is enabled."
16+
verbose_flag="-v"
17+
else
18+
echo "Verbose mode is disabled."
19+
fi
20+
621
# Check ubuntu version
722
if [ "$(lsb_release -rs)" != "24.04" ]; then
823
echo "This script is intended for Ubuntu 24.04. Please run it on the correct version."
@@ -112,12 +127,12 @@ source $venv_dir/bin/activate
112127

113128
# Install ViennaLS
114129
cd ViennaLS
115-
CC=gcc-12 CXX=g++-12 pip install . -v
130+
CC=gcc-12 CXX=g++-12 pip install . $verbose_flag
116131
cd ..
117132

118133
# Install ViennaPS with GPU support (using gcc-12 and g++-12)
119134
cd ViennaPS
120-
OptiX_INSTALL_DIR=$optix_dir CC=gcc-12 CXX=g++-12 CMAKE_ARGS=-DVIENNAPS_FORCE_GPU=ON pip install . -v
135+
OptiX_INSTALL_DIR=$optix_dir CC=gcc-12 CXX=g++-12 CMAKE_ARGS=-DVIENNAPS_FORCE_GPU=ON pip install . $verbose_flag
121136
cd ..
122137

123138
echo "Installation complete. To activate the virtual environment, run:"

0 commit comments

Comments
 (0)