mirror of
https://github.com/eth-act/ere.git
synced 2026-04-03 03:00:17 -04:00
Add multi-gpu proving for risc0 (#50)
This commit is contained in:
49
scripts/install_cuda.sh
Executable file
49
scripts/install_cuda.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
ubuntu-drivers install
|
||||
|
||||
if command -v nvcc &> /dev/null; then
|
||||
echo "Cuda toolkit is already installed."
|
||||
else
|
||||
# From https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#ubuntu.
|
||||
wget https://developer.download.nvidia.com/compute/cuda/repos/$(. /etc/os-release; echo "${ID}${VERSION_ID}" | tr -d '.' | tr '[:upper:]' '[:lower:]')/$(uname -m)/cuda-keyring_1.1-1_all.deb
|
||||
dpkg -i cuda-keyring_1.1-1_all.deb
|
||||
rm cuda-keyring_1.1-1_all.deb
|
||||
apt-get update
|
||||
apt-get install -y cuda-toolkit
|
||||
|
||||
# From https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#environment-setup.
|
||||
# Add to path.
|
||||
cat >> ~/.bashrc <<EOF
|
||||
export PATH="$PATH:/usr/local/cuda/bin"
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
|
||||
EOF
|
||||
fi
|
||||
|
||||
if command -v nvidia-container-runtime &> /dev/null; then
|
||||
echo "Nvidia container runtime is already installed."
|
||||
else
|
||||
# From https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#with-apt-ubuntu-debian.
|
||||
# Configure the production repository:
|
||||
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
|
||||
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
|
||||
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
|
||||
| tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
||||
|
||||
# Install the NVIDIA Container Toolkit packages:
|
||||
export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.17.8-1
|
||||
apt-get install -y \
|
||||
nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
||||
nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
||||
libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
||||
libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
|
||||
|
||||
# From https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuring-docker.
|
||||
# Configure the container runtime by using the `nvidia-ctk` command:
|
||||
nvidia-ctk runtime configure --runtime=docker
|
||||
|
||||
# Restart docker
|
||||
systemctl restart docker
|
||||
fi
|
||||
29
scripts/install_docker.sh
Executable file
29
scripts/install_docker.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if command -v docker &> /dev/null; then
|
||||
echo "Docker is already installed."
|
||||
else
|
||||
# From https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository.
|
||||
# Add Docker's official GPG key:
|
||||
apt-get update
|
||||
apt-get install ca-certificates curl
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
||||
chmod a+r /etc/apt/keyrings/docker.asc
|
||||
|
||||
# Add the repository to Apt sources:
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
|
||||
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" \
|
||||
| tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
apt-get update
|
||||
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
fi
|
||||
|
||||
# From https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user.
|
||||
# Use docker as a non-root user:
|
||||
grep -q docker /etc/group || groupadd docker
|
||||
usermod -aG docker $USER
|
||||
newgrp docker
|
||||
@@ -62,7 +62,17 @@ fi
|
||||
|
||||
# Now that rzup is confirmed to be in PATH for this script, install the Risc0 toolchain
|
||||
echo "Running 'rzup install' to install/update Risc0 toolchain..."
|
||||
rzup install
|
||||
|
||||
if [[ -n "$RISC0_CLI_VERSION" && -n "$RISC0_CPP_VERSION" && -n "$RISC0_R0VM_VERSION" && -n "$RISC0_RUST_VERSION" ]]; then
|
||||
# If versions are specified, install each component by their version
|
||||
rzup install cargo-risczero $RISC0_CLI_VERSION
|
||||
rzup install cpp $RISC0_CPP_VERSION
|
||||
rzup install r0vm $RISC0_R0VM_VERSION
|
||||
rzup install rust $RISC0_RUST_VERSION
|
||||
else
|
||||
# Otherwise just install all components with by their latest version
|
||||
rzup install
|
||||
fi
|
||||
|
||||
# Verify Risc0 installation
|
||||
echo "Verifying Risc0 installation..."
|
||||
|
||||
Reference in New Issue
Block a user