Ubuntu OS GPU Installation With Apt

This is an end-to-end recipe for installing OmniSci Open Source on an Ubuntu machine running with NVIDIA Volta, Kepler, or Pascal series GPU cards.

Here is a quick video overview of the installation steps.

The installation phases are:
Important The order of these instructions is significant. To avoid problems, install each component in the order presented.

Assumptions

These instructions assume the following:
  • You are installing on a “clean” Ubuntu host machine with only the operating system installed.
  • Your OmniSci host only runs the daemons and services required to support OmniSci.
  • Your OmniSci host is connected to the Internet.

Preparation

Prepare your Ubuntu machine by updating your system, creating the OmniSci user (named omnisci), installing kernel headers, and installing CUDA drivers.

Update and Reboot

  1. Update the entire system.
    sudo apt update
    sudo apt upgrade
  2. Install a "headless" Java runtime environment.
    sudo apt install default-jre-headless
  3. Verify that the apt-transport-https utility is installed.
    sudo apt install apt-transport-https
    
  4. Reboot to activate the latest kernel.
    sudo reboot
    

Create the OmniSci User

Create a group called omnisci and a user named omnisci, who will be the owner of the OmniSci database. You can create the group, user, and home directory using the useradd command with the -U and -m switches.

sudo useradd -U -m omnisci

Install CUDA Drivers

CUDA is a parallel computing platform and application programming interface (API) model. It uses a CUDA-enabled graphics processing unit (GPU) for general purpose processing. The CUDA platform provides direct access to the GPU virtual instruction set and parallel computation elements. For more information on CUDA unrelated to installing OmniSci, see http://www.nvidia.com/object/cuda_home_new.html.

Install Kernel Headers

  1. Install kernel headers with the following command:
    sudo apt-get install linux-headers-$(uname -r)
  2. Reboot to ensure that the kernel is up to date:
    sudo reboot

Install the Drivers

OmniSci requires only the CUDA drivers and not the entire CUDA package. To install the drivers:

  1. Go to https://developer.nvidia.com/cuda-downloads.
  2. Select the target platform by selecting the operating system (Linux), architecture (based on your environment), distribution (Ubuntu), version (based on your environment), and installer type (OmniSci recommends deb (network)).

    CUDA install

  3. In Download Installer..., right-click the Download button and copy the link location of the Base Installer. Do not use the installation instructions on the CUDA site.

    CUDA base installer

  4. Use one of the following methods to download the installer from the command line, using the download link you copied (in this example, https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb):
    • curl:
      sudo curl -O https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
    • wget:
      sudo wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
      If wget is not installed in your environment, use sudo apt install wget to install it.
  5. Install the CUDA drivers, using the filename you just downloaded (in this example, cuda-repo-ubuntu1804_10.0.130-1_amd64.deb):
    sudo dpkg -i <file_name>
  6. If you do not have the public CUDA GPG key installed, run the installation command provided by NVIDIA in the terminal window; for example:
    sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
    
  7. Update the local repository cache:
    sudo apt update
  8. Install the CUDA Toolkit and GPU drivers:
    sudo apt install cuda-drivers linux-image-extra-virtual
  9. Reboot your system to ensure that all changes are active:
    sudo reboot
    

Checkpoint

Run nvidia-smi to verify that your drivers are installed correctly and recognize the GPUs in your environment. Depending on your environment, you should see something like this to verify that your NVIDIA GPUs and drivers are present:NVIDIA SMI

Note If you see an error like the following, the NVIDIA drivers are probably installed incorrectly:
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. 
Make sure that the latest NVIDIA driver is installed and running.
Review the Install CUDA Drivers section and correct any errors.

Installation

To install OmniSci:

  1. Download and add a GPG key to apt:
    curl https://releases.omnisci.com/GPG-KEY-omnisci | sudo apt-key add -
    
  2. Download the OmniSci list file:
    echo "deb https://releases.omnisci.com/os/apt/ stable cuda" | sudo tee /etc/apt/sources.list.d/omnisci.list
  3. Use update to locate the new installation options, and then install OmniSci:
    sudo apt update
    sudo apt install omnisci

Configuration

Follow these steps to prepare your OmniSci environment.

Set Environment Variables

For convenience, you can update .bashrc with the required environment variables.

  1. Open a terminal window.
  2. Enter cd ~/ to go to your home directory.
  3. Open .bashrc in a text editor. For example, sudo gedit .bashrc.
  4. Edit the .bashrc file. Add the following export commands under “User specific aliases and functions.”
    # User specific aliases and functions
    export OMNISCI_USER=omnisci
    export OMNISCI_GROUP=omnisci
    export OMNISCI_STORAGE=/var/lib/omnisci
    export OMNISCI_PATH=/opt/omnisci
    export OMNISCI_LOG=/var/lib/omnisci/data/mapd_log
  5. Save the .bashrc file.
  6. Open a new terminal window to use your changes.

The $OMNISCI_STORAGE directory must be dedicated to OmniSci. Do not set it to a directory shared by other packages.

Initialization

Run the systemd installer. This script requires sudo access. You might be prompted for a password.

cd $OMNISCI_PATH/systemd
sudo ./install_omnisci_systemd.sh

Accept the values provided (based on your environment variables) or make changes as needed. The script creates a data directory in $OMNISCI_STORAGE with the directories mapd_catalogs, mapd_data, and mapd_export. mapd_import and mapd_log directories are created when you insert data the first time. If you are an OmniSci administrator, the mapd_log directory is of particular interest.

Activation

Start and use OmniSci Core and Immerse.

  1. Start OmniSci Core<
    cd $OMNISCI_PATH
    sudo systemctl start omnisci_server
  2. Enable OmniSci Core to start when the system reboots.
    sudo systemctl enable omnisci_server

Checkpoint

To verify that all systems are go, load some sample data and perform an omnisql query.

OmniSci ships with two sample datasets of airline flight information collected in 2008.

  1. To install the sample data, run the following command.
    cd $OMNISCI_PATH
    sudo ./insert_sample_data
  2. When prompted, choose whether to insert dataset 1 (7 million rows) or dataset 2 (10 thousand rows).
    Enter dataset number to download, or 'q' to quit:
    #     Dataset           Rows    Table Name          File Name
    1)    Flights (2008)    7M      flights_2008_7M     flights_2008_7M.tar.gz
    2)    Flights (2008)    10k     flights_2008_10k    flights_2008_10k.tar.gz
    3)    NYC Tree Census (2015)    683k    nyc_trees_2015_683k    nyc_trees_2015_683k.tar.gz
  3. Connect to OmniSci Core by entering the following command in a terminal on the host machine (default password is HyperInteractive):
    $OMNISCI_PATH/bin/omnisql
    password: ••••••••••••••••
  4. Enter a SQL query such as the following:
    omnisql> SELECT origin_city AS "Origin", dest_city AS "Destination", AVG(airtime) AS
    "Average Airtime" FROM flights_2008_10k WHERE distance < 175 GROUP BY origin_city,
    dest_city;

    The results should be similar to the results below.

    Origin|Destination|Average Airtime
    Austin|Houston|33.055556
    Norfolk|Baltimore|36.071429
    Ft. Myers|Orlando|28.666667
    Orlando|Ft. Myers|32.583333
    Houston|Austin|29.611111
    Baltimore|Norfolk|31.714286