Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 16 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
- TEST_PKG="conda" BLA_VENDOR="OpenBLAS"
- TEST_PKG="conda" BLA_VENDOR="Intel10_64lp" # MKL
- TEST_PKG="dist" BLA_VENDOR="OpenBLAS"
- TEST_PKG="dist" BLA_VENDOR="Generic" # reference BLAS/LAPACK
- TEST_PKG="dist" BLA_VENDOR="Generic" # force reference BLAS/LAPACK

jobs:
# additional single Linux and OSX jobs
Expand All @@ -33,9 +33,6 @@ jobs:
os: osx
language: shell
env: TEST_PKG="dist" BLA_VENDOR="Apple" SLYCOT_PYTHON_VERSION=3.8.0
allow_failures:
- python: "3.9"
env: TEST_PKG="conda" BLA_VENDOR="Intel10_64lp"

before_install:
- |
Expand Down Expand Up @@ -90,34 +87,31 @@ install:
source "$HOME/miniconda/etc/profile.d/conda.sh"
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q --all
conda install conda-build
conda install conda-verify
conda config --append channels conda-forge;
conda config --add channels conda-forge;
conda update -q --all
conda info -a;
if [[ $BLA_VENDOR == "OpenBLAS" ]]; then
conda_blas=openblas
conda_recipe=conda-recipe-openblas
elif [[ $BLA_VENDOR == "Intel10_64lp" ]]; then
conda_blas=mkl
conda_recipe=conda-recipe-mkl
elif [[ $BLA_VENDOR == "Apple" ]]; then
conda_blas=
conda_recipe=conda-recipe-apple
else
echo "Unsupported BLA_VENDOR for conda builds: $BLA_VENDOR"
exit 3
fi
conda create -q -n test-environment \
python="$SLYCOT_PYTHON_VERSION" \
pip coverage pytest-cov \
numpy scipy matplotlib \
$conda_blas
numpy scipy matplotlib
conda activate test-environment
export LIBRARY_PATH="$HOME/miniconda/envs/test-environment/lib"
numpyversion=$(python -c 'import numpy; print(numpy.version.version)')
conda build --python "$SLYCOT_PYTHON_VERSION" --numpy $numpyversion $conda_recipe
conda build --python "$SLYCOT_PYTHON_VERSION" --numpy $numpyversion conda-recipe
conda install local::slycot
if [[ $BLA_VENDOR == "OpenBLAS" ]]; then
conda install 'libblas=*=*openblas'
elif [[ $BLA_VENDOR == "Intel10_64lp" ]]; then
conda install 'libblas=*=*mkl'
elif [[ $BLA_VENDOR == "Apple" ]]; then
export LD_LIBRARY_PATH="/opt/MacOSX10.9.sdk/usr/lib"
else
echo "Unsupported BLA_VENDOR for conda builds: $BLA_VENDOR"
exit 3
fi

