2018년 8월 9일 목요일

PowerAI 5.2의 README 파일

아래는 PowerAI 5.2를 설치하면 함께 설치되는 README 파일입니다.  공유를 위해 여기 올려둡니다.

Deep Learning Software Packages

Updated 2018-06-15
PowerAI 1.5.2 provides software packages for several Deep Learning frameworks, supporting libraries, and tools:
ComponentVersion
DDL1.0.0
TensorFlow1.8.0
TensorBoard1.8.0
IBM Caffe1.0.0
BVLC Caffe1.0.0
PyTorch0.4.0
Snap ML1.0.0
Spectrum MPI10.2
Bazel0.10.0
OpenBLAS0.2.20
HDF51.10.1
Protobuf3.4.0
PowerAI is optimized to leverage the unique capabilities of IBM Power Systems accelerated servers, and is not available on any other platforms. It is supported on:
  • IBM AC922 POWER9 system with NVIDIA Tesla V100 GPUs
  • IBM S822LC POWER8 system with NVIDIA Tesla P100 GPUs
PowerAI requires some additional 3rd-party software components (see below for more information):
ComponentRequiredRecommended
Red Hat RHEL7.57.5
NVIDIA CUDA9.29.2.88
NVIDIA GPU driver396396.26
NVIDIA cuDNN7.17.1.4
NVIDIA NCCL2.22.2.12
Anaconda Anaconda5.15.1.0

New Features in 1.5.2

Python 3 support for the framework packages (in addition to the existing Python 2 support; not including Caffe).
A Technology Preview of IBM PowerAI Snap Machine Learning (Snap ML). Snap ML provides classical machine learning functionalities exposed via an sklearn-like interface.
A Technology Preview of PyTorch - a Python library that enables GPU-accelerated tensor computation and provides a rich API for neural network applications.
A Technology Preview of Large Model Support (LMS) is introduced for TensorFlow and enhanced for IBM Caffe. Large Module Support provides an approach to training large models and batch sizes that cannot fit in GPU memory.
Note that a NCCL v1.3.5 package is still included in the PowerAI distribution but is not installed by default. The other PowerAI components are now built against NCCL v2.2.12, which must be downloaded from NVIDIA. The NCCL 1 package is provided for compatibility with existing applications, but may be removed in future releases of PowerAI.

Additional information

For updates to this document please visit https://developer.ibm.com/linuxonpower/deep-learning-powerai/releases/.
More information about PowerAI is available at https://ibm.biz/powerai.
Developer resources can be found at http://ibm.biz/poweraideveloper.
Have questions?
You may find an answer already at the PowerAI space on developerWorks Answers.

System Setup

Operating System

The Deep Learning packages require RHEL 7.5 little endian for IBM POWER8 and IBM POWER9. The RHEL install image and license must be acquired from RedHat.
https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux

Operating System and Repository Setup

  1. Enable 'optional' and 'extra' repo channels
      IBM POWER8:
          $ sudo subscription-manager repos --enable=rhel-7-for-power-le-optional-rpms
          $ sudo subscription-manager repos --enable=rhel-7-for-power-le-extras-rpms
    
      IBM POWER9:
          $ sudo subscription-manager repos --enable=rhel-7-for-power-9-optional-rpms
          $ sudo subscription-manager repos --enable=rhel-7-for-power-9-extras-rpms
  2. Install packages needed for the installation
      $ sudo yum -y install wget nano bzip2
  3. Enable EPEL repo
       $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
       $ sudo rpm -ihv epel-release-latest-7.noarch.rpm
  4. Load the latest kernel
      $ sudo yum update kernel kernel-tools kernel-tools-libs kernel-bootwrapper
      $ reboot
    Or do a full update
      $ sudo yum update
      $ sudo reboot

NVIDIA Components

IBM POWER9 specific udev rules

Before installing the NVIDIA components the udev Memory Auto-Onlining Rule must be disabled for the CUDA driver to function properly. To disable it:
  1. Copy the /lib/udev/rules.d/40-redhat.rules file to the directory for user overridden rules.
      $ sudo cp /lib/udev/rules.d/40-redhat.rules /etc/udev/rules.d/
  2. Edit the /etc/udev/rules.d/40-redhat.rules file.
      $ sudo nano /etc/udev/rules.d/40-redhat.rules
  3. Comment out the following line and save the change:
      SUBSYSTEM=="memory", ACTION=="add", PROGRAM="/bin/uname -p", RESULT!="s390*", ATTR{state}=="offline", ATTR{state}="online"
  4. Optionally delete the first line of the file, since the file was copied to a directory where it won't be overwritten.
      # do not edit this file, it will be overwritten on update
  5. Reboot the system for the changes to take effect.
      $ sudo reboot

CUDA, GPU driver, cuDNN and NCCL

The Deep Learning packages require CUDA, cuDNN, NCCL, and GPU driver packages from NVIDIA (see table above)
These components can be installed by:
  1. Download and install NVIDIA CUDA 9.2 from https://developer.nvidia.com/cuda-downloads
    • Select Operating System: Linux
    • Select Architecture: ppc64le
    • Select Distribution RHEL
    • Select Version 7
    • Select Installer Type rpm (local)
    • Follow the Linux POWER installation instructions in the CUDA Quick Start Guide, including the steps describing how to set up the CUDA development environment by updating PATH and LD_LIBRARY_PATH.
    Note: The local rpm is preferred over the network rpm as it will ensure the version installed is the version downloaded. With the network rpm, "yum install cuda" will always install the latest version of the CUDA Toolkit.
  2. Download NVIDIA cuDNN v7.1.4 for CUDA 9.2 from https://developer.nvidia.com/cudnn (Registration in NVIDIA's Accelerated Computing Developer Program is required)
    • cuDNN v7.1.4 Library for Linux (Power8/Power9)
  3. Download NVIDIA NCCL v2.2.12 for CUDA 9.2 from https://developer.nvidia.com/nccl (Registration in NVIDIA's Accelerated Computing Developer Program is required)
    • NCCL 2.2.12 O/S agnostic and CUDA 9.2 and IBM Power
  4. Install the cuDNN v7.1.4 and NCCL v2.2.12 packages. Refresh shared library cache.
       $ sudo tar -C /usr/local --no-same-owner -xzvf cudnn-9.2-linux-ppc64le-v7.1.4.tgz
       $ sudo tar -C /usr/local --no-same-owner -xzvf nccl_2.2.12-1+cuda9.2_ppc64le.tgz
       $ sudo ldconfig

Anaconda

A number of the Deep Learning frameworks require Anaconda. Anaconda is a platform-agnostic data science distribution with a collection of 1,000+ open source packages with free community support.
Anaconda2 with Python 2 should be used to run the Python 2 versions of the Deep Learning frameworks. Anaconda3 with Python 3 is required to run the Python 3 versions of the Deep Learning frameworks.
AnacondaVersionDownload LocationSizemd5sum
Anaconda25.1.0https://repo.continuum.io/archive/Anaconda2-5.1.0-Linux-ppc64le.sh267Me894dcc547a1c7d67deb04f6bba7223a
Anaconda35.1.0https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-ppc64le.sh286M47b5b2b17b7dbac0d4d0f0a4653f5b1c
Download and Install Anaconda. Installation requires input for license agreement, install location (default is $HOME/anaconda2 or $HOME/anaconda3), and permission to modify the PATH environment variable (via .bashrc).
Example download and install setup for Anaconda2:
   $ wget https://repo.continuum.io/archive/Anaconda2-5.1.0-Linux-ppc64le.sh
   $ bash Anaconda2-5.1.0-Linux-ppc64le.sh
   $ source ~/.bashrc
If multiple users are using the same system, each user should install Anaconda individually.

Installing the Deep Learning Frameworks

Software Repository Setup

The PowerAI Deep Learning packages are distributed in a tar.gz file containing an rpm and a README file. The tar.gz file must be extracted on the local machine. Installing the rpm creates an installation repository on the local machine.
Install the repository package:
    $ sudo rpm -ihv mldl-repo-*.rpm

Installing all frameworks at once

The Deep Learning frameworks can be installed all at once using the power-mldl meta-package:
    $ sudo yum install power-mldl
NOTE: This does not include the PowerAI Distributed Deep Learning (DDL) packages. See details of how to install DDL below.

Installing the Python 3 versions of the frameworks

The Python 3 versions of the frameworks can be installed at once using the power-mldl-py3 meta-package
    $ sudo yum install power-mldl-py3

Installing frameworks individually

The Deep Learning frameworks can be installed individually if preferred. The framework packages are:
  • caffe-bvlc - Berkeley Vision and Learning Center (BVLC) upstream Caffe, v1.0.0
  • caffe-ibm - IBM Optimized version of BVLC Caffe, v1.0.0
  • pytorch - PyTorch, v0.4.0
  • tensorflow - TensorFlow, v1.8.0
  • tensorboard - Web Applications for inspecting TensorFlow runs and graphs, v1.8.0
