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
23 changes: 16 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ before_install:
- if [[ $TEST_CONDA == 0 ]]; then
sudo apt-get install liblapack-dev libblas-dev;
sudo apt-get install gfortran;
sudo apt-get install cmake;
fi

install:
Expand All @@ -27,25 +28,32 @@ install:
# See https://conda.io/docs/user-guide/tasks/use-conda-with-travis-ci.html
#
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
wget http://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda update -q --all
- if [[ $TEST_CONDA == 1 ]]; then conda install conda-build; fi
- conda info -a
#
# Set up a test environment for testing everything out
- conda create -q -n test-environment python="$TRAVIS_PYTHON_VERSION" pip coverage nose numpy
- conda create -q -n test-environment python="$TRAVIS_PYTHON_VERSION" pip coverage nose numpy openblas
- source activate test-environment

#
# Make sure that fortran compiler can find conda libraries
#
- export LIBRARY_PATH="$HOME/miniconda/envs/test-environment/lib";

# install scikit-build
- if [[ $TEST_CONDA == 0 ]]; then
conda config --append channels conda-forge;
conda install -c conda-forge scikit-build >=0.8.0 ;
fi
#
# Install the slycot package (two ways, to improve robustness). For the
# conda version, need to install lapack from conda-forge (no way to specify
Expand All @@ -56,11 +64,11 @@ install:
#
- if [[ $TEST_CONDA == 1 ]]; then
conda config --append channels conda-forge;
conda build --python "$TRAVIS_PYTHON_VERSION" conda-recipe;
conda install -c conda-forge lapack;
conda build --python "$TRAVIS_PYTHON_VERSION" conda-recipe-openblas;
conda install -c conda-forge openblas >=0.3.0;
conda install --override-channels -c local slycot;
else
LAPACKLIBS=lapack:blas python setup.py install;
CMAKE_GENERATOR="Unix Makefiles" python setup.py install;
fi
#
# coveralls not in conda repos :-(
Expand All @@ -69,7 +77,8 @@ install:
script:
# Local unit tests
# TODO: replace with nose?
- python runtests.py --coverage
- cd ..
- python Slycot/runtests.py --coverage --no-build
#
# As a deeper set of tests, get test against python-control as well
#
Expand Down
50 changes: 50 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# CMake file for use in conjunction with scikit-build

cmake_minimum_required(VERSION 3.4.0)

if (CMAKE_VERSION VERSION_GREATER "3.11.99")
cmake_policy(SET CMP0074 NEW)
endif()

project(slycot VERSION ${SLYCOT_VERSION})

# Fortran detection fails on windows, use the CMAKE_C_SIMULATE flag to
# force success
if(WIN32)
set(CMAKE_Fortran_SIMULATE_VERSION 19.0)
# set(CMAKE_Fortran_COMPILER_FORCED TRUE)
# set(CMAKE_C_COMPILER_VERSION 19.0)
endif()

enable_language(C)
enable_language(Fortran)

find_package(PythonLibs REQUIRED)
find_package(NumPy REQUIRED)
#set(BLA_VENDOR "OpenBLAS")
find_package(LAPACK REQUIRED)
message(STATUS "LAPACK: ${LAPACK_LIBRARIES}")
message(STATUS "Slycot version: ${SLYCOT_VERSION}")

# find python, standard packages, F2PY find flaky on Windows
if (NOT WIN32)
find_package(F2PY REQUIRED)
endif()

# pic option for flang not correct, remove for Windows
if (WIN32)
set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "")
endif()

# base site dir, use python installation for location specific includes
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c
"from distutils.sysconfig import get_python_lib as pl; print(pl())"
OUTPUT_VARIABLE PYTHON_SITE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(WIN32)
string(REPLACE "\\" "/" PYTHON_SITE ${PYTHON_SITE})
endif()

add_subdirectory(slycot)

3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Numpy should be the only prerequisite (though you may need the LAPACK
libraries as well, depending on your particular system configuration).

If you are installing Slycot from source, you will need a FORTRAN
compiler, such as gfortran, and BLAS/LAPACK libraries.
compiler, such as gfortran, and BLAS/LAPACK libraries. The build
system uses skbuild (scikit-buildsystem >= 0.8.1) and cmake.

On Debian derivatives you should be able to install all the above with a
single command::
Expand Down
70 changes: 66 additions & 4 deletions conda-recipe-openblas/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,78 @@
cd %RECIPE_DIR%
cd ..

set F77=%BUILD_PREFIX%\Library\bin\flang.exe
set F90=%BUILD_PREFIX%\Library\bin\flang.exe
:: indicating fortran compiler is essential
set FC=%BUILD_PREFIX%\Library\bin\flang.exe

