在 Ubuntu 上安装

本节介绍如何在 Ubuntu 上安装 Driverless AI Docker 映像。如果您的系统有 GPU 或只有 CPU,则安装步骤会有不同。

环境

操作系统

GPU?

最小内存

带有 GPU 的 Ubuntu

64 GB

带有 CPU 的 Ubuntu

64 GB

在带有 GPU 的 Ubuntu 上安装

请注意:16.04 或更高版本的 Ubuntu 支持 Driverless AI。

打开终端和并使用 SSH 登录将运行 Driverless AI 的主机。登录之后,执行以下步骤:

  1. https://www.h2o.ai/download/ 检索 Driverless AI Docker 映像。(注意此 Docker 映像包括 CentOS 内核和 CentOS 软件包。)

  2. 在 Ubuntu 上安装和运行 Docker(如果还未安装):

# Install and run Docker on Ubuntu
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88 sudo add-apt-repository \
 "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo systemctl start docker
  1. 安装 nvidia-docker2(如果还未安装)。更多信息,请访问 https://github.com/NVIDIA/nvidia-docker/blob/master/README.md

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
  1. 确认 NVIDIA 驱动程序已经启动并正在运行。如果驱动程序未启动和运行,则登录到 http://www.nvidia.com/Download/index.aspx?lang=en-us 以获取最新版本的 NVIDIA Tesla V/P/K 系列驱动程序:

nvidia-smi
  1. 在主机上设置相应 Driverless AI 版本的目录

# Set up directory with the version name
mkdir dai-1.9.2.1
  1. 将目录更改为新文件夹,然后将 Driverless AI Docker 映像加载到新目录中:

# cd into the new directory
cd dai-1.9.2.1

# Load the Driverless AI docker image
docker load < dai-docker-centos7-x86_64-1.9.2-10.0.tar.gz
  1. 启用 GPU 的持久模式。注意每次重启时都需要运行此功能。更多信息,请查阅以下网页:http://docs.nvidia.com/deploy/driver-persistence/index.html

sudo nvidia-smi -pm 1
  1. 在主机上设置数据、日志和许可证目录:

# Set up the data, log, license, and tmp directories on the host machine (within the new directory)
mkdir data
mkdir log
mkdir license
mkdir tmp
  1. 此时,您可以将数据复制到主机上的 data 目录中。数据将在 Docker 容器内可见。

  2. 运行 docker images,找到映像标签。

  3. 启动 Driverless AI Docker 映像,并将下方标签替换为映像标签。根据您所安装的版本,使用 docker run --runtime=nvidia (>= Docker 19.03) 或 nvidia-docker (< Docker 19.03) 命令。

请注意:可使用 docker version 来检查您使用的 Docker 版本。

# Start the Driverless AI Docker image
docker run --runtime=nvidia \
    --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-x86_64:TAG
# 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-x86_64:TAG

Driverless AI 将开始运行:

--------------------------------
Welcome to H2O.ai's Driverless AI
---------------------------------

- 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
  1. 使用浏览器连接至 Driverless AI

http://Your-Driverless-AI-Host-Machine:12345

在带有 CPU 的 Ubuntu 上安装

请注意:16.04 或更高版本的 Ubuntu 支持 Driverless AI。

本节介绍如何在 Ubuntu 上安装和启动 Driverless AI Docker 映像。注意,此操作使用 docker 而非 nvidia-docker. GPU 支持将不可用。

点击 此处 观看安装视频 。请注意,此视频中的某些图像可能因版本而异,但安装步骤仍相同。

打开终端和并使用 SSH 登录将运行 Driverless AI 的主机。登录之后,执行以下步骤:

  1. https://www.h2o.ai/download/ 检索 Driverless AI Docker 映像。

  2. 在 Ubuntu 上安装和运行 Docker(如果还未安装):

# Install and run Docker on Ubuntu
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88 sudo add-apt-repository \
 "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo systemctl start docker
  1. 在主机上设置相应 Driverless AI 版本的目录

# Set up directory with the version name
mkdir dai-1.9.2.1
  1. 将目录更改为新文件夹,然后将 Driverless AI Docker 映像加载到新目录中:

# cd into the new directory
cd dai-1.9.2.1

