Skip to content

Ubuntu 24.04

Here we show how to install gRASPA on Ubuntu 24.04 and latest NVIDIA products

Prerequisites

  • A machine with NVIDIA GPU
  • Ubuntu 24.04 (clean version the best, but not required)

Steps (If you start with a clean Ubuntu 24.04)

1. Install NVIDIA Driver

  • Find the recommended NVIDIA Driver
    • 📝 Go to Software & Updates, select Additional Drivers
    • select the nvidia-drivers-535 (proprietary, tested)
    • click Apply Changes

2. Install NVIDIA CUDA Tool-kit

  • open terminal
  • Type:
    sudo apt install nvidia-cuda-toolkit
    

3. Install NVHPC Compiler

  • Go to the latest NVHPC compiler website
    • Latest version is 24.5
  • Select a download method (tar file, for example)
    • Follow their instructions
    • 📝 Look at the final messages that the installer print to screen
    • You will notice a line that adds nvhpc to PATH: export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH
    • COPY THIS LINE! to use for later

4. Download gRASPA

cd ~/
git clone https://github.com/snurr-group/gRASPA

5. Compile gRASPA

cd gRASPA/src_clean
cp ../NVC_COMPILE .
  • Open NVC_COMPILE
  • Add export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH (the line you copied) to the top of NVC_COMPILE
  • Add -target=gpu to NVCFLAG (easier option)
    • if -target=gpu used, remove -gpu=ccXX
    • if -gpu=ccXX used, you need to figure out ccXX for your GPU
chmod 777 NVC_COMPILE
./NVC_COMPILE
  • 📝 Your COMPILATION FILE MAY LOOK LIKE THIS:
    #!/bin/bash
    
    rm nvc_main.x
    
    export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH
    
    CXX="nvc++"
    
    LINKFLAG="-L/usr/lib64/ -L/opt/local/lib/gcc11/"
    
    NVCFLAG="-O3 -std=c++20 -target=gpu -Minline -fopenmp -cuda -stdpar=multicore"
    
    $CXX $NVCFLAG $LINKFLAG -c axpy.cu
    
    $CXX $NVCFLAG $LINKFLAG -c main.cpp
    
    $CXX $NVCFLAG $LINKFLAG -c read_data.cpp
    
    $CXX $NVCFLAG $LINKFLAG -c data_struct.cpp
    
    $CXX $NVCFLAG $LINKFLAG -c VDW_Coulomb.cu
    
    $CXX $NVCFLAG $LINKFLAG main.o read_data.o axpy.o data_struct.o VDW_Coulomb.o -o nvc_main.x
    
    rm *.o
    

6. Run an Example (CO2 adsorption in MFI zeolite)

cd ../Examples/CO2-MFI/
../../src_clean/nvc_main.x

7. That is it!!!