:: The batch file created by conda-build sets a load of environment variables
:: Building worked fine without conda; apparently one or more of these
:: variables produce test & link failures. Resetting most of these here
set ARCH=
set BUILD=
set BUILD_PREFIX=
set CMAKE_GENERATOR=
set CommandPromptType=
set CPU_COUNT=
set DISTUTILS_USE_SDK=
set folder=
set cpu_optimization_target=
set fortran_compiler=
set Framework40Version=
set FrameworkDir=
set FrameworkDIR64=
set FrameworkVersion=
set FrameworkVersion64=
set ignore_build_only_deps=
set CFLAGS=
set CXXFLAGS=
set cxx_compiler=
set c_compiler=
set INCLUDE=
set LDFLAGS_SHARED=
set LIBPATH=
set LIB=;%LIB%
set MSSdk=
set MSYS2_ARG_CONV_EXCL=
set MSYS2_ENV_CONV_EXCL=
set NETFSXDIR=
set PIP_IGNORE_INSTALLED=
set platform=
set WindowsLibPath=
set WindowsSdkDir=
set CYGWIN_PREFIX=
set SRC_DIR=
set STDLIB_DIR=
set SUBDIR=
set SYS_PREFIX=
set target_platform=
set UCRTVersion=
set UniversalCRTSdkDir=
set VCINSTALLDIR=
set vc=
set win=
set VisualStudioVersion=
set VSINSTALLDIR=
set VSREGKEY=
set VS_MAJOR=
set VS_VERSION=
set VS_YEAR=
set WindowsSDKLibVersion=
set WindowsSDKVersion=
set WindowsSDKExecutablePath_x64=
set WindowsSDKExecutablePath_x86=

:: information on remaining variables
set

set BLAS_ROOT=%CONDA_PREFIX%
set LAPACK_ROOT=%CONDA_PREFIX%

"%PYTHON%" setup.py build
"%PYTHON%" setup.py install

if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.

:: See
:: http://docs.continuum.io/conda/build.html
:: https://conda.io/docs/user-guide/tasks/build-packages/environment-variables.html
:: for a list of environment variables that are set during the build process.
7 changes: 7 additions & 0 deletions conda-recipe-openblas/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@

cd $RECIPE_DIR/..

# specify where CMAKE will search for lapack and blas
# needs recent cmake (conda's 3.12) and policy CMP0074 NEW
export BLAS_ROOT=${CONDA_PREFIX}
export LAPACK_ROOT=${CONDA_PREFIX}

$PYTHON setup.py install
21 changes: 14 additions & 7 deletions conda-recipe-openblas/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ build:

requirements:
host:
- python {{PY_VER}}
- flang # [win]
- {{ compiler('c') }} # [win]
- {{ compiler('fortran') }} # [not win]
- numpy
- scikit-build >=0.8.0

build:
- numpy
- openblas >=0.3.0
- libflang # [win]
- libgfortran # [not win]
- python

build:
- {{ compiler('fortran') }} # [not win]
- {{ compiler('c') }} # [win]
- flang # [win]
- openblas >=0.3.0
# on Windows, this relies on having visual studio CE 2015
# this link needed quite some searching, please do not delete!
# https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409

run:
- numpy
- openblas >=0.3.0
Expand All @@ -28,7 +31,11 @@ requirements:

test:
requires:
- numpy
- openblas
- python {{PY_VER}}
- libgfortran # [not win]
- libflang # [win]
imports:
- slycot

Expand Down
2 changes: 1 addition & 1 deletion conda-recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ cd ..

set F77=%BUILD_PREFIX%\Library\bin\flang.exe
set F90=%BUILD_PREFIX%\Library\bin\flang.exe
set LAPACKLIBS=lapack:blas

"%PYTHON%" setup.py build
"%PYTHON%" setup.py install

if errorlevel 1 exit 1
Expand Down
1 change: 0 additions & 1 deletion conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
cd $RECIPE_DIR/..
export LAPACKLIBS=lapack:blas
$PYTHON setup.py install
20 changes: 13 additions & 7 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ build:

requirements:
host:
- numpy
- lapack
- libflang # [win]
- libgfortran # [not win]
- python {{PY_VER}}
- numpy
- flang # [win]
- {{ compiler('c') }} # [win]
- {{ compiler('fortran') }} # [not win]
- scikit-build >=0.8.0

build:
- {{ compiler('fortran') }} # [not win]
- {{ compiler('c') }} # [win]
- flang # [win]
- numpy
- libflang # [win]
- libgfortran # [not win]
- lapack
# on Windows, this relies on having visual studio CE 2015
# this link needed quite some searching, please do not delete!
# https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409
Expand All @@ -29,7 +31,11 @@ requirements:

test:
requires:
- numpy
- lapack
- python {{PY_VER}}
- libgfortran # [not win]
- libflang # [win]
imports:
- slycot

Expand Down
Loading