The Python 3 version of each framework appends '-py3' to the package name
  • pytorch-py3 - PyTorch, v0.4.0
  • tensorflow-py3 - TensorFlow, v1.8.0
  • tensorboard-py3 - Web Applications for inspecting TensorFlow runs and graphs, v1.8.0
Each can be installed with:
    $ sudo yum install <framework>

Install IBM PowerAI Distributed Deep Learning (DDL) packages

We recommend PowerAI Distributed Deep Learning for distributing model training across a cluster of Power machines. DDL includes IBM Spectrum MPI for communication among machines.
Install the PowerAI Distributed Deep Learning packages using:
    $ sudo yum install power-ddl
Note: DDL is an optional component. Other PowerAI components can be installed and used without installing DDL.
To use InfiniBand for DDL communications, install the latest Mellanox OFED driver. See the Download tab at: http://www.mellanox.com/page/products_dyn?product_family=26

Install IBM PowerAI Snap ML packages

Install the PowerAI Snap ML packages using:
    $ sudo yum install power-snapml
Note: Snap ML is an optional component. Other PowerAI components can be installed and used without installing Snap ML.

Accept the PowerAI License Agreement

Read the license agreement and accept the terms and conditions before using any of the frameworks.
    $ sudo /opt/DL/license/bin/accept-powerai-license.sh
After reading the license agreement, future installs may be automated to silently accept the license agreement.
    $ sudo IBM_POWERAI_LICENSE_ACCEPT=yes /opt/DL/license/bin/accept-powerai-license.sh

Upgrading from PowerAI 1.5.1

PowerAI 1.5.1 should be uninstalled prior to installing PowerAI 1.5.2.

Upgrading from PowerAI 1.5.0

PowerAI 1.5.2 requires newer versions of NVIDIA CUDA, NVIDIA cuDNN, the GPU driver, and IBM Spectrum MPI than 1.5.0. To upgrade, the older versions should be uninstalled and the newer versions installed. Likewise, the PowerAI 1.5.0 software packages should be uninstalled and the PowerAI 1.5.2 packages installed.

Upgrading from PowerAI 1.5.0 Caffe

The Caffe packages in PowerAI 1.5.0 used the HDF5 library from Anaconda. That library is now packaged with PowerAI so the Anaconda copy is no longer needed. After upgrading to 1.5.2, it is safe to remove the library symlinks from the cache directory:
$ ls -l ~/.powerai/caffe-bvlc/
$ rm -r ~/.powerai/caffe-bvlc

$ ls -l ~/.powerai/caffe-ibm/
$ rm -r ~/.powerai/caffe-ibm

Tuning Recommendations

Recommended settings for optimal Deep Learning performance on the S822LC and AC922 for High Performance Computing are:
  • Enable Performance Governor
       $ sudo yum install kernel-tools
       $ sudo cpupower -c all frequency-set -g performance
  • Enable GPU persistence mode
       $ sudo systemctl enable nvidia-persistenced
       $ sudo systemctl start nvidia-persistenced
  • Set GPU memory and graphics clocks
    • S822LC with NVIDIA Tesla P100, set clocks to maximum
      $ sudo nvidia-smi -ac 715,1480
    • AC922 with NVIDIA Tesla V100, set clocks to NVIDIA defaults
      $ sudo nvidia-smi -rac
  • For TensorFlow, set the SMT mode
    • S822LC with NVIDIA Tesla P100, set SMT=2
      $ sudo ppc64_cpu --smt=2
    • AC922 with NVIDIA Tesla V100, set SMT based on DDL usage:
      $ sudo ppc64_cpu --smt=4 # for TensorFlow WITHOUT DDL
      $ sudo ppc64_cpu --smt=2 # for TensorFlow WITH DDL

Getting Started with MLDL Frameworks

General Setup

Most of the PowerAI packages install outside the normal system search paths (to /opt/DL/...), so each framework package provides a shell script to simplify environmental setup (e.g. PATHLD_LIBRARY_PATHPYTHONPATH).
We recommend users update their shell rc file (e.g. .bashrc) to source the desired setup scripts. For example:
$ source /opt/DL/<framework>/bin/<framework>-activate
Each framework also provides a test script to verify some of its functions. These test scripts include tests and examples sourced from the various communities. Note that some of the included tests rely on datasets (ex. MNIST) that are available in the community and are downloaded at runtime. Access and availability to this data is subject to the community and may change at any time.
To run the test script for a particular framework, run:
$ <framework>-test

Note about dependencies

A number of the PowerAI frameworks (for example, TensorFlow, TensorBoard, and PyTorch) have their dependencies satisfied via Anaconda packages. These dependencies are validated by the <framework>-activate script to ensure they are installed and, if not, the script will fail.
For these frameworks, the /opt/DL/<framework>/bin/install_dependencies script must be run prior to activation to install the required packages.
For example:
$ source /opt/DL/tensorflow/bin/tensorflow-activate
Missing dependencies ['backports.weakref', 'mock', 'protobuf']
Run "/opt/DL/tensorflow/bin/install_dependencies" to resolve this problem.

$ /opt/DL/tensorflow/bin/install_dependencies
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment /home/rhel/anaconda2:

The following NEW packages will be INSTALLED:

    backports.weakref: 1.0rc1-py27_0
    libprotobuf:       3.4.0-hd26fab5_0
    mock:              2.0.0-py27_0
    pbr:               1.10.0-py27_0
    protobuf:          3.4.0-py27h7448ec6_0

Proceed ([y]/n)? y

libprotobuf-3. 100% |###############################| Time: 0:00:02   2.04 MB/s
backports.weak 100% |###############################| Time: 0:00:00  12.83 MB/s
protobuf-3.4.0 100% |###############################| Time: 0:00:00   2.20 MB/s
pbr-1.10.0-py2 100% |###############################| Time: 0:00:00   3.35 MB/s
mock-2.0.0-py2 100% |###############################| Time: 0:00:00   3.26 MB/s

$ source /opt/DL/tensorflow/bin/tensorflow-activate
$
Note: PyTorch and TensorFlow have conflicting Anaconda package dependencies. Create separate Anaconda environments for those frameworks.

Getting Started with DDL

The Caffe and TensorFlow sections below describe how to use the DDL support for each of those frameworks.
Some configuration steps are common to all use of DDL:
  • PowerAI frameworks must be installed at the same version on all nodes in the DDL cluster.
  • The DDL master node must be able to log into all the nodes in the cluster using ssh keys. Keys can be created and added by:
    1. Generate ssh private/public key pair on the master node using:
        $ ssh-keygen
    2. Copy the generated public key in ~/.ssh/id_rsa.pub to all the nodes’ ~./ssh/authorized_keys file:
        $ ssh-copy-id -i ~/.ssh/id_rsa.pub $USER@$HOST
  • Linux system firewalls may need to be adjusted to pass MPI traffic. This could be done broadly as shown. Note: Opening only required ports would be more secure. Required ports will vary with configuration.
      $ sudo iptables -A INPUT -p tcp --dport 1024:65535 -j ACCEPT

Getting Started with Caffe

Caffe Alternatives

Packages are provided for upstream BVLC Caffe (/opt/DL/caffe-bvlc) and IBM optimized Caffe (/opt/DL/caffe-ibm). The system default Caffe (/opt/DL/caffe) can be selected using the operating system's alternatives system:
    $ sudo update-alternatives --config caffe
    There are 2 programs which provide 'caffe'.

      Selection    Command
    -----------------------------------------------
       1           /opt/DL/caffe-bvlc
    *+ 2           /opt/DL/caffe-ibm

    Enter to keep the current selection[+], or type selection number:
Users can activate the system default caffe:
    source /opt/DL/caffe/bin/caffe-activate
Or they can activate a specific variant. For example:
    source /opt/DL/caffe-bvlc/bin/caffe-activate
Attempting to activate multiple Caffe packages in a single login session will cause unpredictable behavior.

Caffe Samples and Examples

Each Caffe package includes example scripts and sample models, etc. A script is provided to copy the sample content into a specified directory:
    $ caffe-install-samples <somedir>

More Info

Visit Caffe's website (http://caffe.berkeleyvision.org/) for tutorials and example programs that you can run to get started.
Here are links to a couple of the example programs:

Optimizations in IBM Caffe

The IBM Caffe package (caffe-ibm) in PowerAI is based on BVLC Caffe and includes optimizations and enhancements from IBM:
Note: DDL is to be installed separately as mentioned above.

Command Line Options