elif [[ $TEST_PKG == dist ]]; then
pip install scikit-build pytest-cov matplotlib scipy;
CMAKE_GENERATOR="Unix Makefiles" python setup.py install;
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ include COPYING
include AUTHORS
include gpl-2.0.txt
include README.rst
include MANIFEST.in
include setup.cfg.in
include CMakeLists.txt
include pyproject.toml
include .travis.yml
include conda-recipe/*
include slycot/CMakeLists.txt
include slycot/tests/CMakeLists.txt
include slycot/*.py
Expand Down
126 changes: 70 additions & 56 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ following dependencies:
- NumPy
- scikit-build >= 0.10.0
- CMake
- C compiler (e.g. gcc, MS Visual C++)
- C compiler (e.g. gcc, MS Visual C++, clang)
- FORTRAN compiler (e.g. gfortran, ifort, flang)
- BLAS/LAPACK (e.g. OpenBLAS, ATLAS, MKL)

To run the Slycot unit tests and examples, you'll also need scipy and
To run the Slycot unit tests and examples, you'll also need SciPy and
pytest.

There are a variety of ways to install these dependencies on different
operating systems. See the individual packages' documentation for options.

Installing
-----------
----------

The easiest way to get started with Slycot is to install pre-compiled
binaries from conda-forge (see below); these are available for Linux,
Expand All @@ -62,10 +62,23 @@ from the conda-forge channel with the following command::

conda install -c conda-forge slycot

Compiling from source
---------------------

The hardest part about installing from source is getting a working
version of FORTRAN and LAPACK (provided by OpenBLAS, MKL, etc.)
installed on your system. Depending on where you get your NumPy and SciPy
from, you will need to use a compatible LAPACK implementation. Make sure that
the correct header files are installed, and specify the environment variable
`BLA_VENDOR`_, if necessary.

.. _BLA_VENDOR: https://cmake.org/cmake/help/latest/module/FindBLAS.html#input-variables


From source without conda (Linux, macOS, Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Unpack the source code to a directory of your choice,
Unpack the source code (or clone the git repository) to a directory of your choice,
e.g. ``/path/to/slycot_src/``

If you need to specify a specific compiler, set the environment variable FC
Expand All @@ -82,23 +95,33 @@ To build and install, execute::
cd /path/to/slycot_src/
python setup.py install

From source using a conda recipe (Linux and macOS)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From source using the conda recipe
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also use conda to build and install Slycot from source, but
you'll have to choose the right recipe directory.
You can use conda to compile and install Slycot from source. The recipe is
located in the folder ``conda-recipe`` and is intended to work for all
platforms.

On Linux you can choose between ``conda-recipe-openblas`` and
``conda-recipe-mkl``
The ``conda-forge`` channel provides almost all requirements to compile
Slycot with `conda-build`_, except:

On macOS you should use ``conda-recipe-apple``. See the
`conda-build documentation`_ how to get the required macOS SDK.
- On macOS, you need the macOS SDK. See the
`conda-build documentation for macOS`_ how to get it.
- On Windows, you need to install `Microsoft Visual C++ 14.x`_ provided e.g.
by `Microsoft Visual Studio`_. To build, you'll need a command shell setup
for both conda and the Visual Studio build tools. See `conda activation`_
and `Microsoft Visual Studio setup`_ for information on this.

.. _conda-build documentation: https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html#macos-sdk
.. _conda-build: https://docs.conda.io/projects/conda-build/en/latest/resources/commands/conda-build.html
.. _conda-build documentation for macOS: https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html#macos-sdk
.. _Microsoft Visual C++ 14.x: https://wiki.python.org/moin/WindowsCompilers
.. _Microsoft Visual Studio: https://visualstudio.microsoft.com/de/vs/
.. _conda activation: https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#windows-environment-has-not-been-activated
.. _Microsoft Visual Studio setup: https://docs.microsoft.com/en-us/cpp/build/setting-the-path-and-environment-variables-for-command-line-builds

For example, to build with the OpenBLAS recipe::
To build and install::

conda build -c conda-forge conda-recipe-openblas
conda build -c conda-forge conda-recipe
conda install -c conda-forge --use-local slycot

From source in a conda environment (Windows)
Expand All @@ -110,28 +133,46 @@ dependencies, *except* for the C compiler.

This procedure has been tested on Python 3.7 and 3.8.

First, install the `correct Visual Studio compiler for the Python
version`_ you wish to build for.
1. Install `Microsoft Visual Studio`_.
2. Unpack the source code to a directory of your choice,
3. Create a command shell setup that can run the conda commands and the Visual
Studio build tools (see above)
4. In such a command shell, within the Slycot source code directory, run the
following commands to build and install Slycot (this example creates a
Python 3.8 environment)::

.. _correct Visual Studio compiler for the Python version: https://wiki.python.org/moin/WindowsCompilers
conda create --channel conda-forge --name build-slycot python=3.8 numpy scipy libblas=*=*netlib liblapack=*=*netlib scikit-build flang pytest
conda activate build-slycot

To build, you'll need a command shell setup for both conda and the
Visual Studio build tools. See `conda activation`_ and `Microsoft
Visual Studio setup`_ for information on this.
python setup.py install

.. _conda activation: https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#windows-environment-has-not-been-activated
.. _Microsoft Visual Studio setup: https://docs.microsoft.com/en-us/cpp/build/setting-the-path-and-environment-variables-for-command-line-builds?view=vs-2019
Using pip
~~~~~~~~~

In such a command shell, run the following commands to build and
install Slycot (this example creates a Python 3.8 environment)::
We publish Slycot to the Python package index, but only as a source
package, so to install using pip you'll first need to install the
build prerequisites (compilers, libraries, etc.)

conda create --channel conda-forge --name build-slycot python=3.8 numpy scipy libblas=*=*netlib liblapack=*=*netlib scikit-build flang pytest
conda activate build-slycot
If you have these build prerequisites, the command::

python setup.py install
pip install slycot

will download the latest release of the source code from `PyPI`_, compile, and
install Slycot into the currently configured location (virtual environment or
user site-packages).

.. _PyPI: https://pypi.org/project/slycot

Additional hints
~~~~~~~~~~~~~~~~

Additional hints for how to install Slycot from source can be found in the
``.travis.yml`` (commands used for Travis CI) and the ``conda-recipe``
directory (conda pre-requisites, install and test commands) both which are
included in the source code repository.

Testing
~~~~~~~
-------
To test if the installation was successful, you can run the slycot unit tests::

pytest --pyargs slycot
Expand All @@ -146,30 +187,3 @@ Importing ``slycot`` or running ``pytest`` without ``--pyargs slycot`` from
inside the source directory will fail, unless the compiled wrapper library has
been installed into that directory. Note that the ``[tool:pytest]`` section
in ``setup.cfg`` enforces the ``--pyargs slycot`` argument by default.

General notes on compiling
~~~~~~~~~~~~~~~~~~~~~~~~~~

Additional tips for how to install Slycot from source can be found in the
``.travis.yml`` (commands used for Travis CI) and the ``conda-recipe-*/``
directories (conda pre-requisites) both which are included in the source
code repository.

The hardest part about installing from source is getting a working
version of FORTRAN and LAPACK (provided by OpenBLAS, MKL, etc.)
installed on your system, and working properly with Python.

Note that in some cases you may need to set the ``LIBRARY_PATH`` environment
variable to pick up dependencies such as ``-lpythonN.m`` (where N.m is the
version of python you are using).

Using pip
~~~~~~~~~

We publish Slycot to the Python package index, but only as a source
package, so to install using pip you'll first need to install the
build prerequisites (compilers, libraries, etc.)

If you have these build prerequisites, install in the standard way with:

pip install slycot
2 changes: 0 additions & 2 deletions conda-recipe-apple/conda_build_config.yaml

This file was deleted.

46 changes: 0 additions & 46 deletions conda-recipe-apple/meta.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions conda-recipe-mkl/build.sh

This file was deleted.

46 changes: 0 additions & 46 deletions conda-recipe-mkl/meta.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions conda-recipe-openblas/build.sh

This file was deleted.

Loading