IronArray for Python
This package supports two modes for building the Python extension: develop and release.
-
The develop mode uses the
iarrayrepo locallly so as to find the headers and libraries. This allows to develop both packages (the C library and the Python wrapper) in parallel without the need to re-install the C library in every iteration. -
The release mode assumes that both the
iarraylibrary is installed in the system.
The two modes are setup and driven by environment variables. Here are examples for Linux/Mac OSX:
export LD_LIBRARY_PATH=/opt/intel/compilers_and_libraries/linux/mkl/lib:$HOME/inaos/iron-array/build
export IARRAY_DEVELOP_MODE=True
export INAC_DIR=$HOME/.inaos/cmake/inac-linux-x86_64-relwithdebinfo-1.0.6
export PYTHONPATH=$HOME/inaos/iron-array-python/
export IARRAY_DIR=$HOME/inaos/iron-array
export KMP_DUPLICATE_LIB_OK=TRUE # for allowing the MKL in NumPy to run in parallel to the one in IronArrayexport LD_LIBRARY_PATH=/opt/intel/compilers_and_libraries/mac/mkl/lib:$HOME/inaos/iron-array/build
export IARRAY_DEVELOP_MODE=True
export INAC_DIR=$HOME/.inaos/cmake/inac-darwin-x86_64-relwithdebinfo-1.0.6
export PYTHONPATH=$HOME/inaos/iron-array-python/
export IARRAY_DIR=$HOME/inaos/iron-array
export KMP_DUPLICATE_LIB_OK=TRUE # for allowing the MKL in NumPy to run in parallel to the one in IronArrayunset IARRAY_DEVELOP_MODE
export INAC_DIR=$HOME/.inaos/cmake/inac-darwin-x86_64-relwithdebinfo-1.0.6In case you have Intel IPP libraries installed (for a turbo-enabled LZ4 codec within C-Blosc2), make sure that you run:
source ~/intel/bin/compilervars.sh intel64so as to allow the iarray library to find the IPP libraries. This applies to both develop and release modes.
After setting up the build mode, we can proceed with the compilation of the actual Python wrapper for iarray:
rm -rf build iarray/*.so # *.pyd if on windows. This step is a cleanup and purely optional.
python setup.py build_ext -iand execute the tests with:
pytest
====================================================================================== test session starts =======================================================================================
platform darwin -- Python 3.7.1, pytest-4.3.0, py-1.8.0, pluggy-0.9.0
rootdir: /Users/faltet/inaos/iron-array-python, inifile:
collected 16 items
iarray/tests/test_constructor.py .............. [ 87%]
iarray/tests/test_expression.py .. [100%]
=================================================================================== 16 passed in 0.29 seconds ====================================================================================When in release mode, you may want to install this package in the system. For doing this, use:
python setup.py installThe setup.py can be used to produce wheels, where all the libraries are included (see https://pythonwheels.com).