IBM Caffe supports all of BVLC Caffe's options and adds a few new ones to control the enhancements. IBM Caffe options related to Distributed Deep Learning (options that start with the word "ddl") will work only if you have DDL installed.
  • -bvlc: Disable CPU/GPU layer-wise reduction
  • -threshold: Tune CPU/GPU layer-wise reduction. If the number of parameters for one layer is greater than or equal to threshold, their accumulation on CPU will be done in parallel. Otherwise, the accumulation will be done using one thread. It is set to 2,000,000 by default.
  • -ddl ["-option1 param -option2 param"]: Enable Distributed Deep Learning, with optional space-delimited parameter string. Supported parameters are:
    • mode <mode>
    • dump_iter <N>
    • dev_sync <0, 1, or 2>
    • rebind_iter <N>
    • dbg_level <0, 1, or 2>
  • -ddl_update: This option instructs Caffe to use a new custom version of the ApplyUpdate function that is optimized for DDL. It is faster, but does not support gradient clipping so is off by default. It can be used in networks that do not support clipping (common).
  • -ddl_align: This option ensures that the gradient buffers have a length that is a multiple of 256 bytes and have start addresses that are multiples of 256. This ensures cache line alignment on multiple platforms as well as alignment with NCCL slices. Off by default
  • -ddl_database_restart: This option ensures every learner always looks at the same data set during an epoch. This allows a system to cache only the pages that are touched by the learners contained within it. It can help size the number of learners needed for a given data set size by establishing a known database footprint per system. This flag should not be used while running caffe on several hosts. Off by default.
  • -lms: Enable Large Model Support. See below.
  • -lms_size_threshold <size in KB>: Set LMS size threshold. See below.
  • -lms_exclude <size in MB>: Tune LMS memory utilization. See below.
  • -affinity: Enable CPU/GPU affinity (default). Specify -noaffinity to disable.
Use the command line options as follows:
    | Feature                         | -bvlc | -ddl | -lms  | -gpu          | -affinity |
    | ------------------------------- | ----- | ---- | ----- | ------------- | --------- |
    | CPU/GPU layer-wise reduction    |   N   |   X  |   X   | multiple GPUs | X         |
    | Distributed Deep Learning (DDL) |   X   |   Y  |   X   | N             | X         |
    | Large model support             |   X   |   X  |   Y   | X             | X         |
    | CPU/GPU affinity                |   X   |   X  |   X   | X             | Y         |

    Y: do specify
    N: don't specifiy
    X: don't care/matter
LMS gets enabled regardless of other options as long as -lms is specified. For example, you can use DDL and LMS together.
CPU/GPU layer-wise reduction is enabled only if multiple GPUs are specified and layer_wise_reduce: false.
Use of multiple GPUs with DDL is specified via the MPI rank file, so the -gpu flag may not be used to specify multiple GPUs for DDL.
While running caffe on several hosts, the use of shared storage for data can lead caffe to hang.

About CPU/GPU Layer-wise Reduction

This optimization aims to reduce the running time of a multiple-GPU training by utilizing CPUs. In particular, gradient accumulation is offloaded to CPUs and done in parallel with the training. To gain the best performance with IBM Caffe, please close unnecessary applications that consume a high percentage of CPU.
If using a single GPU, IBM Caffe and BVLC Caffe will have similar performance.
The optimizations in IBM Caffe do not change the convergence of a neural network during training. IBM Caffe and BVLC Caffe should produce the same convergence results.
CPU/GPU layer-wise reduction is enabled unless the -bvlc commandline flag is used.

About IBM PowerAI Distributed Deep Learning (DDL)

See /opt/DL/ddl/doc/README.md for more information about using IBM PowerAI Distributed Deep Learning.

About Large Model Support (LMS)

IBM Caffe with Large Model Support loads the neural model and data set in system memory and caches activity to GPU memory only when needed for computation. This allows models and training batch size to scale significantly beyond what was previously possible. You can enable Large Model Support by adding -lms. Large Model Support is available as a technology preview.
The -lms_size_threshold <size in KB> option modifies the minimum memory chunk size considered for the LMS cache (default: 1000). Any chunk smaller than this value will be exempt from LMS reuse and will persist in GPU memory. The value can be used to control the performance trade-off.
The -lms_exclude <size in MB> option defines a soft limit on GPU memory allocated for the LMS cache (where limit = GPU-capacity - value). If zero, favors aggressive GPU memory reuse over allocation (default). If specified (> 0), enables aggressive allocation of GPU memory up to the limit. Minimizing this value -- while still allowing enough memory for non-LMS allocations -- may improve performance by increasing GPU memory utilization and reducing data transfers between system and GPU memory.
For example, the following command line options yield the best training performance for the GoogleNet model with high-resolution image data (crop size 2240x2240, batch size 5) using Tesla P100 GPUs:
    $ caffe train -solver=solver.prototxt -gpu all -lms —lms_size_threshold 1000 -lms_exclude 1400
Note that ideal tunings for any given scenario may differ depending on the model's network architecture, data size, batch size and GPU memory capacity.

Combining LMS and DDL

Large Model Support and Distributed Deep Learning can be combined. For example, to run on two hosts named host1 and host2:
    $ ddlrun -H host1,host2 caffe train -solver solver-resnet-152.prototxt -lms

Getting Started with Tensorflow

