Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dd90059
working on getting 'C' version for td04ad checked
repagh Jun 4, 2018
72a9875
test adding
repagh Jun 6, 2018
46171e5
work in progress
repagh Jun 14, 2018
f897e75
- corrected TD04AD.f to handle the case of 'C' and static gain tf
repagh Jun 15, 2018
3c6f49f
another fix
repagh Jun 15, 2018
253ed42
working TD04AD.f, does not crash any more on edge cases (N=0, NR=0),
repagh Jun 20, 2018
e8edd6f
working TD04AD.f, does not crash any more on edge cases (N=0, NR=0),
repagh Jun 20, 2018
54f0510
fix conda recipe, anaconda 5
repagh Jun 22, 2018
a2298fd
delete separate build.sh/bld.bat
repagh Jun 23, 2018
6d30bd0
further testing
repagh Jun 26, 2018
f01ba18
- re-worked windows build to use Flang fortran and vc14 linkage
repagh Jun 26, 2018
59e920b
Merge branch 'master' into fix-td04ad
repagh Jun 26, 2018
9c812db
Merge branch 'master' into fix-td04ad
repagh Jun 26, 2018
9a8da81
travis adjustment for openblas use
repagh Jun 27, 2018
74241a8
forgot semicolon in travis.yml
repagh Jun 27, 2018
b4e82cb
fix win/not win distinction in meta.yaml
repagh Jun 27, 2018
a6090e3
adjust linker options for Linux
repagh Jun 27, 2018
8a46dd3
fix for compile on Darwin/Linux, add library path based on python loc
repagh Jun 27, 2018
11fe4f5
ensure new openblas is used
repagh Jun 27, 2018
a893db4
add conda-forge channel to the conda config
repagh Jun 27, 2018
d9bef4f
revert to using lapack
repagh Jun 27, 2018
97a1e94
keep the openblas conda recipe too
repagh Jun 27, 2018
2e72514
revert travis to lapack too
repagh Jun 27, 2018
1b8ff5f
use lapack libs for non-conda build too
repagh Jun 27, 2018
2df2163
correct package names to liblapack-dev and libblas-dev in .travis.yml
repagh Jun 28, 2018
c387595
- do not specify blas for the lapack version meta.yaml
repagh Jun 28, 2018
439558b
- ensure test is under same python version as build
repagh Jun 28, 2018
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
19 changes: 13 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ env:

before_install:
#
# Install fortran compiler
# Install fortran compiler, if not using Conda's
#
- sudo apt-get install gfortran
#- sudo apt-get install gfortran

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest removing this line rather than commenting it out.

#
# If not using conda, then install liblapack here (conda version
# will handle this through the build recipe)
#
- if [[ $TEST_CONDA == 0 ]]; then sudo apt-get install liblapack-dev; fi
- if [[ $TEST_CONDA == 0 ]]; then
sudo apt-get install liblapack-dev libblas-dev;
sudo apt-get install gfortran;
fi

install:
#
Expand Down Expand Up @@ -50,13 +53,17 @@ install:
# Install the slycot package (two ways, to improve robustness). For the
# conda version, need to install lapack from conda-forge (no way to specify
# this in the recipe).
# add the conda-forge channel to the config, otherwise openblas or
# lapack cannot be found in the check
# with --override-channels to make sure the locally built slycot is installed
#
- if [[ $TEST_CONDA == 1 ]]; then
conda install -c conda-forge lapack;
conda config --append channels conda-forge;
conda build --python "$TRAVIS_PYTHON_VERSION" conda-recipe;
conda install slycot --use-local;
conda install -c conda-forge lapack;
conda install --override-channels -c local slycot;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this way of doing a local install instead of using --use-local flag? I believe --use-local is what is in the standard conda recipe template.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But --use-local adds the local channel to your set of channels. If the slycot build failed, it would happily install the slycot found in other channels! This happened in the python 2.7 and 3.5 variants.
Since in the overviews of installed modules I saw "local" listed as a channel for the locally built slycot, I assumed that that channel was simply called local. And it works.

Also, --override-channels, which you need to block all others, will not work with --use-local.

else
python setup.py install;
LAPACKLIBS=lapack:blas python setup.py install;
fi
#
# coveralls not in conda repos :-(
Expand Down
17 changes: 17 additions & 0 deletions conda-recipe-openblas/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:: Uncoment following two lines for local test build
cd %RECIPE_DIR%
cd ..

