Preparation for Building PHOENIX - Schumacher-Group-UPB/PHOENIX GitHub Wiki

Preparation for Building PHOENIX

To build PHOENIX, you must prepare your system with the necessary tools and dependencies. The process varies slightly between Linux and Windows. Follow the steps below for your platform.


Linux

On Linux, you need to install GCC and CUDA. Here's how:

Installing GCC

  1. Update the Package Index
    Open a terminal and update the package index:

    sudo apt update
  2. Install GCC
    Install the build-essential package, which includes GCC:

    sudo apt install build-essential
  3. Verify Installation
    Check the GCC version to confirm installation:

    gcc --version

Installing CUDA

  1. Download the CUDA Toolkit
    Visit the CUDA Toolkit download page and select the appropriate version for your system. Follow the instructions to download the .deb package.

  2. Install the CUDA Toolkit
    Use the downloaded .deb file to install CUDA. Example for Ubuntu:

    sudo dpkg -i cuda-repo-<distro>_<version>_amd64.deb
    sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/<distro>/x86_64/7fa2af80.pub
    sudo apt update
    sudo apt install cuda

    Replace <distro> with your distribution (e.g., ubuntu2004) and <version> with the version you downloaded.

  3. Set Environment Variables
    Add CUDA to your PATH and library paths by editing your .bashrc file:

    echo 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' >> ~/.bashrc
    echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
    source ~/.bashrc
  4. Verify Installation
    Check the CUDA compiler version:

    nvcc --version

Specific Linux Distributions

Commands might vary slightly depending on your Linux distribution:

Fedora

  • GCC:
    sudo dnf install @development-tools
  • CUDA: Follow the NVIDIA instructions for .rpm files.

Arch Linux

  • GCC:
    sudo pacman -S base-devel
  • CUDA:
    sudo pacman -S cuda

Reboot After Installation

Reboot to ensure all environment variables are loaded:

sudo reboot

Windows

On Windows, preparation requires installing Visual Studio, CUDA Toolkit, and MSYS2.


Install Visual Studio

  1. Download Visual Studio
    Go to the Visual Studio download page and download the installer.

  2. Install Visual Studio

    • Select the "Desktop Development with C++" workload.
    • Complete the installation.
  3. Add cl.exe to PATH

    • Open "Environment Variables" from the Start Menu.
    • Edit the Path variable and add:
      C:\Program Files (x86)\Microsoft Visual Studio\<version>\VC\Tools\MSVC\<version>\bin\Hostx64\x64
      
  4. Verify Installation
    Open Command Prompt and type:

    cl

Install CUDA Toolkit

  1. Download CUDA Toolkit
    Download the installer from the CUDA Toolkit page.

  2. Install CUDA Toolkit
    Run the installer and follow the prompts.

  3. Set Environment Variables
    Verify that the installer added the following to the PATH variable:

    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.x\bin
    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.x\libnvvp
    
  4. Verify Installation
    Open Command Prompt and check:

    nvcc --version

Install MSYS2

  1. Download MSYS2
    Visit the MSYS2 website and download the installer.

  2. Install MSYS2
    Run the installer and complete the setup.

  3. Update MSYS2
    Open the MSYS2 shell and update the package database:

    pacman -Syu
  4. Install Required Packages
    Install development tools and the MinGW toolchain:

    pacman -S base-devel mingw-w64-x86_64-toolchain
  5. Add MSYS2 to PATH
    Add the following to your PATH variable:

    C:\msys64\usr\bin
    
  6. Verify Installation
    Open Command Prompt and type:

    gcc --version

By following these steps, your system will be ready to build and run PHOENIX. If you encounter any issues, refer to the official documentation for CUDA, Visual Studio, or MSYS2.

⚠️ **GitHub.com Fallback** ⚠️