The TensorFlow homepage (https://www.tensorflow.org/) has a variety of information, including Tutorials, How Tos, and a Getting Started guide.
Additional tutorials and examples are available from the community, for example:

High-Performance Models

A version of TensorFlow High-Performance Models which includes options to use Distributed Deep Learning is included in the tensorflow-performance-models package. For more information, see:
  • /opt/DL/tensorflow-performance-models/scripts/tf_cnn_benchmarks/README.md

Large Model Support (LMS)

This release of PowerAI includes a Technology Preview of large model support for TensorFlow. Large Model Support provides an approach to training large models and batch sizes that cannot fit in GPU memory. It does this by use of a graph editing library that takes the user model's computational graph and automatically adds swap-in and swap-out nodes for transferring tensors from GPU memory to system memory and vice versa during training.
For more information about TensorFlow LMS, see:
  • /opt/DL/tensorflow/doc/README-LMS.md

Distributed Deep Learning (DDL) Custom Operator for TensorFlow

The DDL custom operator uses IBM Spectrum MPI and NCCL to provide high-speed communications for distributed TensorFlow.
The DDL custom operator can be found in the ddl-tensorflow package. For more information about DDL and about the TensorFlow operator, see:
  • /opt/DL/ddl/doc/README.md
  • /opt/DL/ddl-tensorflow/doc/README.md
  • /opt/DL/ddl-tensorflow/doc/README-API.md

Additional TensorFlow Features

The PowerAI TensorFlow packages include TensorBoard. See: https://www.tensorflow.org/get_started/summaries_and_tensorboard
The TensorFlow 1.8.0 package includes support for additional features:

TensorBoard Usage Notes

Additional usage notes are available from the community. See notes at: - https://github.com/tensorflow/tensorboard

Getting started with Snap Machine Learning (Snap ML)

This release of PowerAI includes Technology preview of Snap Machine Learning (Snap ML). Snap ML is a library for training generalized linear models. It is being developed at IBM with the vision to remove training time as a bottleneck for machine learning applications. Snap ML supports a large number of classical machine learning models and scales gracefully to data sets with billions of examples and/or features. It offers distributed training, GPU acceleration and supports sparse data structures.
"With Snap ML you can train your machine learning model faster than you can snap your fingers!"
The Snap ML library offers two different packages:

snap-ml-local

snap-ml-local is used for machine learning on a single machine.
For information on snap-ml-local, see /opt/DL/snap-ml-local/doc/README.md

snap-ml-mpi

snap-ml-mpi is used for distributed training of machine learning models across a cluster of machines.
For information on snap-ml-mpi, see /opt/DL/snap-ml-mpi/doc/README.md

Getting started with PyTorch

This release of PowerAI includes a Technology Preview of PyTorch - deep learning framework for fast, flexible experimentation.

PyTorch Examples

The PyTorch package includes a set of examples. A script is provided to copy the sample content into a specified directory:
    $ pytorch-install-samples <somedir>

More Info

The PyTorch homepage (https://pytorch.org) has a variety of information, including Tutorials and a Getting Started guide.
Additional tutorials and examples are available from the community, for example:

Uninstalling MLDL Frameworks

The MLDL framework packages can be uninstalled individually if desired. Or to uninstall all MLDL packages and the repository package at once:
    $ sudo yum remove powerai-license
    $ sudo yum remove mldl-repo-local
    $ sudo yum autoremove
© Copyright IBM Corporation 2017, 2018
IBM, the IBM logo, ibm.com, POWER, Power, POWER8, POWER9, and Power systems are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
The TensorFlow package includes code from the BoringSSL project. The following notices may apply:
    This product includes software developed by the OpenSSL Project for
    use in the OpenSSL Toolkit. (http://www.openssl.org/)

    This product includes cryptographic software written by Eric Young
    (eay@cryptsoft.com)
This document is current as of the initial date of publication and may be changed by IBM at any time. Not all offerings are available in every country in which IBM operates.
THE INFORMATION IN THIS DOCUMENT IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING WITHOUT ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY OR CONDITION OF NON-INFRINGEMENT. IBM products are warranted according to the terms and conditions of the agreements under which they are provided.

AC922 CUDA 9.2 설치 및 PowerAI 5.2 설치

새로 NVIDIA 홈페이지에서 새로 cuda 9.2의 rpm 파일들을 download 받습니다.   2018.8.9 현재 아래 version이 최신입니다.

# wget https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda-repo-rhel7-9-2-local-9.2.148-1.ppc64le

# wget https://developer.nvidia.com/compute/cuda/9.2/Prod2/patches/1/cuda-repo-rhel7-9-2-148-local-patch-1-1.0-1.ppc64le

이렇게 download 받은 파일을 rpm으로 설치합니다.  이 작업으로 CUDA 관련 local yum repository가 생성됩니다.

# rpm -Uvh cuda-repo-rhel7-9-2-local-9.2.148-1.ppc64le cuda-repo-rhel7-9-2-148-local-patch-1-1.0-1.ppc64le

이제 local에 생성된 CUDA local yum repository로부터 cuda를 설치합니다.   버전 등은 신경쓰지 마시고 그냥 다음과 같이 하면 최신으로 설치합니다.

# yum install cuda

설치가 끝나면 역시 NVIDIA 홈페이지에서 NCCL과 CUDNN library들을 download 받아서 아래와 같이 설치합니다.   설치라기 보다는 tar ball을 /usr/local 밑에 풀어넣는 작업입니다.

https://developer.nvidia.com/nccl/nccl2-download-survey, https://developer.nvidia.com/rdp/cudnn-download

# tar -xvf nccl_2.2.13-1+cuda9.2_ppc64le.solitairetheme8 -C /usr/local

# tar -xvf cudnn-9.2-linux-ppc64le-v7.2.1.38.solitairetheme8 -C /usr/local

이렇게 설치가 끝나면, 아래 URL에 적힌 내용대로 일부 파일들을 수정해주어야 합니다.

# dracut --force

# vi /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0

# vi /usr/lib/systemd/system/nvidia-persistenced.service
[Unit]
Description=NVIDIA Persistence Daemon
Wants=syslog.target

[Service]
Type=forking
PIDFile=/var/run/nvidia-persistenced/nvidia-persistenced.pid
Restart=always
ExecStart=/usr/bin/nvidia-persistenced --verbose
ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced

[Install]
WantedBy=multi-user.target

# systemctl enable nvidia-persistenced

# nvidia-smi -pm 1

# vi /lib/udev/rules.d/40-redhat.rules  (아래 줄을 #으로 comment-out)
...
#SUBSYSTEM=="memory", ACTION=="add", PROGRAM="/bin/uname -p", RESULT!="s390*", ATTR{state}=="offline", ATTR{state}="online"
...

이제 rebooting 합니다.

리부팅이 끝나면 PowerAI 5.2의 rpm을 설치합니다.  이걸 설치하면 mld이라는 local repository가 생깁니다.

[root@3eb2adfbf7f2 test]# rpm -Uvh mldl-repo-local-5.2.0-201806110545.c2f9a0f.ppc64le.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:mldl-repo-local-5.2.0-20180611054################################# [100%]

그리고 환경에 따라 다음과 같이 redhat 관련 repos.conf를 수정해줘야 하는 경우가 있습니다.

[root@3eb2adfbf7f2 test]# vi /etc/yum/pluginconf.d/search-disabled-repos.conf
...
#notify_only=1
notify_only=0

먼저 Anaconda2 5.1과 Anaconda3 5.1을 미리 설치해두어야 합니다. (5.2가 최신 Anaconda인데, 이걸 설치해도 문제는 없는 듯 합니다.)   Python2를 쓰실 거면 Anaconda2 환경에서 다음과 같이 이제 yum으로 power-mldl을 설치합니다.

# which python
/opt/anaconda2/bin/python

# yum install power-mldl

설치가 끝나면 license를 accept 합니다.

# IBM_POWERAI_LICENSE_ACCEPT=yes /opt/DL/license/bin/accept-powerai-license.sh

caffe나 tensorflow 등 각 framework을 사용하기 위해서는 다음과 같이 먼저 환경변수를 설정해줘야 합니다.

# source /opt/DL/tensorflow/bin/tensorflow-activate
Missing dependencies
Run "/opt/DL/tensorflow/bin/install_dependencies" to resolve this problem.

특히 tensorflow의 경우는 위와 같이 install_dependencies를 수행하여 internet으로부터 추가 python package들을 설치해야 합니다.

[root@3eb2adfbf7f2 test]# /opt/DL/tensorflow/bin/install_dependencies
Fetching package metadata ...............

이제 다시 tensorflow-activate를 수행하시면 tensorflow를 사용하실 준비가 된 것입니다.

기본적으로 PowerAI는 python2를 기본으로 합니다만,  python3에서 tensorflow나 pytorch를 쓰시고자 하는 경우도 있습니다.

그럴 경우, 먼저 기본 환경이 Anaconda3 환경임을 확인하신 뒤, 아래와 같이 -py3를 붙여서 설치하시면 됩니다. 

# which python
/opt/anaconda3/bin/python

# yum install power-mldl-py3

# rpm -qa | grep tensorflow
tensorflow-py3-1.8.0-31721.7987738.ppc64le
tensorflow-performance-models-5.2.0-383.668a313.ppc64le
tensorflow-1.8.0-31721.7987738.ppc64le

Python2 환경에서와 동일하게 여기서도 license를 accept하고 install_dependencies를 수행하는 것은 동일합니다.

# source /opt/DL/tensorflow/bin/tensorflow-activate
Missing dependencies
Run "/opt/DL/tensorflow/bin/install_dependencies" to resolve this problem.

# /opt/DL/tensorflow/bin/install_dependencies

참고로 아래와 같은 python package들을 새로 설치하거나 upgrade합니다.  이때 일부는 internet에서 긁어와야 하는 것들도 있습니다.

The following NEW packages will be INSTALLED:

    absl-py:                    0.1.10-py36_0              file://opt/DL/conda-pkgs
    astor:                      0.6.2-py_0                 file://opt/DL/conda-pkgs
    blas:                       1.0-openblas
    blosc:                      1.14.3-hdbcaa40_0
    bzip2:                      1.0.6-h14c3975_5
    ca-certificates:            2018.03.07-hf82bc7d_0
    gast:                       0.2.0-py36_0               file://opt/DL/conda-pkgs
    glib:                       2.53.6-h000015b_2
    gmp:                        6.1.2-h7f7056e_2
    gmpy2:                      2.0.8-py36h10f8cd9_2
    grpcio:                     1.10.0-py36hf484d3e_0      file://opt/DL/conda-pkgs
    icu:                        58.2-h64fc554_1
    kiwisolver:                 1.0.1-py36hf484d3e_0
    libedit:                    3.1.20170329-h6b74fdf_2
    libgcc-ng:                  7.2.0-h7cc24e2_2
    libgfortran-ng:             7.2.0-h9f7466a_2
    libopenblas:                0.2.20-h9ac9557_7
    libprotobuf:                3.5.0-hf484d3e_0           file://opt/DL/conda-pkgs
    libstdcxx-ng:               7.2.0-h7a57d05_2
    libxcb:                     1.13-h1bed415_0
    lzo:                        2.10-h0dabc4d_2
    mpc:                        1.1.0-h10f8cd9_1
    mpfr:                       4.0.1-hdf1c602_3
    ncurses:                    6.1-hf484d3e_0
    openblas-devel:             0.2.20-7
    powerai-tensorflow-prereqs: 1.8.0_31721.7987738-py36_0 file:///opt/DL/tensorflow/conda-pkgs
    protobuf:                   3.5.0-py36_0               file://opt/DL/conda-pkgs
    readline:                   7.0-h1bed415_4
    snappy:                     1.1.7-h1532aa0_3
    termcolor:                  1.1.0-py36_0               file://opt/DL/conda-pkgs
    toposort:                   1.5-py36_0                 file://opt/DL/conda-pkgs
    typing:                     3.6.4-py36_0

The following packages will be UPDATED:

    anaconda:                   5.0.0-py36h39d2194_0       c3i_test                             --> custom-py36_0
    cairo:                      1.14.8-0                                                        --> 1.14.10-h77bcde2_6
    conda:                      4.3.27-py36_0                                                   --> 4.5.9-py36_0
    conda-env:                  2.6.0-0                                                         --> 2.6.0-1
    expat:                      2.1.0-0                                                         --> 2.2.5-hbd03837_0
    fontconfig:                 2.12.1-3                                                        --> 2.12.6-h49f89f6_0
    freetype:                   2.5.5-2                                                         --> 2.8-hadd163a_1
    h5py:                       2.7.0-np113py36_1                                               --> 2.8.0-py36h8d01980_0
    hdf5:                       1.8.17-2                                                        --> 1.10.2-hba1933b_1
    libpng:                     1.6.30-2                                                        --> 1.6.32-h288d48a_4
    libtiff:                    4.0.6-3                                                         --> 4.0.9-he85c1e1_1
    matplotlib:                 2.0.2-np113py36_0                                               --> 2.2.2-py36hbc4b006_0
    numpy:                      1.13.1-py36_1                                                   --> 1.13.3-py36h7cdd4dd_0
    openblas:                   0.2.19-0                                                        --> 0.2.20-7
    openssl:                    1.0.2l-0                                                        --> 1.0.2o-h14c3975_1
    pillow:                     4.2.1-py36_1                                                    --> 5.0.0-py36h3deb7b8_0
    pycosat:                    0.6.2-py36_0                                                    --> 0.6.3-py36h14c3975_0
    pytables:                   3.4.2-np113py36_0                                               --> 3.4.4-py36ha205bf6_0
    python:                     3.6.2-0                                                         --> 3.6.5-hc3d631a_2
    pyyaml:                     3.12-py36_0                                                     --> 3.13-py36h14c3975_0
    ruamel_yaml:                0.11.14-py36_1                                                  --> 0.15.46-py36h14c3975_0
    scikit-learn:               0.19.0-np113py36_1                                              --> 0.19.1-py36h6cfcb94_0
    scipy:                      0.19.1-np113py36_1                                              --> 1.1.0-py36h9c1e066_0
    sqlite:                     3.13.0-0                                                        --> 3.24.0-h84994c4_0
    tk:                         8.5.18-0                                                        --> 8.6.7-hb4a6f0b_3
    yaml:                       0.1.6-0                                                         --> 0.1.7-h1bed415_2


이제 다시 다음을 수행하시면 python3 환경에서 tensorflow를 사용하실 준비가 된 것입니다.

# source /opt/DL/tensorflow/bin/tensorflow-activate

2018년 8월 6일 월요일

H2O DriverlessAI에 포함된 h2o4gpu를 python과 R에서 사용하는 방법

H2O DriverlessAI를 ppc64le 아키텍처인 AC922에 설치하는 것은 매우 간단합니다.   다음 manual대로 하시면 되는데, 여기서는 매뉴얼 보시기 귀찮으신 분들을 위해 초간단으로 정리했습니다.

http://docs.h2o.ai/driverless-ai/latest-stable/docs/userguide/UsingDriverlessAI.pdf

먼저 DriverlessAI의 rpm package를 다음과 같이 download 받습니다.

[root@ING data]# wget https://s3.amazonaws.com/artifacts.h2o.ai/releases/ai/h2o/dai/rel-1.2.2-6/ppc64le-centos7/dai-1.2.2-1.ppc64le.rpm

rpm 명령으로 설치합니다.

[root@ING data]# rpm -Uvh dai-1.2.2-1.ppc64le.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:dai-1.2.2-1                      ################################# [100%]
User configuration file /etc/dai/User.conf already exists.
Group configuration file /etc/dai/Group.conf already exists.
Configured user in /etc/dai/User.conf is 'dai'.
Configured group in /etc/dai/Group.conf is 'dai'.
Group 'dai' already exists.
User 'dai' already exists.
Adding systemd configuration files in /etc/systemd/system...
Created symlink from /etc/systemd/system/dai.service.wants/dai-dai.service to /usr/lib/systemd/system/dai-dai.service.
Created symlink from /etc/systemd/system/dai.service.wants/dai-h2o.service to /usr/lib/systemd/system/dai-h2o.service.
Created symlink from /etc/systemd/system/dai.service.wants/dai-procsy.service to /usr/lib/systemd/system/dai-procsy.service.
Calling 'systemctl enable dai'...
Created symlink from /etc/systemd/system/multi-user.target.wants/dai.service to /usr/lib/systemd/system/dai.service.
Installation complete.

DAI의 구동도 매우 간단합니다.  아래와 같이 dai.service만 start 해주면 main process와 보조 h2o process, proxy process인 dai-procsy까지 모두 자동으로 뜹니다. 

[root@ING ~]# systemctl start dai

[root@ING ~]# systemctl status dai-dai
● dai-dai.service - Driverless AI (Main Application Process)
   Loaded: loaded (/usr/lib/systemd/system/dai-dai.service; enabled; vendor preset: disabled)

[root@ING ~]# systemctl status dai-h2o
● dai-h2o.service - Driverless AI (H2O Process)
   Loaded: loaded (/usr/lib/systemd/system/dai-h2o.service; enabled; vendor preset: disabled)

[root@ING ~]# systemctl status dai-procsy
● dai-procsy.service - Driverless AI (Procsy Process)
   Loaded: loaded (/usr/lib/systemd/system/dai-procsy.service; enabled; vendor preset: disabled)

그리고 test1이라는 user를 만들고, 그 user를 DAI의 기본 user/group인 dai라는 group에 포함시킵니다.

[root@ING ~]# usermod -a -G dai test1
[root@ING ~]# cat /etc/group | grep dai
dai:x:980:test1

다음과 같이 t1.py와 t1.R을 준비합니다.  이것들은 python과 R에서 h2o4gpu를 사용할 수 있는지 확인하는 python 및 R script입니다.

[test1@ING ~]$ cat t1.py
import h2o4gpu
import numpy as np
X = np.array([[1.,1.], [1.,4.], [1.,0.]])
model = h2o4gpu.KMeans(n_clusters=2,random_state=1234).fit(X)
model.cluster_centers_

[test1@ING ~]$ cat t1.R
library(reticulate)
library(h2o4gpu)
use_python("/opt/h2oai/dai/python/bin/python")
x <- iris[1:4]
y <- as.integer(iris$Species)
model <- h2o4gpu.random_forest_classifier() %>% fit(x, y)
pred <- model %>% predict(x)
library(Metrics)
ce(actual = y, predicted = pred)

이제 test1에서 DAI에 포함된 h2o4gpu를 사용하는 방법입니다.  한줄 요약하면, PATH 등 환경변수를 설정하여 DAI에서 제공하는 python 및 PYTHONPATH를 사용하기만 하면 됩니다.

[test1@ING ~]$ export PATH=/opt/h2oai/dai/python/bin:$PATH
[test1@ING ~]$ export LD_LIBRARY_PATH=/opt/h2oai/dai/python/lib:/opt/h2oai/dai/lib:$LD_LIBRARY_PATH
[test1@ING ~]$ export PYTHONPATH=/opt/h2oai/dai/cuda-9.2/lib/python3.6/site-packages

[test1@ING ~]$ pip list | grep h2o
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
h2o (3.20.0.2)
h2o4gpu (0.2.0.9999+master.eb6295c)
h2oai (1.2.2)
h2oai-client (1.2.2)
h2oaicore (1.2.2)

DAI에서 제공하는 python은 3.6이며, 일반 anaconda에서 제공되는 것과 동일합니다.  제가 source로부터 build한 tensorflow 1.8도 pip로 정상적으로 설치해서 동일하게 사용할 수 있습니다.

[test1@ING ~]$ pip install /tmp/tensorflow-1.8.0-cp36-cp36m-linux_ppc64le.whl

[test1@ING ~]$ pip list | grep tensorflow
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
tensorflow (1.8.0)

[test1@ING ~]$ which python
/opt/h2oai/dai/python/bin/python

이제 python에서 저 위의 t1.py를 수행하겠습니다.  여기서는 그냥 line by line으로 copy & paste 했습니다.

[test1@ING ~]$ python
Python 3.6.4 (default, Jun 30 2018, 13:42:46)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import h2o4gpu
>>> import numpy as np
>>> X = np.array([[1.,1.], [1.,4.], [1.,0.]])
>>> model = h2o4gpu.KMeans(n_clusters=2,random_state=1234).fit(X)
>>> model.cluster_centers_
array([[1. , 0.5],
       [1. , 4. ]])
>>>

다음으로 R에서 저 위의 t1.R을 수행하겠습니다.  여기서는 그냥 line by line으로 copy & paste 했습니다.

[test1@ING ~]$ R

R version 3.4.1 (2017-06-30) -- "Single Candle"

> library(reticulate)
y <- as.integer(iris$Species)
model <- h2o4gpu.random_forest_classifier() %>% fit(x, y)
pred <- model %>% predict(x)
library(Metrics)
ce(actual = y, predicted = pred)> library(h2o4gpu)

Attaching package: ‘h2o4gpu’

The following object is masked from ‘package:base’:

    transform

> use_python("/opt/h2oai/dai/python/bin/python")
> x <- iris[1:4]
> y <- as.integer(iris$Species)
> model <- h2o4gpu.random_forest_classifier() %>% fit(x, y)
> pred <- model %>% predict(x)
/opt/h2oai/dai/python/lib/python3.6/site-packages/sklearn/preprocessing/label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
  if diff:
> library(Metrics)
> ce(actual = y, predicted = pred)
[1] 0.02666667
>

또한 tensorflow가 제대로 GPU를 물고 올라오는지 시험해보겠습니다.  물론 잘 됩니다.

[test1@ING ~]$ python
Python 3.6.4 (default, Jun 30 2018, 13:42:46)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import tensorflow as tf
/opt/h2oai/dai/python/lib/python3.6/site-packages/h5py-2.7.1-py3.6-linux-ppc64le.egg/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

>>> sess=tf.Session()
2018-08-06 10:21:44.054091: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties:
name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53
pciBusID: 0004:04:00.0
totalMemory: 15.75GiB freeMemory: 15.34GiB
2018-08-06 10:21:44.568612: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 1 with properties:
name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53
pciBusID: 0004:05:00.0
totalMemory: 15.75GiB freeMemory: 15.34GiB
2018-08-06 10:21:45.033482: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 2 with properties:
name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53
pciBusID: 0035:03:00.0
totalMemory: 15.75GiB freeMemory: 15.34GiB
2018-08-06 10:21:45.461878: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 3 with properties:
name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53
pciBusID: 0035:04:00.0
totalMemory: 15.75GiB freeMemory: 15.34GiB
2018-08-06 10:21:45.462104: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0, 1, 2, 3
2018-08-06 10:21:47.427824: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-08-06 10:21:47.427960: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929]      0 1 2 3
2018-08-06 10:21:47.427989: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0:   N Y Y Y
2018-08-06 10:21:47.428012: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 1:   Y N Y Y
2018-08-06 10:21:47.428034: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 2:   Y Y N Y
2018-08-06 10:21:47.428055: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 3:   Y Y Y N
2018-08-06 10:21:47.431083: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14857 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0004:04:00.0, compute capability: 7.0)
2018-08-06 10:21:47.987194: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 14857 MB memory) -> physical GPU (device: 1, name: Tesla V100-SXM2-16GB, pci bus id: 0004:05:00.0, compute capability: 7.0)
2018-08-06 10:21:48.813286: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:2 with 14856 MB memory) -> physical GPU (device: 2, name: Tesla V100-SXM2-16GB, pci bus id: 0035:03:00.0, compute capability: 7.0)
2018-08-06 10:21:49.397252: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:3 with 14861 MB memory) -> physical GPU (device: 3, name: Tesla V100-SXM2-16GB, pci bus id: 0035:04:00.0, compute capability: 7.0)
>>>

