IBM Docker Images
-----------------

To simplify local installation, Driverless AI is provided as a Docker image for the following OS-Driver-Container combinations:

+-----------------------------+-------------+------------------+---------+
| Host OS                     | Host Driver | Container        | Min Mem |
+=============================+=============+==================+=========+
| RHEL or CentOS 7.4 or later | PPC64LE     | Cuda9.0, Cuda9.2 | 64 GB   |
+-----------------------------+-------------+------------------+---------+

**Note**: Cuda9.2 requires NVIDIA drivers >= 396. 

For the best performance, including GPU support, use nvidia-docker. For a lower-performance experience without GPUs, use regular docker (with the same docker image). 

These installation steps assume that you have a license key for Driverless AI. For information on how to obtain a license key for Driverless AI, visit https://www.h2o.ai/driverless-ai/. Once obtained, you will be promted to paste the license key into the Driverless AI UI when you first log in, or you can save it as a .sig file and place it in the \license folder that you will create during the installation process.

Install on IBM with GPUs
~~~~~~~~~~~~~~~~~~~~~~~~

This section describes how to install and start the Driverless AI Docker image on RHEL for IBM Power LE systems with GPUs. Note that nvidia-docker has limited support for ppc64le machines. More information about nvidia-docker support for ppc64le machines is available `here <https://github.com/nvidia/nvidia-docker/wiki/Frequently-Asked-Questions#do-you-support-powerpc64-ppc64le>`__. 

Open a Terminal and ssh to the machine that will run Driverless AI. Once you are logged in, perform the following steps.

1. Retrieve the Driverless AI Docker image from https://www.h2o.ai/download/. 

2. Install and start Docker EE. Follow the instructions on https://docs.docker.com/engine/installation/linux/docker-ee/rhel/.

  Alternatively, you can run on Docker CE.

  ::

    sudo yum install -y yum-utils
    sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    sudo yum makecache fast
    sudo yum -y install docker-ce
    sudo systemctl start docker

3. Install nvidia-docker2 (if not already installed). More information is available at https://github.com/NVIDIA/nvidia-docker/blob/master/README.md.

 ::

    # Install nvidia-docker and nvidia-docker-plugin
    curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \
      sudo apt-key add -
    distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
    curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
      sudo tee /etc/apt/sources.list.d/nvidia-docker.list
    sudo apt-get update

    # Install nvidia-docker2 and reload the Docker daemon configuration
    sudo apt-get install -y nvidia-docker2

 **Note**: If you would like the nvidia-docker service to automatically start when the server is rebooted then run the following command. If you do not run this commend, you will have to remember to start the nvidia-docker service manually; otherwise the GPUs will not appear as available.

 ::

   sudo systemctl enable nvidia-docker

 Alternatively, if you have installed Docker CE above you can install nvidia-docker with:

 ::

    distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
    curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | \
    sudo tee /etc/yum.repos.d/nvidia-docker.repo
    sudo yum install nvidia-docker2

4. Verify that the NVIDIA driver is up and running. If the driver is not up and running, log on to http://www.nvidia.com/Download/index.aspx?lang=en-us to get the latest NVIDIA Tesla V/P/K series driver. 

 ::

   nvidia-docker run --rm nvidia/cuda nvidia-smi


5. Enable persistence of the GPU. Note that this only needs to be run once. Refer to the following for more information: http://docs.nvidia.com/deploy/driver-persistence/index.html.

  :: 

    nvidia-persistenced --user <USER>
    nvidia-smi -pm 1

6. Set up a directory for the version of Driverless AI on the host machine, replacing VERSION below with your Driverless AI Docker image version (for example, 1.4.0):

 ::

    # Set up directory with the version name
    mkdir dai_rel_VERSION

7. Change directories to the new folder, then load the Driverless AI Docker image inside the new directory. This example shows how to load Driverless AI version 1.4.0 for Cuda 9. Replace this with your image.

 ::

    # cd into the new directory
    cd dai_rel_VERSION

    # Load the Driverless AI docker image
    docker load < dai-docker-centos7-ppc64le-1.4.0-9.0.tar.gz

8. Set up the data, log, and license directories on the host machine (within the new directory):

 ::

    # Set up the data, log, license, and tmp directories on the host machine
    mkdir data
    mkdir log
    mkdir license
    mkdir tmp

9. At this point, you can copy data into the data directory on the host machine. The data will be visible inside the Docker container.


