From 96c8941f6e6fdbad793bfeaa4f75be48a871566a Mon Sep 17 00:00:00 2001 From: yamadafuyuka Date: Mon, 17 Apr 2023 18:50:23 +0900 Subject: [PATCH] modify README.md --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3322c7c..db5bdc7 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,68 @@ -# `mkl_umath` +`mkl_umath for SVE` +==== -`mkl_umath._ufuncs` exposes [Intel(R) Math Kernel Library](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html) -powered version of loops used in the patched version of [NumPy](https://numpy.org), that used to be included in -[Intel(R) Distribution for Python*](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/distribution-for-python.html). +This repository provides Python module `mkl_umath for SVE` to speed up +transcendental-function calculation of NumPy on CPUs supporting the +AArch64 SVE instruction set. +`mkl_umath for SVE` is based on [mkl_umath](https://github.com/IntelPython/mkl_umath). -Patches were factored out per community feedback ([NEP-36](https://numpy.org/neps/nep-0036-fair-play.html)). +## Supported environment -## Building +- Linux running on AArch64 CPU which supports SVE instructions. -Intel(R) C compiler and Intel(R) Math Kernel Library are required to build `mkl_umath` from source: +## Requirement +- Linux +- cmake +- Cython +- GCC (10.2.x or later is mandatory, because ACLE (Arm C Language Extension) support is needed.) +- ninja-build +- NumPy (1.24.x or later is recommended.) +## Build and Install +### Build SLEEF + +Because [SLEEF (SIMD Library for for Evaluating Elementary Functions)](https://sleef.org) +is used as the vectorized implementation of transcendental functions, +SLEEF must be built beforehand. + +```sh +git clone https://github.com/shibatch/sleef sleef +mkdir build && cd build +cmake -DCMAKE_INSTALL_PREFIX=directory_path_where_you_want_to_install_sleef -DENFORCE_SVE=TRUE -DBUILD_SHARED_LIBS=FALSE -G "Ninja" ../sleef +ninja +ninja test (This step can be skipped.) +ninja install +``` + +### Build mkl_umath for SVE ```sh -# ensure that MKL is installed, icc is activated -export MKLROOT=$CONDA_PREFIX -python setup.py config_cc --compiler=intelem build_ext --inplace +git clone git@github.com:fujitsu/mkl_umath.git +cd mkl_umath +CC=gcc CXX=g++ SLEEF_PATH=directory_path_where_you_installed_sleef python setup.py build install +``` + +## Usage +```python +import numpy as np +a = np.double(np.random.random_sample(1024)) +np.sin(a) # NumPy's transcendental function + +import mkl_umath as um +um._patch.use_in_numpy() +np.sin(a) # mkl_umath for SVE ``` +## LICENCE + +`mkl_umath for SVE` is licensed under +[BSD 3-Clause "New" or "Revised" License](LICENSE). +Refer to the ["LICENSE"](LICENSE) file for the full license text and copyright notice. + +This distribution includes and/or uses third party software governed by separate license terms. + +- BSD 3-Clause "New" or "Revised" License + - [NumPy](https://github.com/numpy/numpy) + - [mkl_umath](https://github.com/IntelPython/mkl_umath) +- Boost Software License 1.0 + - [SLEEF](https://github.com/shibatch/sleef) +