This is IBM CODAIT’s PyTorch prebuilt packages for IBM Z and LinuxONE. Our build is currently minimal and supports CPU only. This project is still in its beta phase, and any feedback is welcome.
A GNU/Linux distribution with glibc >= 2.28. This includes RHEL 8 and Ubuntu 20.04.
You also need BLAS and LAPACK. On RHEL, install them with
$ sudo dnf install blas lapack
On Ubuntu, install them with
$ sudo apt install libblas3 liblapack3
Additionally, building the dependency NumPy (which will be automatically executed when installing PyTorch) requires the Python development files, a C compiler, and a Fortran compiler.
To install the latest package, for Python 3.6, run:
$ pip install https://github.com/IBM/pytorch-on-z/raw/packages/torch-1.10.0-cp36-cp36m-linux_s390x.whl
For Python 3.8, run:
$ pip install https://github.com/IBM/pytorch-on-z/raw/packages/torch-1.10.0-cp38-cp38-linux_s390x.whl
For Python 3.9, run:
$ pip install https://github.com/IBM/pytorch-on-z/raw/packages/torch-1.10.0-cp39-cp39-linux_s390x.whl
Not all tests for the C++ library can pass for PyTorch version 1.8.1 and 1.8.2.
We built the packages as follows on RHEL 8 on LinuxONE.
Create an empty virtual environment and activate it:
$ python3.9 -m venv ~/.pytorch-build # Replace python3.9 with python3.8/python3.6 if building for Python 3.8/3.6
$ . ~/.pytorch-build/bin/activate
Clone PyTorch source code and check out the PyTorch version to build:
$ git clone --recursive https://github.com/pytorch/pytorch.git
$ cd pytorch
$ git checkout v1.10.0
$ git submodule update --recursive
Install dependencies:
$ pip install -r requirements.txt
$ pip install wheel
Run the build commands:
$ DEBUG=0 CMAKE_EXPORT_COMPILE_COMMANDS=YES USE_BREAKPAD=0 USE_OPENMP=1 USE_DISTRIBUTED=0 USE_MKLDNN=0 USE_NCCL=0 USE_CUDA=0 USE_PYTORCH_QNNPACK=0 USE_XNNPACK=0 USE_QNNPACK=0 USE_NNPACK=0 USE_QNNPACK=0 USE_FBGEMM=0 BUILD_TEST=0 USE_NUMA=OFF python3 setup.py develop --cmake-only
$ MAX_JOBS=1 python setup.py develop
Run the tests:
$ python test/run_test.py
Create the package:
$ python setup.py bdist_wheel
Now the package should be available in the directory dist/
.