Deployment Overview of PyTorch on Server¶
Prerequisites and Basic Requirements¶
Before beginning the installation, ensure the server meets the following requirements:
-
Operating System: Debian or Ubuntu.
-
Privileges: Root access is required for initial system configuration and driver installation.
-
Hardware Requirement: For GPU acceleration, an NVIDIA H100 (specifically [10de:2330] GH100 SXM5 80GB) or similar compatible hardware is recommended to trigger specific kernel optimizations.
-
Network Access: The server must have outbound internet access to download system updates, NVIDIA drivers, CUDA toolkits, and Python packages.
FQDN of the final panel on the hostkey.in domain¶
| Parameter | Value |
|---|---|
| Prefix | pytorch |
| Domain | hostkey.in |
| Full template | pytorch{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
The following files and directories are created during the installation process:
-
/root/install_script.sh: The primary installation script used to configure drivers and system dependencies. -
/root/user_credentials: A file containing the generated password for theuseraccount. -
/home/user/pytorch.sh: A helper script to activate the PyTorch virtual environment. -
/home/user/venv/: The Python virtual environment directory containing PyTorch and its dependencies.
Application installation process¶
The application is installed through a two-stage process involving system-level configuration followed by user-level environment setup:
-
System Configuration: An installation script (
install_script.sh) is executed to perform the following actions: -
Updates the package repository and upgrades existing packages.
-
Installs essential utilities such as
curl,wget, andsudo. -
Detects NVIDIA hardware; if an H100 model is detected, it installs the
linux-generic-hwe-22.04kernel package. -
Installs recommended NVIDIA drivers via
ubuntu-drivers-common. -
Installs the CUDA toolkit by adding the official NVIDIA repository for the specific Ubuntu release version.
-
Configures environment variables (
PATHandLD_LIBRARY_PATH) in the user's.bashrcto ensure CUDA is accessible. -
User Environment Setup: A secondary script (
pytorch_install.sh) is executed under a dedicateduseraccount: -
Creates a Python 3.10 virtual environment (
venv). -
Installs
torch,torchvision, andtorchaudioviapip. -
Verifies the installation by running a test script to check for CUDA availability.
Access Rights and Security¶
-
User Account: A non-root user named
useris created with a home directory at/home/user. -
Sudo Privileges: The
useraccount is added to thesudogroup to allow administrative tasks when required. -
Credentials: A random 8-character password is generated during installation and stored in
/root/user_credentials.
Databases¶
No databases are deployed as part of this application configuration.
Docker Containers and Their Deployment¶
This application does not utilize Docker containers; it is installed directly on the host operating system's runtime environment.
Custom Scripts and Additional Setup¶
The installation utilizes several scripts to automate complex configurations:
-
install_script.sh: Performs low-level system setup, including driver installation, CUDA configuration, user creation, and Python environment preparation. -
pytorch_install.sh: Handles the creation of the Python virtual environment and the installation of deep learning libraries. -
pytorch.sh: A utility script located in/home/user/used to quickly activate the PyTorch virtual environment by runningsource venv/bin/activate.
Application Update Instructions¶
To update the PyTorch environment, follow these steps:
-
Log in as the
useraccount. -
Navigate to the application directory:
cd ~/. -
Activate the environment:
./pytorch.sh. -
Update the packages via pip:
pip install --upgrade torch torchvision torchaudio.
Location of configuration files and data¶
-
Virtual Environment:
/home/user/venv -
User Credentials:
/root/user_credentials -
System CUDA Configuration:
/usr/local/cuda
Available ports for connection¶
No specific network ports are opened by this application as it operates via the command line and local Python execution.
Starting and Stopping the application¶
The application is managed through the Python virtual environment:
-
To start using PyTorch:
-
Log in as
user. -
Run
./pytorch.shto enter the environment. -
To stop/exit the environment:
-
Type
deactivatewithin the active shell.