Skip to content

Deployment Overview of PyTorch on Server

Prerequisites and Basic Requirements

The deployment environment requires the following system specifications and access privileges:

  • Operating System: Ubuntu 22.04 LTS (implied by linux-generic-hwe-22.04 and release version detection logic).

  • Privileges: Root access is required for initial system configuration, user creation, and package installation. A non-root user account named user is created during the process.

  • Hardware: An NVIDIA GPU with support for the CUDA toolkit. The installation script specifically checks for the NVIDIA H100 model (PCI ID 10de:2330) to install the appropriate kernel package (linux-generic-hwe-22.04).

  • Packages: The system installs curl, wget, sudo, gcc, ubuntu-drivers-common, and libnvinfer5-dev.

  • Ports: No external network ports are configured or opened by the deployment scripts. The application runs locally on the server.

FQDN of the Final Panel

Based on the configuration variables provided, the Fully Qualified Domain Name (FQDN) for the host is:

  • Zone: hostkey.in

  • Prefix: pytorch

  • Format: pytorch<Server ID>.hostkey.in:<port>

Note: The specific <Server ID> is not defined in the provided configuration files. The deployment does not configure a web panel or external service listening on a specific port accessible via this FQDN. The setup is strictly for a local PyTorch development environment.

File and Directory Structure

The application and configuration files are organized within the home directory of the user account:

  • User Home Directory: /home/user

  • Virtual Environment: /home/user/venv

  • Installation Script: /home/user/pytorch_install.sh

  • Activation Script: /home/user/pytorch.sh

  • System-wide CUDA Installation: /usr/local/cuda

  • User Credentials: /root/user_credentials (contains the auto-generated password for the user account).

  • System Packages: Installed via apt in standard system locations.

Application Installation Process

The installation is performed via a sequence of shell scripts executed on the server. The process does not utilize containerization for the PyTorch runtime itself.

  1. System Preparation:

    • All system packages are updated to their latest versions.

    • NVIDIA drivers are detected and installed based on the recommended version for the hardware.

    • If an H100 GPU is detected, the linux-generic-hwe-22.04 kernel package is installed.

  2. CUDA Toolkit Installation:

    • The release version of Ubuntu is detected.

    • The CUDA keyring is downloaded and installed.

    • The cuda package is installed via apt.

  3. User Account Creation:

    • A user named user is created with a randomly generated 8-character password.

    • The password is stored in /root/user_credentials.

    • The user is added to the sudo and users groups.

  4. Python Environment Setup:

    • Python 3.10, pip, and venv are installed system-wide.

    • The libnvinfer5-dev package is installed.

  5. PyTorch Installation:

    • The pytorch_install.sh script is executed as the user account.

    • This script creates a Python virtual environment at /home/user/venv.

    • PyTorch (torch, torchvision, torchaudio) is installed within this virtual environment using pip.

    • Environment variables for CUDA (PATH and LD_LIBRARY_PATH) are appended to ~/.bashrc.

Access Rights and Security

  • User Account: The application is configured for use under the user account.

  • Sudo Access: The user account has been added to the sudo group, allowing for privilege escalation if required.

  • Credentials: The password for the user account is stored in /root/user_credentials as a plain text string. This file is accessible only to the root user.

  • Firewall: The provided scripts do not configure any firewall rules (e.g., ufw or iptables). The server is assumed to be behind an external security layer or managed through host-level security policies.

Databases

The deployment guide and configuration files do not include the installation or configuration of any database services (such as MySQL, PostgreSQL, or MongoDB). The PyTorch environment is a standalone compute and development environment.

Docker Containers and Their Deployment

The deployment process described in the source files does not utilize Docker, Docker Compose, or any containerization technologies. PyTorch is installed directly on the host operating system within a Python virtual environment.

Proxy Servers

No proxy servers (Nginx, Traefik, Apache) are configured in the provided scripts. The deployment does not include SSL certificates, custom domains, or web server configurations.

Permission Settings

File and directory permissions are set as follows during the installation:

  • System Scripts: The install_script.sh is created at /root/install_script.sh with permissions u=rwx,g=r,o=r (744) and owned by root.

  • User Scripts:

    • pytorch_install.sh is created in /home/user with executable permissions (chmod +x).

    • pytorch.sh is created in /home/user with executable permissions (chmod +x).

  • Home Directory: The /home/user directory is created with standard ownership for the user account.

Location of Configuration Files and Data

  • User Configuration: ~/.bashrc is modified to include CUDA environment variables.

  • Virtual Environment: ~/.venv contains the installed Python packages.

  • Credential Storage: /root/user_credentials holds the password for the user account.

  • CUDA Configuration: /usr/local/cuda contains the CUDA toolkit and libraries.

Available Ports for Connection

The deployment scripts do not configure any listening network services. Consequently, no ports are explicitly opened or available for external connection as part of this PyTorch installation. The environment is intended for local execution of Python scripts on the server.

Starting, Stopping, and Updating

There are no systemd services or background daemons created for PyTorch. The application is started and managed manually by the user.

  • Activating the Environment: Run the activation script to enter the virtual environment:

    source /home/user/pytorch.sh
    
    Or manually:
    source /home/user/venv/bin/activate
    

  • Running PyTorch: Once the virtual environment is active, execute Python scripts directly:

    python3 -c "import torch; print(torch.__version__)"
    

  • Deactivating the Environment: Exit the virtual environment:

    deactivate
    

  • Updating: To update PyTorch, activate the virtual environment and use pip:

    source /home/user/venv/bin/activate
    pip install --upgrade torch torchvision torchaudio
    deactivate
    

  • System Updates: System-wide packages (CUDA, drivers) can be updated using standard apt commands as root:

    sudo apt update
    sudo apt upgrade
    

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×