set F77=%BUILD_PREFIX%\Library\bin\flang.exe
set F90=%BUILD_PREFIX%\Library\bin\flang.exe

"%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
:: for a list of environment variables that are set during the build process.
2 changes: 2 additions & 0 deletions conda-recipe-openblas/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd $RECIPE_DIR/..
$PYTHON setup.py install
35 changes: 35 additions & 0 deletions conda-recipe-openblas/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package:
name: slycot
version: "0.3.2"

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

build:
- {{ compiler('fortran') }} # [not win]
- {{ compiler('c') }} # [win]
- flang # [win]
# 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
- libgfortran # [not win]
- libflang # [win]

test:
imports:
- slycot

about:
home: https://github.com/python-control/slycot
license: GPLv2
summary: 'A wrapper for the SLICOT control and systems library'
7 changes: 5 additions & 2 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
cd %RECIPE_DIR%
cd ..

"%PYTHON%" setup.py build --compiler=mingw32
"%PYTHON%" setup.py install --skip-build
set F77=%BUILD_PREFIX%\Library\bin\flang.exe
set F90=%BUILD_PREFIX%\Library\bin\flang.exe
set LAPACKLIBS=lapack:blas

"%PYTHON%" setup.py install

if errorlevel 1 exit 1

Expand Down
3 changes: 2 additions & 1 deletion conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
cd $RECIPE_DIR/..
LDFLAGS="-shared" FFLAGS="-fPIC" $PYTHON setup.py install
export LAPACKLIBS=lapack:blas
$PYTHON setup.py install
24 changes: 16 additions & 8 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@ build:
number: 1

requirements:
build:
- python
host:
- numpy
- lapack
- m2w64-gcc-fortran # [win]
- gfortran_linux-64 # [linux]
- gfortran_osx-64 # [osx]

- libflang # [win]
- libgfortran # [not win]
- python {{PY_VER}}

build:
- {{ compiler('fortran') }} # [not win]
- {{ compiler('c') }} # [win]
- flang # [win]
# 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:
- python
- numpy
- lapack
- libgfortran
- libgfortran # [not win]
- libflang # [win]

test:
requires:
- python {{PY_VER}}
imports:
- slycot

Expand Down
36 changes: 23 additions & 13 deletions slycot/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ def configuration(parent_package='', top_path=None):
pyver = sysconfig.get_config_var('VERSION')

if sys.platform == 'win32':
liblist = [
'lapack', 'lapacke', 'blas', 'gfortran'
]
extra_objects = [
]
liblist = [ 'openblas', 'flang' ]
extra_objects = [ ]
ppath = os.sep.join(sys.executable.split(os.sep)[:-1])

library_dirs = [r'\Library\lib', ]
library_dirs = [ppath + l for l in library_dirs]
extra_link_args = [ ]
Expand All @@ -40,19 +38,31 @@ def configuration(parent_package='', top_path=None):
abiflags = sys.abiflags
except AttributeError:
abiflags = ''
liblist = ['lapack', 'blas', 'python'+pyver+abiflags]
extra_objects = []
library_dirs = []
extra_link_args = []
extra_compile_args = []
ppath = os.sep.join(sys.executable.split(os.sep)[:-2])
library_dirs = [r'/lib', ]
library_dirs = [ppath + l for l in library_dirs]
if sys.platform == 'darwin':
liblist = ['openblas' ]
extra_link_args = [ '-Wl,-dylib,-undefined,dynamic_lookup' ]
extra_compile_args = [ '-fPIC' ]
else:
liblist = ['openblas']
extra_link_args = [ '-shared', '-Wl,--allow-shlib-undefined' ]
extra_compile_args = [ '-fPIC' ]

# override when libraries have been specified
if os.environ.get("LAPACKLIBS", None):
liblist = os.environ.get("LAPACKLIBS").split(':')
print("Overriding library list with", liblist)

config.add_extension(
name='_wrapper',
libraries=liblist,
extra_objects=extra_objects,
extra_link_args=extra_link_args,
library_dirs=library_dirs,
extra_compile_args=extra_compile_args,
extra_objects=extra_objects,
extra_link_args=extra_link_args,
library_dirs=library_dirs,
extra_compile_args=extra_compile_args,
sources=fortran_sources + f2py_sources)

