Skip to content

Commit

Permalink
Merge remote-tracking branch 'greengroup/repackage'
Browse files Browse the repository at this point in the history
This moves files into new pydas package, and means that software
using this library will need to be modified slightly:

    -from pydas import DASSL
    +from pydas.dassl import DASSL

It also removes DASPK2 and adds DASPK3.1, which allows
sensitivity analysis.

See
jwallen/PyDAS#11
jwallen/PyDAS#12
  • Loading branch information
rwest committed Mar 12, 2015
2 parents 4da00e2 + 35ef8c2 commit de4a24c
Show file tree
Hide file tree
Showing 57 changed files with 226 additions and 33,733 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ make.inc
/.project
/.pydevproject
/.settings

# DASPK3.1 source files
daspk31/*
50 changes: 26 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,49 @@ CYTHON_FLAGS=--inplace

-include make.inc

.PHONY: DASSL DASPK DASPK31 DASKR cython clean
.PHONY: DASSL DASPK31 DASKR cython clean

all: DASSL DASPK DASKR cython
all: DASSL DASPK31 DASKR cython

daspk: DASPK31 cython-daspk
dassl: DASSL cython

cython-daspk:
python setup.py build_ext daspk $(CYTHON_FLAGS)
daspk: DASPK31 cython

cython: DASSL DASPK DASKR pydas.pyx
cython:
ifeq (,$$(wildcard daspk31/solver/ddaspk.o))
# DASPK3.1 was not compiled. Cythonize the wrapper for only DASSL.
python setup.py build_ext $(CYTHON_FLAGS)
else
# Cythonize both DASSL and DASPK3.1 wrappers
python setup.py build_ext daspk $(CYTHON_FLAGS)
endif


install: DASSL DASPK DASKR cython
install: DASSL DASPK31 DASKR cython
ifeq (,$$(wildcard pydas/daspk.so))
# the file "pydas/daspk.so" does not exist, so don't install daspk
python setup.py install
@echo "NOTE: Installed without DASPK, because it had not been compiled."
else
# the file "pydas/daspk.so" does exist, so install daspk
python setup.py daspk install
endif

DASSL:
$(MAKE) -C dassl F77=$(F77)

DASPK:
$(MAKE) -C daspk F77=$(F77)

DASPK31:
$(MAKE) -C daspk31 F77=$(F77)

DASKR:
$(MAKE) -C daskr F77=$(F77)

clean: clean-DASSL clean-DASPK clean-DASPK31 clean-DASKR clean-cython
clean: clean-DASSL clean-DASPK31 clean-DASKR clean-cython
rm -rf build

clean-DASSL:
$(MAKE) -C dassl clean

clean-DASPK:
$(MAKE) -C daspk clean

clean-DASPK31:
$(MAKE) -C daspk31 clean

Expand All @@ -54,20 +61,16 @@ clean-DASKR:

clean-cython:
python setup.py clean $(CLEAN_FLAGS)
rm -f *.so *.pyc *.c
rm -f pydas/*.so pydas/*.pyc pydas/*.c pydas/*.html

help:
@echo ""
@echo "This makefile can be used to build PyDAS and its dependencies."
@echo ""
@echo "Typing \`make\` with no arguments will compile all three DAE solvers (DASSL,"
@echo "DASPK, and DASKR) to static libraries and compile the PyDAS Python modules"
@echo "that provide the Python interface to these solvers."
@echo ""
@echo "Typing \`make daspk\` after typing \`make\` will then additionally compile
@echo "the optional DASPK 3.1 solver as well as the cython module pydaspk associated with it."
@echo "The DASPK 3.1 fortran source files must first be downloaded externally and placed"
@echo "in the daspk31 folder."
@echo "DASPK3.1, and DASKR) to static libraries and compile the PyDAS Python modules"
@echo "that provide the Python interface to these solvers. Note that one must agree"
@echo "to download the DASPK3.1 source code externally to compile the DASPK wrapper."
@echo ""
@echo "Typing \`make clean\` will delete all of the intermediate build files,"
@echo "compiled libraries, and compiled Python modules for all three DAE solvers and"
Expand All @@ -77,10 +80,9 @@ help:
@echo "<target> is one of:"
@echo ""
@echo " DASSL to compile the DASSL solver"
@echo " DASPK to compile the DASPK solver"
@echo " DASPK31 to compile the DASPK31 solver"
@echo " DASKR to compile the DASKR solver"
@echo " cython to compile the PyDAS Python wrapper module for DASSL"
@echo " cython-daspk to compile the PyDAS Python wrapper module for both DASSL and DASPK3.1"
@echo " and DASPK3.1 (if it was compiled)"
@echo ""

47 changes: 32 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ Introduction

PyDAS provides a means for Python code to utilize several notable Fortran-based
differential algebraic system solvers from Python code. The solvers made
available -- DASSL, DASPK, and DASKR -- are all publicly-available from
available -- DASSL and DASKR -- are all publicly-available from
`Netlib <http://www.netlib.org/ode/>`_, and are distributed with PyDAS. PyDAS
provides a Python extension type for each solver, which in turn provides a
Pythonic means of setting the solver options, providing residual and jacobian
functions, and running the solver.

In addition, PyDAS also provides a wrapper to the DASPK3.1 solver, which
has native sensitivity analysis. The source code for DASPK3.1 is subject to
copyright restrictions but is available for research purposes. Due to these
restrictions, it is up to the user to download these source files manually
(or agree to download them during the prompt given when compiling the wrappers).
Please see the README file inside the daspk31/ folder for more details.

The DASSL, DASPK, and DASKR solvers are all substantially more robust than
VODE, the solver used within the ODE solver functionality provided by
`SciPy <http://www.scipy.org/>`_.
Expand Down Expand Up @@ -71,41 +78,52 @@ Installation

.. note::

Currently only the DASSL solver has been wrapped. The installation
scripts therefore only build and install the DASSL wrapper by default.
Currently only the DASSL and DASPK3.1 solvers have been wrapped.
The installation scripts build and install the DASSL wrapper and the
DASPK wrapper (unless the DASPK3.1 fortran code was not compiled.)

Windows
-------

The provided batch scripts will compile all of the solvers and the PyDAS
wrapper code. These scripts presume that you have the 32-bit version of the
The provided make.bat batch script will compile the DASSL solver and the PyDAS
wrapper code. Use the make_daspk.bat script to compile the DASPK3.1 solver and the
DASPK wrapper code. Make sure you have manually downloaded the DASPK3.1 source
files into the daspk31 folder. See the daspk31/README file for more details.
These scripts presume that you have the 32-bit version of the
MinGW C and Fortran compilers installed. Once you have run the batch script,
you can install PyDAS into your Python packages if you desire by running the
following command from the base package directory:

> python setup.py install

Use the following command if you want to install both the DASSL and DASPK wrappers:

> python setup.py daspk install

Linux
-----

A Makefile has been provided that can be used to compile all of the solvers
and the PyDAS wrapper code. To use, invoke the following command from the
A Makefile has been provided that can be used to compile the DASSL solver and
DASSL wrapper code. To use, invoke the following command from the
base package directory::

$ make

This command will build PyDAS in-place, rather than installing it to your
Python package directory. If you wish to formall install PyDAS, run the
Python package directory.

If you wish to formally install PyDAS, run the
following command from the base package directory after the ``make`` command
(you may need root privileges for this)::

$ python setup.py install
$ make install

You may wish to write a file `make.inc` that sets certain variables used by
the Makefiles (e.g. the Fortran compiler). An example of such a file,
`make.inc.example`, has been provided.



Mac OS X
--------

Expand All @@ -115,15 +133,14 @@ Homebrew (http://brew.sh) is an easy way to get gfortran::

But your system may still not be able to find the correct `libgfortran.a` library file
(see https://github.com/mxcl/homebrew/issues/8539 ). Also, there are some problems
linking with `clang`, so you need to make it link with `gcc`. This one-liner should
linking with `clang`, so you need to make it link with `gcc`. This should
build and install, assuming you have NumPy, Cython, etc. all set up::

$ LIBRARY_PATH=/usr/local/lib/gcc LDSHARED='gcc -bundle -undefined dynamic_lookup -arch x86_64' make F77=gfortran install

Or perhaps, with a newer version of Homebrew / Python / gfortran / NumPy / Cython, it will be a simple::

$ LIBRARY_PATH=/usr/local/Cellar/gfortran/4.8.0/gfortran/lib make F77=gfortran
$ export LIBRARY_PATH=$(dirname $(gfortran -print-libgcc-file-name))
$ make
$ make install

Although at one stage it also required ``LDSHARED='gcc -bundle -undefined dynamic_lookup -arch x86_64'``.
It seems to keep on changing. If you have difficulty, check the
`issue tracker <https://github.com/jwallen/PyDAS/issues/>`_, and if you solve
your difficulty, please share your successful approach.
31 changes: 0 additions & 31 deletions daspk/Makefile

This file was deleted.

Loading

0 comments on commit de4a24c

Please sign in to comment.