10. Start the Driverless AI Docker image with nvidia-docker:

 :: 

    # Start the Driverless AI Docker image
    nvidia-docker run \
        --pid=host \
        --init \
        --rm \
        --shm-size=256m \
        -u `id -u`:`id -g` \
        -p 12345:12345 \
        -v `pwd`/data:/data \
        -v `pwd`/log:/log \
        -v `pwd`/license:/license \
        -v `pwd`/tmp:/tmp \
        h2oai/dai-centos7-ppc64le:1.4.0-9.0

 Driverless AI will begin running::

  --------------------------------
  Welcome to H2O.ai's Driverless AI
  ---------------------------------
       version: 1.4.0

  - Put data in the volume mounted at /data
  - Logs are written to the volume mounted at /log/20180606-044258
  - Connect to Driverless AI on port 12345 inside the container
  - Connect to Jupyter notebook on port 8888 inside the container

12. Connect to Driverless AI with your browser at http://Your-Driverless-AI-Host-Machine:12345.


Install on IBM with CPUs
~~~~~~~~~~~~~~~~~~~~~~~~

This section describes how to install and start the Driverless AI Docker image on RHEL for IBM Power LE systems with CPUs. Note that this uses Docker EE and not NVIDIA Docker. GPU support will not be available.

**Watch the installation video** `here <https://www.youtube.com/watch?v=oLhhI7UlsAk&index=2&list=PLNtMya54qvOE9fs3ylzaR_McnoUsuMV7X>`__. Note that some of the images in this video may change between releases, but the installation steps remain the same. 

**Note**: As of this writing, Driverless AI has only been tested on RHEL version 7.4. 

Open a Terminal and ssh to the machine that will run Driverless AI. Once you are logged in, perform the following steps.


1. Install and start Docker EE on RHEL (if not already installed). Follow the instructions on https://docs.docker.com/engine/installation/linux/docker-ee/rhel/.

  Alternatively, you can run on Docker CE.

  ::

    sudo yum install -y yum-utils
    sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    sudo yum makecache fast
    sudo yum -y install docker-ce
    sudo systemctl start docker

2. On the machine that is running Docker EE, retrieve the Driverless AI Docker image from https://www.h2o.ai/driverless-ai-download/. 

3. Set up a directory for the version of Driverless AI on the host machine, replacing VERSION below with your Driverless AI Docker image version (for example, 1.4.0):

 ::

    # Set up directory with the version name
    mkdir dai_rel_VERSION

4. Load the Driverless AI Docker image inside the new directory. The following example shows how to load Driverless AI version 1.4.0 for Cuda 9. Replace this with your image.

 ::

    # Load the Driverless AI Docker image
    docker load < dai-docker-centos7-ppc64le-1.4.0-9.0.tar.gz

5. Set up the data, log, license, and tmp directories (within the new directory):

 ::

    # cd into the directory associated with the selected version of Driverless AI
    cd dai_rel_VERSION

    # Set up the data, log, license, and tmp directories on the host machine
    mkdir data
    mkdir log
    mkdir license
    mkdir tmp


6. Copy data into the **data** directory on the host. The data will be visible inside the Docker container at **/<user-home>/data**.

7. Start the Driverless AI Docker image with docker. GPU support will not be available.

 ::

  $ docker run \
      --pid=host \
      --init \
      --rm \
      -u `id -u`:`id -g` \
      -p 12345:12345 \
      -v `pwd`/data:/data \
      -v `pwd`/log:/log \
      -v `pwd`/license:/license \
      -v `pwd`/tmp:/tmp \
      h2oai/dai-centos7-ppc64le:1.4.0-9.0

 Driverless AI will begin running::

  --------------------------------
  Welcome to H2O.ai's Driverless AI
  ---------------------------------
       version: 1.4.0

  - Put data in the volume mounted at /data
  - Logs are written to the volume mounted at /log/20180606-044258
  - Connect to Driverless AI on port 12345 inside the container
  - Connect to Jupyter notebook on port 8888 inside the container

8. Connect to Driverless AI with your browser at http://Your-Driverless-AI-Host-Machine:12345.

Stopping the Docker Image
~~~~~~~~~~~~~~~~~~~~~~~~~

.. include:: stop-docker.rst

Upgrading the Docker Image
~~~~~~~~~~~~~~~~~~~~~~~~~~

.. include:: upgrade-docker.rst