# Load the Driverless AI docker image
docker load < dai-docker-centos7-x86_64-1.9.2-10.0.tar.gz
  1. 在主机上(新目录内)设置数据、日志、许可证和临时文件目录:

# Set up the data, log, license, and tmp directories
mkdir data
mkdir log
mkdir license
mkdir tmp
  1. 此时,您可以将数据复制到主机上的 data 目录中。数据将在 Docker 容器内可见。

  2. 运行 docker images 以查找新的映像标签。

  3. 启动 Driverless AI Docker 映像。注意 GPU 支持将不可用。

# Start the Driverless AI Docker image
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 \
    -v /etc/passwd:/etc/passwd:ro \
    -v /etc/group:/etc/group:ro \
    h2oai/dai-centos7-x86_64:1.9.2.1-cuda10.0.xx

Driverless AI 将开始运行:

--------------------------------
Welcome to H2O.ai's Driverless AI
---------------------------------

- 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
  1. 使用浏览器连接至 Driverless AI

http://Your-Driverless-AI-Host-Machine:12345

停止 Docker 映像

若要停止 Driverless AI Docker 映像,在运行 Driverless AI Docker 映像的终端 (Mac OS X) 或 PowerShell (Windows 10) 窗口中按下 Ctrl + C

升级 Docker 映像

本节提供了用于升级 Docker 容器内已安装的各版本 Driverless AI 的说明。这些步骤将确保现有实验被保存。

警告:实验、MLI 和 MOJO 驻留在 Driverless AI 临时目录中,在升级 Driverless AI 时不会自动升级。

  • 升级前构建 MLI 模型

  • 升级前构建 MOJO 管道。

  • 升级前停止 Driverless AI 并备份 Driverless AI tmp 目录。

如果在升级 Driverless AI 前未在务必模型上构建 MLI,则升级后将不能在该模型上查看 MLI。升级前,请务必在您想要在未来版本中继续进行解释的模型上运行 MLI 作业。如果当前版本的解释模型列表中含有此 MLI 作业,则在升级后将保留。

如果在升级 Driverless AI 前未在模型上构建 MOJO 管道,则升级后将不能在该模型上构建 MOJO 管道。升级前,请务必在所需的全部模型上构建 MOJO 管道,然后备份 Driverless AI tmp 目录。

请注意:如果 Driverless AI 仍在运行,需将其停止。

要求

从 1.7.0 版开始,不再支持 CUDA 9。您的主机环境必须有 CUDA 10.0 或更高版本,并安装有 NVIDIA 驱动程序 (>= 440.82)(仅 GPU)。Driverless AI 自带 CUDA 库,但是主机环境中必须有驱动程序。前往 https://www.nvidia.com/Download/index.aspx, 获取最新的 NVIDIA Tesla V/P/K 系列驱动程序。

升级步骤

  1. 使用 SSH 连接到运行 Driverless AI 的主机 IP 地址

  2. 在主机上设置相应 Driverless AI 版本的目录

# Set up directory with the version name
mkdir dai-1.9.2.1

# cd into the new directory
cd dai-1.9.2.1
  1. https://www.h2o.ai/download/ 检索 Driverless AI 软件包,并将该软件包添加到新目录中。

  2. 在新目录内加载 Driverless AI Docker 映像:

# Load the Driverless AI docker image
docker load < dai-docker-centos7-x86_64-1.9.2-10.0.tar.gz
  1. 将之前 Driverless AI 目录的数据、日志、许可证和临时目录复制到新的 Driverless AI 目录中:

# Copy the data, log, license, and tmp directories on the host machine
cp -a dai_rel_1.4.2/data dai-1.9.2.1/data
cp -a dai_rel_1.4.2/log dai-1.9.2.1/log
cp -a dai_rel_1.4.2/license dai-1.9.2.1/license
cp -a dai_rel_1.4.2/tmp dai-1.9.2.1/tmp

此时,您之前版本的实验将在 Docker 容器内可见。

  1. 使用 docker images,找到新的映像标签。

  2. 启动 Driverless AI Docker 映像。

  3. 通过浏览器访问 http://Your-Driverless-AI-Host-Machine:12345,连接至 Driverless AI。