config.make_config_py() # installs __config__.py
Expand Down
23 changes: 17 additions & 6 deletions slycot/src/TD04AD.f
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ SUBROUTINE TD04AD( ROWCOL, M, P, INDEX, DCOEFF, LDDCOE, UCOEFF,
$ UCOEFF(LDUCO1,LDUCO2,*)
C .. Local Scalars ..
LOGICAL LROCOC, LROCOR
INTEGER I, J, JSTOP, K, KDCOEF, MPLIM, MWORK, N, PWORK
INTEGER I, J, JSTOP, K, KDCOEF, MPLIM, MWORK, N, PWORK,
$ KU
C .. External Functions ..
LOGICAL LSAME
EXTERNAL LSAME
Expand Down Expand Up @@ -401,18 +402,28 @@ SUBROUTINE TD04AD( ROWCOL, M, P, INDEX, DCOEFF, LDDCOE, UCOEFF,
C state-space representation, and reorder the rows and columns
C to get an upper block Hessenberg state dynamics matrix.
C
K = IWORK(1)+IWORK(2)-1
CALL TB01XD( 'D', NR, MWORK, PWORK, K, NR-1, A, LDA, B, LDB,
$ C, LDC, D, LDD, INFO )
C IWORK contains the orders of the diagnonal blocks
C RvP, In TB01PD, IWORK is zeroed from INDCON to N, beyond N it may
C contain nonsense?
K = -1
DO 55 I = 1, N
K = K + IWORK(I)
55 CONTINUE
C
C RvP 180615 Try to protect against re-working an empty [] A
C matrix, failed with K < 0
C
CALL TB01XD( 'D', NR, MWORK, PWORK, MAX(0, K), MAX(0,NR-1),
$ A, LDA, B, LDB, C, LDC, D, LDD, INFO )
IF ( MPLIM.NE.1 ) THEN
C
C Also, retranspose U(s) if this is non-scalar.
C
DO 70 K = 1, KDCOEF
C
C
DO 60 J = 1, JSTOP
CALL DSWAP( MPLIM-J, UCOEFF(J+1,J,K), 1,
$ UCOEFF(J,J+1,K), LDUCO1 )
$ UCOEFF(J,J+1,K), LDUCO1 )
60 CONTINUE
C
70 CONTINUE
Expand Down
6 changes: 3 additions & 3 deletions slycot/src/transform.pyf
Original file line number Diff line number Diff line change
Expand Up @@ -344,17 +344,17 @@ subroutine td04ad_c(rowcol,m,p,index_bn,dcoeff,lddcoe,ucoeff,lduco1,lduco2,nr,a,
integer check(m>=0) :: m
integer check(p>=0) :: p
integer dimension(m),depend(m) :: index_bn
double precision intent(in,copy),dimension(max(1,m),*),depend(p) :: dcoeff
double precision intent(in,copy),dimension(max(1,m),*),depend(m) :: dcoeff
integer intent(hide),depend(dcoeff) :: lddcoe=shape(dcoeff,0)
double precision intent(in,copy),dimension(max(1,max(m,p)),max(1,max(m,p)),*),depend(p,m) :: ucoeff
integer intent(hide),depend(ucoeff) :: lduco1=shape(ucoeff,0)
integer intent(hide),depend(ucoeff) :: lduco2=shape(ucoeff,1)
integer intent(in,out) :: nr != sum(index_bn)
double precision intent(out),dimension(max(1,nr),nr),depend(nr) :: a
double precision intent(out),dimension(max(1,nr),max(1,nr)),depend(nr) :: a
integer intent(hide),depend(a) :: lda = shape(a,0)
double precision intent(out),dimension(max(1,nr),max(m,p)),depend(nr,m,p) :: b
integer intent(hide),depend(b) :: ldb = shape(b,0)
double precision intent(out),dimension(max(1,max(m,p)),nr),depend(nr,m,p) :: c
double precision intent(out),dimension(max(1,max(m,p)),max(1,nr)),depend(nr,m,p) :: c
integer intent(hide),depend(c) :: ldc = shape(c,0)
double precision intent(out),dimension(max(1,max(m,p)),max(m,p)),depend(p,m) :: d
integer intent(hide),depend(d) :: ldd = shape(d,0)
Expand Down
Loading