Data and AI on Power

 View Only

Create a Python runtime environment on IBM Power to take advantage of MMA

By Theresa Xu posted Tue August 30, 2022 01:32 PM

  

The purpose of this blog is to show data scientists how to setup a Python runtime environment to benefit from MMA (Math Matrix Accelerator) hardware acceleration for AI workloads on an IBM Power10 server running Linux. MMAs provide an alternative to external accelerators, such as GPUs, and related device management, for executing statistical machine learning and inferencing (scoring) workloads.

The Python runtime environment will be setup by using conda, an open-source, cross-platform, language-agnostic package manager and environment management system. Conda allows for easy and convenient AI library installations for data scientists when they incorporate AI into analytic workloads.

Prerequisites

To complete the steps outlined in this blog, you will need access to a Power10 server running Linux with Red Hat Enterprise Linux (RHEL) 8.5.

Estimated time to complete

It’ll take approximately 20 minutes to create the conda environment to take advantage of MMA on Power.

Steps

Follow these steps to create the conda environment with TensorFlow 2.7 and Python 3.9:

  1. Switch to the user where you want to create the conda environment.
  2. Use wget to download the bash installer:
    wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-ppc64le.sh​
  3. Install Anaconda for ppc64le and accept all the license agreements:
    bash Anaconda3-2021.05-Linux-ppc64le.sh​
  4. Add Anaconda to your path:
    source ~/.bashrc​
  5. Add the conda-forge channel:
    conda config —add channels conda-forge​
  6. Add the rocketce channel:
    conda config —add channels rocketce​
  7. Create a Conda environment called “mma-env” with Python 3.9:
    conda create -n mma-env python=3.9​
  8. Activate the Conda environment “mma-env” that was created in Step 6:
    conda activate mma-env​
  9. Install library dependency from conda-forge:
    onda install gfortran -c conda-forge
  10. Install the CPU version of TensorFlow from the rocketce library. Conda will automatically install the latest version of tensorflow-cpu available on rocketce:
    conda install tensorflow-cpu​
  11. Install scikit-learn, a machine learning library that is commonly used in parallel with TensorFlow:
    conda install scikit-learn=1.0.2​
  12. Install pydot, a Data-to-Intelligence handling library that is commonly used in parallel with TensorFlow:
    conda install pydot​
  13. Install sklearn-pandas, a scikit-learn and pandas fusion DataFrame library that is commonly used in parallel with TensorFlow:
    conda install sklearn-pandas​
  14. Verify the install of libgfortran5:
    conda install libgfortran5​

Note that you can add different AI libraries such as PyTorch, OpenCV, and so on, in the same way you added TensorFlow.

You should now have a Python runtime environment created on your Power10 system. It’s easy to install other packages from anaconda.org with a simple search. You can also add new channels other than the ones highlighted in this blog and install specific packages from those channels.  You must setup all dependent AI libraries under the same conda environment.

Summary

MMA is used to accelerate AI inferencing and model build. There was a study published on December 2021 that shows MMA on a Power10 has a 2x advantage over no MMA on a Power9: https://developer.ibm.com/tutorials/power10-business-inferencing-at-scale-with-mma/.  Furthermore, we have conducted AI inferencing with a LSTM model on a Power10 MMA system and an x86 system without MMA. The results show that with MMA, we see a 2X performance advantage. Therefore, the incorporation of MMA in Power10 allows for significantly better performance without introducing complexity to the AI workload.

Permalink