-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ApraPipes Build Automation Scripts (#301)
* initial commit * refactored linux cuda.sh * addressed PR comments
- Loading branch information
1 parent
0d03309
commit 9ec490e
Showing
11 changed files
with
258 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# List of required dependencies | ||
dependencies=("git-lfs" "libncurses5-dev" "ninja-build" "nasm" "curl" "libudev-dev" "libssl-dev") | ||
|
||
missing_dependencies=() | ||
|
||
# Check and collect missing dependencies | ||
for dependency in "${dependencies[@]}"; do | ||
if ! dpkg -s "$dependency" 2>&1; then | ||
missing_dependencies+=("$dependency") | ||
fi | ||
done | ||
|
||
# If there are missing dependencies, install them | ||
if [ "${#missing_dependencies[@]}" -gt 0 ]; then | ||
echo "Installing missing dependencies..." | ||
apt-get update -qq | ||
apt-get -y install "${missing_dependencies[@]}" | ||
fi | ||
|
||
# Install Cmake if not present | ||
if ! cmake --version; then | ||
echo "CMake is not installed. Installing CMake..." | ||
snap install cmake --classic | ||
fi | ||
|
||
if [ ! -d "/usr/local/cuda/include" ] || [ ! -d "/usr/local/cuda/lib64" ]; then | ||
echo "ERROR: CUDA Toolkit is not properly installed. Please install CUDA Toolkit." | ||
exit 1 | ||
fi | ||
|
||
if nvcc --version; then | ||
TARGET_USER="$SUDO_USER" | ||
TARGET_HOME=$(eval echo ~$TARGET_USER) | ||
echo 'export VCPKG_FORCE_SYSTEM_BINARIES=1' | sudo -u $TARGET_USER tee -a $TARGET_HOME/.bashrc | ||
echo 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' | sudo -u $TARGET_USER tee -a $TARGET_HOME/.bashrc | ||
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' | sudo -u $TARGET_USER tee -a $TARGET_HOME/.bashrc | ||
echo "Appended paths to ~/.bashrc and saved changes." | ||
source ~/.bashrc | ||
echo "Reloaded ~/.bashrc" | ||
fi | ||
|
||
echo "Dependencies verified and installed successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/bin/bash | ||
|
||
# List of required dependencies | ||
dependencies=( "curl" "zip" "unzip" "tar" "autoconf" "automake" "autopoint" "build-essential" | ||
"flex" "git-core" "git-lfs" "libass-dev" "libfreetype6-dev" "libgnutls28-dev" "libmp3lame-dev" | ||
"libsdl2-dev" "libssl-dev" "libtool" "libsoup-gnome2.4-dev" "libncurses5-dev" "libva-dev" "libvdpau-dev" | ||
"libvorbis-dev" "libxcb1-dev" "libxdamage-dev" "libxcursor-dev" "libxinerama-dev" "libx11-dev" "libgles2-mesa-dev" "libxcb-shm0-dev" "libxcb-xfixes0-dev" | ||
"ninja-build" "pkg-config" "texinfo" "wget" "yasm" "zlib1g-dev" "nasm" "gperf" "bison" "python3" "python3-pip") | ||
|
||
missing_dependencies=() | ||
|
||
# Check and collect missing dependencies | ||
for dependency in "${dependencies[@]}"; do | ||
if ! dpkg -s "$dependency" >/dev/null 2>&1; then | ||
missing_dependencies+=("$dependency") | ||
fi | ||
done | ||
|
||
# If there are missing dependencies, install them | ||
if [ "${#missing_dependencies[@]}" -gt 0 ]; then | ||
echo "Installing missing dependencies..." | ||
apt-get update -qq | ||
apt-get -y install "${missing_dependencies[@]}" | ||
fi | ||
|
||
# Install Meson if not present | ||
if ! meson --version &>/dev/null; then | ||
echo "meson is not installed. Installing meson..." | ||
pip3 install meson | ||
fi | ||
|
||
# Install Cmake if not present | ||
if ! cmake --version &>/dev/null; then | ||
echo "CMake is not installed. Installing CMake..." | ||
pip3 install cmake --upgrade | ||
fi | ||
|
||
# Install jq if not present | ||
if ! jq --version &>/dev/null; then | ||
echo "jq is not installed. Installing jq..." | ||
apt install jq | ||
fi | ||
|
||
if [ ! -d "/usr/local/cuda/include" ] || [ ! -d "/usr/local/cuda/lib64" ]; then | ||
echo "ERROR: CUDA Toolkit is not properly installed. Please install CUDA Toolkit." | ||
exit 1 | ||
fi | ||
|
||
if ! nvcc --version &>/dev/null; then | ||
userName=$(whoami) | ||
cudnn_archives="/home/$userName/Downloads/cudnn-*.tar.xz" | ||
|
||
for archive in $cudnn_archives; do | ||
if [ -e "$archive" ]; then | ||
echo "Extracting $archive..." | ||
tar xf "$archive" -C /home/$userName/Downloads/ | ||
fi | ||
done | ||
|
||
echo "Copying files..." | ||
cp -r /home/$userName/Downloads/cudnn-*/include/* /usr/local/cuda/include/ | ||
cp -r /home/$userName/Downloads/cudnn-*/lib/* /usr/local/cuda/lib64/ | ||
|
||
TARGET_USER="$SUDO_USER" | ||
TARGET_HOME=$(eval echo ~$TARGET_USER) | ||
|
||
# Append lines to the target user's ~/.bashrc | ||
echo 'export PATH=/usr/local/cuda/bin:${PATH}' | sudo -u $TARGET_USER tee -a $TARGET_HOME/.bashrc | ||
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}' | sudo -u $TARGET_USER tee -a $TARGET_HOME/.bashrc | ||
|
||
# Reload .bashrc | ||
source $TARGET_HOME/.bashrc | ||
|
||
echo "Appended line to ~/.bashrc and saved changes." | ||
echo "Reloaded ~/.bashrc" | ||
fi | ||
|
||
echo "Dependencies verified and installed successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# List of required dependencies | ||
dependencies=( "curl" "zip" "unzip" "tar" "autoconf" "automake" "autopoint" "build-essential" | ||
"flex" "git-core" "git-lfs" "libass-dev" "libfreetype6-dev" "libgnutls28-dev" "libmp3lame-dev" | ||
"libsdl2-dev" "libssl-dev" "libtool" "libsoup-gnome2.4-dev" "libncurses5-dev" "libva-dev" "libvdpau-dev" | ||
"libvorbis-dev" "libxcb1-dev" "libxdamage-dev" "libxcursor-dev" "libxinerama-dev" "libx11-dev" "libgles2-mesa-dev" "libxcb-shm0-dev" "libxcb-xfixes0-dev" | ||
"ninja-build" "pkg-config" "texinfo" "wget" "yasm" "zlib1g-dev" "nasm" "gperf" "bison" "python3" "python3-pip") | ||
|
||
missing_dependencies=() | ||
|
||
# Check and collect missing dependencies | ||
for dependency in "${dependencies[@]}"; do | ||
if ! dpkg -s "$dependency" >/dev/null 2>&1; then | ||
missing_dependencies+=("$dependency") | ||
fi | ||
done | ||
|
||
# If there are missing dependencies, install them | ||
if [ "${#missing_dependencies[@]}" -gt 0 ]; then | ||
echo "Installing missing dependencies..." | ||
apt-get update -qq | ||
apt-get -y install "${missing_dependencies[@]}" | ||
fi | ||
|
||
# Install Meson if not present | ||
if ! meson --version &>/dev/null; then | ||
echo "meson is not installed. Installing meson..." | ||
pip3 install meson | ||
fi | ||
|
||
# Install Cmake if not present | ||
if ! cmake --version &>/dev/null; then | ||
echo "CMake is not installed. Installing CMake..." | ||
pip3 install cmake --upgrade | ||
fi | ||
|
||
# Install jq if not present | ||
if ! jq --version &>/dev/null; then | ||
echo "jq is not installed. Installing jq..." | ||
apt install jq | ||
fi | ||
|
||
echo "Dependencies verified and installed successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Set execution policy and install Chocolatey | ||
Set-ExecutionPolicy Bypass -Scope Process -Force; | ||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; | ||
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | ||
|
||
# Enable feature and install dependencies | ||
choco feature enable -n allowEmptyChecksums | ||
choco install 7zip git python3 cmake pkgconfiglite -y | ||
|
||
# Install required Python packages | ||
pip3 install ninja | ||
pip3 install meson | ||
|
||
# Install cmake | ||
pip3 install cmake --upgrade | ||
|
||
$cudaVersion = (Get-ChildItem "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\" -Directory | Where-Object { $_.Name -match 'v\d+\.\d+' }).Name | ||
|
||
if (-not (Test-Path "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\$cudaVersion\bin\nvcc.exe")) { | ||
Write-Host "CUDA Toolkit is not installed. Please install CUDA Toolkit and CuDNN as specified in the Read-me." | ||
Exit 1 | ||
} else { | ||
$userName = $env:UserName | ||
$zipFilePath = "C:\Users\$userName\Downloads\cudnn-*.zip" | ||
|
||
Write-Host "Extracting zip file..." | ||
|
||
Expand-Archive -Path $zipFilePath -DestinationPath C:\Users\$userName\Downloads\ -Force | ||
|
||
Write-Host "Copying files..." | ||
Copy-Item -Path "C:\Users\$userName\Downloads\cudnn-*\include\*.h" -Destination "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\$cudaVersion\include\" -Recurse | ||
Copy-Item -Path "C:\Users\$userName\Downloads\cudnn-*\lib\*.lib" -Destination "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\$cudaVersion\lib\x64\" -Recurse | ||
Copy-Item -Path "C:\Users\$userName\Downloads\cudnn-*\bin\*.dll" -Destination "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\$cudaVersion\bin\" -Recurse | ||
} | ||
|
||
Write-Host "Dependencies verified and installed successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Set execution policy and install Chocolatey | ||
Set-ExecutionPolicy Bypass -Scope Process -Force; | ||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; | ||
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | ||
|
||
# Enable feature and install dependencies | ||
choco feature enable -n allowEmptyChecksums | ||
choco install 7zip git python3 cmake pkgconfiglite -y | ||
|
||
# Install required Python packages | ||
pip3 install ninja | ||
pip3 install meson | ||
|
||
# Install cmake | ||
pip3 install cmake --upgrade | ||
|
||
Write-Host "Dependencies verified and installed successfully." |
Oops, something went wrong.