2018년 7월 26일 목요일

ppc64le에서 xgboost4j build하기

먼저 http://hwengineer.blogspot.com/2018/07/ppc64le-pyarrow-wheel-build.html 의 안내에 따라 pyarrow를 설치해야 합니다.  그 다음에 xgboost의 source를 받습니다. 

[root@ING data]# git clone -b h2oai  https://github.com/h2oai/xgboost.git
Cloning into 'xgboost'...
remote: Counting objects: 25961, done.
remote: Compressing objects: 100% (86/86), done.
remote: Total 25961 (delta 83), reused 78 (delta 45), pack-reused 25828
Receiving objects: 100% (25961/25961), 9.44 MiB | 4.67 MiB/s, done.
Resolving deltas: 100% (15316/15316), done.

[root@ING data]# cd xgboost

[root@ING xgboost]# git submodule init
Submodule 'cub' (https://github.com/NVlabs/cub) registered for path 'cub'
Submodule 'dmlc-core' (https://github.com/dmlc/dmlc-core) registered for path 'dmlc-core'
Submodule 'rabit' (https://github.com/dmlc/rabit) registered for path 'rabit'

[root@ING xgboost]# git submodule update --recursive
Cloning into 'cub'...
remote: Counting objects: 32642, done.
remote: Total 32642 (delta 0), reused 0 (delta 0), pack-reused 32642
Receiving objects: 100% (32642/32642), 16.46 MiB | 6.82 MiB/s, done.
Resolving deltas: 100% (28620/28620), done.
Submodule path 'cub': checked out 'b20808b1b04ec3d6a625e51fbc1eb76f337754ad'
Cloning into 'dmlc-core'...
remote: Counting objects: 4975, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 4975 (delta 7), reused 9 (delta 2), pack-reused 4952
Receiving objects: 100% (4975/4975), 1.22 MiB | 1.44 MiB/s, done.
Resolving deltas: 100% (2976/2976), done.
Submodule path 'dmlc-core': checked out '459ab734d15acd68fd437abf845c7c1730b5a38f'
Cloning into 'rabit'...
remote: Counting objects: 3174, done.
remote: Total 3174 (delta 0), reused 0 (delta 0), pack-reused 3173
Receiving objects: 100% (3174/3174), 905.56 KiB | 378.00 KiB/s, done.
Resolving deltas: 100% (2058/2058), done.
Submodule path 'rabit': checked out '87143deb4c0a34302f727ba35497e3380b2cced8'

처음에 해줄 것은 build.sh 수행, 그 다음에 make -f Makefile2 libxgboost 입니다.  여기까지 해주면 xgboost의 wheel 파일이 build 됩니다.  그 다음에 jvm-packages에 들어가서 create_jni.py를 수행하여 libxgboost4j.so를 만들어 줍니다.

[root@ING xgboost]# ./build.sh
...
build/linear/updater_coordinate.o dmlc-core/libdmlc.a rabit/lib/librabit.a  -pthread -lm  -fopenmp -lrt  -lrt
Successfully build multi-thread xgboost


[root@ING xgboost]# make -f Makefile2 libxgboost
...
copying build/lib/xgboost/build-python.sh -> build/bdist.linux-ppc64le/wheel/xgboost
copying build/lib/xgboost/libxgboost.so -> build/bdist.linux-ppc64le/wheel/xgboost
running install_egg_info
Copying xgboost.egg-info to build/bdist.linux-ppc64le/wheel/xgboost-0.72-py3.6.egg-info
running install_scripts
creating build/bdist.linux-ppc64le/wheel/xgboost-0.72.dist-info/WHEEL

[root@ING xgboost]# ls -l ./python-package/dist/xgboost-0.72-py3-none-any.whl
-rw-r--r-- 1 root root 77640590 Jul 23 14:52 ./python-package/dist/xgboost-0.72-py3-none-any.whl

[root@ING xgboost]# pip install ./python-package/dist/xgboost-0.72-py3-none-any.whl

[root@ING xgboost]# cd jvm-packages

[root@ING jvm-packages]# python create_jni.py
...
[100%] Linking CXX shared library ../lib/libxgboost4j.so
[100%] Built target xgboost4j
cd demo/regression
/root/anaconda3/bin/python mapfeat.py
/root/anaconda3/bin/python mknfold.py machine.txt 1
copying native library
mkdir -p xgboost4j/src/main/resources/lib
cp ../lib/libxgboost4j.so xgboost4j/src/main/resources/lib
copying pure-Python tracker
cp ../dmlc-core/tracker/dmlc_tracker/tracker.py xgboost4j/src/main/resources
copying train/test files
mkdir -p xgboost4j-spark/src/test/resources
cd ../demo/regression
/root/anaconda3/bin/python mapfeat.py
/root/anaconda3/bin/python mknfold.py machine.txt 1
cp ../demo/regression/machine.txt.train xgboost4j-spark/src/test/resources
cp ../demo/regression/machine.txt.test xgboost4j-spark/src/test/resources
cp ../demo/data/agaricus.txt.test xgboost4j-spark/src/test/resources
cp ../demo/data/agaricus.txt.train xgboost4j-spark/src/test/resources

[root@ING jvm-packages]# ls -l ./xgboost4j/src/main/resources/lib/libxgboost4j.so
-rwxr-xr-x 1 root root 158562656 Jul 23 15:49 ./xgboost4j/src/main/resources/lib/libxgboost4j.so

[root@ING jvm-packages]# file ./xgboost4j/src/main/resources/lib/libxgboost4j.so
./xgboost4j/src/main/resources/lib/libxgboost4j.so: ELF 64-bit LSB shared object, 64-bit PowerPC or cisco 7500, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=510aede1975d463804199edd1b74457b8e48c4f8, not stripped

위에서 생성된 libxgboost4j.so을 h2o.jar에 lib/linux64/libxgboost4j_gpu.so라는 이름으로 update해주면 됩니다.

$ mkdir -p lib/linux64

$ cp ./xgboost4j/src/main/resources/lib/libxgboost4j.so lib/linux64/libxgboost4j.so

$ jar uf h2o.jar lib/linux64/libxgboost4j.so

------------------------------

아래는 위의 build하는 과정에서 만났던 몇가지 error 및 그 회피 방법입니다.

[root@ING xgboost]# make -f Makefile2 libxgboost
...
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.10.62->awscli>=1.11.148->-r requirements_runtime.txt (line 74))
  Using cached https://files.pythonhosted.org/packages/b7/31/05c8d001f7f87f0f07289a5fc0fc3832e9a57f2dbd4d3b0fee70e0d51365/jmespath-0.9.3-py2.py3-none-any.whl
recommonmark 0.4.0 has requirement commonmark<=0.5.4, but you'll have commonmark 0.7.5 which is incompatible.
Installing collected packages: html5lib, bleach, execnet, qtconsole, tabulate, testpath, pyasn1, rsa, jmespath, botocore, s3transfer, awscli, feather-format, graphviz
  Found existing installation: html5lib 0.9999999
Cannot uninstall 'html5lib'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
make: *** [libxgboostp2nccl] Error 1


[root@ING xgboost]# rm -rf /root/anaconda3/lib/python3.6/site-packages/html5lib*

[root@ING xgboost]# make -f Makefile2 libxgboost
...
Installing collected packages: testpath, jmespath, botocore, pyasn1, rsa, s3transfer, awscli, feather-format, graphviz
Successfully installed awscli-1.15.63 botocore-1.10.62 feather-format-0.4.0 graphviz-0.8.4 jmespath-0.9.3 pyasn1-0.4.3 rsa-3.4.2 s3transfer-0.1.13 testpath-0.3.1
pip install -r requirements_build.txt
Could not open requirements file: [Errno 2] No such file or directory: 'requirements_build.txt'
make: *** [libxgboostp2nccl] Error 1

[root@ING xgboost]# find . -name "requirement*.txt"
./doc/requirements.txt
./requirements_buildonly.txt
./requirements_runtime.txt


[root@ING xgboost]# cp ./requirements_buildonly.txt ./requirements_build.txt

[root@ING xgboost]# make -f Makefile2 libxgboost
...
Collecting cmake>=0.8.0 (from -r requirements_build.txt (line 9))
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/79/06/e89052a7e65ab765bc5e279542853d043ec857e61f253973c05a80f2490f/cmake-3.11.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-cu87aoqb/cmake/setup.py", line 7, in <module>
        from skbuild import setup
    ModuleNotFoundError: No module named 'skbuild'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-cu87aoqb/cmake/
make: *** [libxgboostp2nccl] Error 1


[root@ING xgboost]# vi requirements_build.txt
#cmake>=0.8.0



ppc64le 환경에서 pyarrow wheel 파일 build하기

h2o 및 h2o4gpu를 open source로부터 build하려면 xgboost4j_gpu.so가 필요합니다.  그런데 그걸 build하려면 또 pyarrow가 필요하지요.  하지만, ppc64le 아키텍처에서 pyarrow를 설치하려면 다음과 같이 error가 나는 것을 보셨을 것입니다.

$ pip install pyarrow
Collecting pyarrow
Using cached https://files.pythonhosted.org/packages/be/2d/11751c477e4e7f4bb07ac7584aafabe0d0608c170e4bff67246d695ebdbe/pyarrow-0.9.0.tar.gz
...
[ 66%] Building CXX object CMakeFiles/lib.dir/lib.cxx.o
/tmp/pip-install-kil31a/pyarrow/build/temp.linux-ppc64le-2.7/lib.cxx:592:35: fatal error: arrow/python/platform.h: No such file or directory
#include "arrow/python/platform.h"
^
compilation terminated.
make[2]: *** [CMakeFiles/lib.dir/lib.cxx.o] Error 1
make[1]: *** [CMakeFiles/lib.dir/all] Error 2
make: *** [all] Error 2
error: command 'make' failed with exit status 2

이 문제에 대해서 최근에 arrow community 도움을 받아 해결을 했습니다.

https://github.com/apache/arrow/issues/2281

좀더 간단하게는 다음과 같이 정리할 수 있습니다.

먼저, Redhat에서는 다음과 같이 사전 필요 fileset들을 설치합니다.

[dhkim@ING ~]$ sudo yum install jemalloc jemalloc-devel boost boost-devel flex flex-devel bison bison-devel

[dhkim@ING ~]$ mkdir imsi
[dhkim@ING ~]$ cd imsi

이 error를 해결하는 핵심은 먼저 arrow와 parquet-cpp를 source에서 build 하는 것입니다.

[dhkim@ING imsi]$ git clone https://github.com/apache/arrow.git

[dhkim@ING imsi]$ git clone https://github.com/apache/parquet-cpp.git

[dhkim@ING imsi]$ which python
~/anaconda2/bin/python

여기서는 anaconda2를 사용하는데, anaconda3도 동일하게 build할 수 있습니다.  먼저 conda 명령어로 다음과 같은 package들을 설치합니다.

[dhkim@ING imsi]$ conda install numpy six setuptools cython pandas pytest cmake flatbuffers rapidjson boost-cpp thrift snappy zlib gflags brotli lz4-c zstd -c conda-forge

여기서는 user home directory 밑에 dist라는 directory에 arrow와 parquet-cpp를 설치하겠습니다.

[dhkim@ING imsi]$ mkdir dist
[dhkim@ING imsi]$ export ARROW_BUILD_TYPE=release
[dhkim@ING imsi]$ export ARROW_HOME=$(pwd)/dist
[dhkim@ING imsi]$ export PARQUET_HOME=$(pwd)/dist

[dhkim@ING imsi]$ mkdir arrow/cpp/build && cd arrow/cpp/build

[dhkim@ING build]$ cmake3 -DCMAKE_BUILD_TYPE=$ARROW_BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$ARROW_HOME  -DARROW_PYTHON=on -DARROW_PLASMA=on -DARROW_BUILD_TESTS=OFF  -DARROW_PARQUET=ON ..

[dhkim@ING build]$ make -j 8

[dhkim@ING build]$ make install
...
-- Installing: /home/dhkim/imsi/dist/include/arrow/python/platform.h
-- Installing: /home/dhkim/imsi/dist/include/arrow/python/pyarrow.h
-- Installing: /home/dhkim/imsi/dist/include/arrow/python/type_traits.h
-- Installing: /home/dhkim/imsi/dist/lib64/pkgconfig/arrow-python.pc

[dhkim@ING build]$ cd ~/imsi/arrow/python

[dhkim@ING python]$ MAKEFLAGS=-j8 ARROW_HOME=/home/dhkim/imsi/dist PARQUET_HOME=/home/dhkim/imsi/dist python setup.py build_ext --build-type=$ARROW_BUILD_TYPE --with-parquet --inplace

[dhkim@ING python]$ export LD_LIBRARY_PATH=/home/dhkim/imsi/dist/lib64:$LD_LIBRARY_PATH

이제 pyarrow를 build할 준비가 끝났습니다.  다만, arrow 쪽의 사소한 bug로 인해, 다음과 같이 끝에 점(.)이 달린 *.so. 라는 soft link들을 만들어주어야 합니다.

[dhkim@ING python]$ ln -s /home/dhkim/imsi/dist/lib64/libarrow_python.so.11.0.0 /home/dhkim/imsi/dist/lib64/libarrow_python.so.
[dhkim@ING python]$ ln -s /home/dhkim/imsi/dist/lib64/libarrow.so.11.0.0 /home/dhkim/imsi/dist/lib64/libarrow.so.
[dhkim@ING python]$ ln -s /home/dhkim/imsi/dist/lib64/libparquet.so.1.4.1 /home/dhkim/imsi/dist/lib64/libparquet.so.

이제 wheel file을 build 합니다.

[dhkim@ING python]$ python setup.py build_ext --build-type=release --with-parquet --bundle-arrow-cpp bdist_wheel

다음과 같이 dist directory 밑에 만들어집니다.

[dhkim@ING python]$ ls -l dist/pyarrow-0.10.1.dev687+g18a61f6-cp36-cp36m-linux_ppc64le.whl
-rw-rw-r-- 1 dhkim dhkim 7195829 Jul 26 16:03 dist/pyarrow-0.10.1.dev687+g18a61f6-cp36-cp36m-linux_ppc64le.whl

이걸 pip로 설치하고, import까지 잘 되는 것을 확인하실 수 있습니다.

[dhkim@ING python]$ pip install dist/pyarrow-0.10.1.dev687+g18a61f6-cp36-cp36m-linux_ppc64le.whl

[dhkim@ING python]$ pip list | grep pyarrow
pyarrow                           0.10.1.dev687+g18a61f6

[dhkim@ING python]$ python
Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 23:32:32)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyarrow
>>>

이 과정 안 겪으셔도 되도록, 아래에 pyarrow의 python2.7용 whl과 python3.6용 whl을 google drive에 올려두겠습니다.


python3.6용 wheel


For some gentlemen who got errors like "ImportError: libarrow.so.10: cannot open shared object file: No such file or directory" from the wheel file I uploaded here...

What we need is just perseverance.


1.  First, you need to install the pyarrow*.whl in my blog, and then...

2.  Make soft links as needed.  My wheel file places awkward names like "libarrow.so." due to a bug of https://github.com/apache/arrow/issues/2281 .

[u0017649@sys-96013 pyarrow]$ ln -s /home/u0017649/anaconda3/lib/python3.6/site-packages/pyarrow/libarrow.so. /home/u0017649/anaconda3/lib/python3.6/site-packages/pyarrow/libarrow.so.10

[u0017649@sys-96013 ~]$ ln -s /home/u0017649/anaconda3/lib/python3.6/site-packages/pyarrow/libarrow_python.so. /home/u0017649/anaconda3/lib/python3.6/site-packages/pyarrow/libarrow_python.so.10

[u0017649@sys-96013 ~]$ ln -s /home/u0017649/anaconda3/lib/python3.6/site-packages/pyarrow/libplasma.so. /home/u0017649/anaconda3/lib/python3.6/site-packages/pyarrow/libplasma.so.10

3. Still you might get some more errors.  These will be addressed by installing OS packages. 

ImportError: libboost_system-mt.so.1.53.0: cannot open shared object file: No such file or directory
ImportError: libboost_filesystem-mt.so.1.53.0: cannot open shared object file: No such file or directory

[u0017649@sys-96013 ~]$ sudo yum install boost-system

[u0017649@sys-96013 ~]$ sudo yum install boost-filesystem

[u0017649@sys-96013 ~]$ sudo yum install boost-regex

4. You might and might not get the following weird error.  This can be addressed by upgrading numpy.  Pls refer to
https://issues.apache.org/jira/browse/ARROW-3141 .

>>> import pyarrow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/u0017649/anaconda3/lib/python3.6/site-packages/pyarrow/__init__.py", line 50, in <module>
    import pyarrow.compat as compat
AttributeError: module 'pyarrow' has no attribute 'compat'


[u0017649@sys-96013 ~]$ pip install numpy --upgrade
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/2d/80/1809de155bad674b494248bcfca0e49eb4c5d8bee58f26fe7a0dd45029e2/numpy-1.15.4.zip (4.5MB)
    100% |████████████████████████████████| 4.5MB 271kB/s
Building wheels for collected packages: numpy
  Running setup.py bdist_wheel for numpy ... done
  Stored in directory: /home/u0017649/.cache/pip/wheels/13/6b/70/4b5d7861227307f91716c31698240e08c6ec5486d9ee82a97b
Successfully built numpy
Installing collected packages: numpy
  Found existing installation: numpy 1.13.1
    Uninstalling numpy-1.13.1:
      Successfully uninstalled numpy-1.13.1
Successfully installed numpy-1.15.4


5.  And finally, Voila !

[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyarrow
>>>



2018년 7월 13일 금요일

Redhat 7.5 ppc64le에서 CRAN-R을 source로부터 설치하기


전에 Ubuntu 16.04 ppc64le에서 CRAN-R을 설치하는 과정을 올린 바 있습니다만, 이번에는 Redhat의 경우입니다.   대부분의 과정은 비슷합니다.

먼저, Redhat EPEL에 포함된 R은 3.5 버전입니다.  이걸 쓰셔도 된다면 그냥 이걸 설치하시는 것이 편합니다. 

[root@ING ~]# yum list | grep R-core
R-core.ppc64le                      3.5.0-1.el7         epel
R-core-devel.ppc64le                3.5.0-1.el7         epel


그러나 특정 버전, 가령 3.4.1을 설치하시려면 다음과 같이 CRAN에서 source를 받아다 설치하시면 됩니다.   먼저 기존에 설치된 R 3.5 버전을 다음과 같이 삭제합니다.

[root@ING ~]# yum erase R R-core R-core-devel R-devel R-java R-java-devel libticonv-devel

이어서 기본적으로 필요한 OS package들을 설치합니다.

[root@ING test]# yum install readline-devel readline-static libX11-devel libX11-common libXt-devel libXt bzip2 bzip2-libs bzip2-devel lzma-sdk-devel lzma-sdk457-devel pcre2-devel pcre3-devel gcc-gfortran libgfortran libcurl-devel curl texlive-latex texlive-latex-fonts texlive-txfonts texlive-pxfonts texlive-fontaxes java-1.8.0-openjdk java-1.8.0-openjdk-devel java-1.8.0-openjdk-headless

이제 source를 download 받습니다.

[root@ING test]# wget https://cran.r-project.org/src/base/R-3/R-3.4.1.tar.gz

[root@ING test]# tar -zxf R-3.4.1.tar.gz

[root@ING test]# cd R-3.4.1

Build 순서는 똑같습니다.  configure - make - make install 순입니다.

[root@ING R-3.4.1]# ./configure --enable-R-shlib

[root@ING R-3.4.1]# make -j 16

[root@ING R-3.4.1]# make install

이렇게 설치하면 기본적으로 /usr/local/lib64/R 밑에 설치됩니다.

[root@ING R]# pwd
/usr/local/lib64/R

[root@ING R]# ls
bin  COPYING  doc  etc  include  lib  library  modules  share  SVN-REVISION

그러나 별도로 PATH를 잡아주지 않아도 이미 /usr/local/bin에 R이 copy되어 있으므로 그냥 그대로 쓰시면 됩니다.

[root@ING ~]# which R
/usr/local/bin/R

[root@ING ~]# R

R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: powerpc64le-unknown-linux-gnu (64-bit)
...
Type 'q()' to quit R.

> install.packages("knitr")

> install.packages("anim.plots")



*  저같은 경우 ./configure --enable-R-shlib 수행시 처음에는 아래와 같은 error가 발생했습니다.

configure: error: libcurl >= 7.22.0 library and headers are required with support for https

그러나 실제로 보면 아래처럼 libcurl은 이미 7.29 버전이 설치되어 있습니다.

[root@ING R-3.4.1]# yum list | grep libcurl
libcurl.ppc64le                     7.29.0-46.el7       @anaconda/7.5
libcurl-devel.ppc64le               7.29.0-46.el7       @rhel-7-for-power-9-rpms

이 error의 원인은 다음과 같이 config.log를 뒤져보면 알 수 있습니다.  즉, 환경 설정에서 PATH 변수 맨 앞에 anaconda2가 오도록 되어 있었는데, anaconda2 속에 설치된 libcurl의 버전이 낮은 것이 원인이었습니다.


[root@ING R-3.4.1]# env | grep PATH
PATH=/opt/anaconda2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/opt/DL/tensorflow/bin:/opt/DL/protobuf/bin:/opt/DL/caffe-bvlc/bin

[root@ING R-3.4.1]# grep libcurl config.log
configure:40993: checking if libcurl is version 7 and >= 7.22.0
/usr/bin/ld: warning: libssl.so.1.0.0, needed by /opt/anaconda2/lib/libcurl.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libcrypto.so.1.0.0, needed by /opt/anaconda2/lib/libcurl.so, not found (try using -rpath or -rpath-link)
/opt/anaconda2/lib/libcurl.so: undefined reference to `SSL_CTX_set_srp_username'
/opt/anaconda2/lib/libcurl.so: undefined reference to `libssh2_scp_recv2'
/opt/anaconda2/lib/libcurl.so: undefined reference to `SSL_CTX_set_srp_password'
configure:41089: error: libcurl >= 7.22.0 library and headers are required with support for https

이는 간단히 PATH 환경 변수에서 anaconda2를 제거한 뒤 configure를 수행하면 간단히 핵결됩니다.

그렇게 해도 문제가 되는 수가 있는데, 그럴 경우엔 아예 다음과 같이 어느 directory에서 libcurl.so를 찾으라고 명시적으로 지정하면 확실히 해결이 됩니다.

[bsyu@p57a22 R-3.4.1]$ ./configure --enable-R-shlib LDFLAGS="-L/usr/lib64 -lcurl"


2018년 7월 3일 화요일

PowerAI R5.2가 docker image로도 나왔습니다


PowerAI는 v1.4까지는 internet에서 자유롭게 download 받아서 쓸 수 있도록 되어 있었으나, v1.5부터는 별도로 주문을 해야 download 받을 수 있도록 바뀌었습니다.  다만 이때도 machine serial #만 넣으면 무료로 주문이 되니까 비용 부담은 없었습니다.   그래도 불편한 것은 사실이었지요.

그 점은 여전합니다만, v1.5.2, 즉 R5.2부터는 PowerAI를 포함한 docker image로도 배포가 됩니다. 

Redhat 7.5와 docker 13.1, nvidia-docker 1.0을 설치한 AC922 위에서 쓸 수 있는 이 docker image는 Ubuntu 16.04에 CUDA 9.2 기반으로 만들어져 있습니다.  그리고 그 속에 포함된 PowerAI R5.2 속에는 다음과 같은 component 들이 들어있습니다.

특히 IBM이 별도로 만들어 contribute한 Snap ML도 들어있는 것이 눈에 띕니다.


ComponentVersion
Distributed Deep Learning (DDL)1.0.0
TensorFlow1.8.0
TensorBoard1.8.0
IBM Caffe1.0.0
BVLC Caffe1.0.0
PyTorch0.4.0
Snap ML1.0.0
Spectrum MPI10.2
Bazel0.10.0
OpenBLAS0.2.20
Protobuf3.4.0

사용법은 일반 docker와 동일하며 간단합니다.  아래와 같이 pull 해서...

# docker pull ibmcom/powerai

다음과 같이 사용하시면 됩니다. 

# nvidia-docker run -ti --env LICENSE=yes ibmcom/powerai bash

현재 사용가능한 tag은 1.5.2-all-ubuntu16.04와 1.5.2-all-ubuntu16.04-py3이 있습니다.   가령 python3에서 tensorflow를 사용하시고자 한다면 아래와 같이 py3 tag를 붙여서 pull/run 하시면 됩니다.

# docker pull ibmcom/powerai:1.5.2-all-ubuntu16.04-py3

# nvidia-docker run -ti --env LICENSE=yes ibmcom/powerai:1.5.2-all-ubuntu16.04-py3 bash


더 자세한 내용은 아래 site를 참조하세요.

https://developer.ibm.com/linuxonpower/deep-learning-powerai/releases/

https://hub.docker.com/r/ibmcom/powerai/