diff --git a/appveyor.yml b/.appveyor.yml similarity index 67% rename from appveyor.yml rename to .appveyor.yml index df22ca4ad7..54cc55eb26 100644 --- a/appveyor.yml +++ b/.appveyor.yml @@ -3,30 +3,31 @@ environment: matrix: - - TARGET_ARCH: x86 - CONDA_PY: 27 - CONDA_INSTALL_LOCN: C:\\Miniconda - FIPY_SOLVERS: pysparse - - TARGET_ARCH: x64 CONDA_PY: 27 CONDA_INSTALL_LOCN: C:\\Miniconda-x64 FIPY_SOLVERS: pysparse - - TARGET_ARCH: x86 - CONDA_PY: 27 - CONDA_INSTALL_LOCN: C:\\Miniconda - FIPY_SOLVERS: scipy +# - TARGET_ARCH: x64 +# CONDA_PY: 27 +# CONDA_INSTALL_LOCN: C:\\Miniconda-x64 +# FIPY_SOLVERS: pysparse +# FIPY_INLINE: 1 + +# - TARGET_ARCH: x86 +# CONDA_PY: 27 +# CONDA_INSTALL_LOCN: C:\\Miniconda +# FIPY_SOLVERS: scipy - TARGET_ARCH: x64 CONDA_PY: 27 CONDA_INSTALL_LOCN: C:\\Miniconda-x64 FIPY_SOLVERS: scipy - - TARGET_ARCH: x86 - CONDA_PY: 36 - CONDA_INSTALL_LOCN: C:\\Miniconda36 - FIPY_SOLVERS: scipy +# - TARGET_ARCH: x86 +# CONDA_PY: 36 +# CONDA_INSTALL_LOCN: C:\\Miniconda36 +# FIPY_SOLVERS: scipy - TARGET_ARCH: x64 CONDA_PY: 36 @@ -60,23 +61,27 @@ install: - cmd: conda.exe config --set changeps1 no - cmd: conda.exe config --remove channels defaults - cmd: conda.exe config --add channels defaults - - cmd: conda.exe config --add channels guyer - cmd: conda.exe config --add channels conda-forge # Configure the VM. - - cmd: conda.exe install --quiet --name root fipy + - cmd: if "%TARGET_ARCH%" == "x64" conda.exe install --quiet --name root python fipy + - cmd: if "%TARGET_ARCH%" == "x64" conda.exe uninstall --quiet fipy + + - cmd: if "%TARGET_ARCH%" == "x86" conda.exe install --quiet --name root python numpy scipy matplotlib + - cmd: if "%TARGET_ARCH%" == "x86" if "%CONDA_PY%" == "27" conda.exe install --quiet --name root mayavi weave + - cmd: if "%TARGET_ARCH%" == "x86" if "%FIPY_SOLVERS%" == "pysparse" conda.exe install --quiet --name root pysparse - cmd: if "%CONDA_PY%" == "36" 2to3 --write . 1> NUL 2>&1 - cmd: if "%CONDA_PY%" == "36" 2to3 --write --doctests_only . 1> NUL 2>&1 - - cmd: python setup.py install - - cmd: pip install scikit-fmm # Skip .NET project specific build phase. build: off test_script: - - python setup.py test --%FIPY_SOLVERS% + - if !%FIPY_INLINE%==! python setup.py test 1> NUL 2>&1 + - python setup.py test + - conda env export # deploy_script: # - cmd: upload_or_check_non_existence .\recipe guyer --channel=main diff --git a/.circleci/config.yml b/.circleci/config.yml index 855ccbb8e3..b5ce3f35c6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,116 +2,281 @@ # # Check https://circleci.com/docs/2.0/language-python/ for more details # -version: 2 +version: 2.1 -jobs: - test-27-pysparse: - docker: - # specify the version you desire here - - image: continuumio/miniconda2 +defaults: &defaults + working_directory: ~/project - working_directory: ~/repo +defaults2: &defaults2 + <<: *defaults - steps: - - checkout + docker: + - image: continuumio/miniconda2 - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ arch }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- +defaults3: &defaults3 + <<: *defaults + + docker: + - image: continuumio/miniconda3 + +commands: + createenv: + description: "Create conda environment" + parameters: + env: + type: string + default: "cache" + + packages: + type: string + default: "" + + steps: - run: - name: install dependencies + name: Create Conda Environment command: | - apt-get --yes update - apt-get --yes install build-essential - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda config --remove channels defaults - conda create -v --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=2.7 numpy scipy gmsh pysparse mpi4py matplotlib mayavi fipytrilinos weave - source activate test-environment - conda info -a + conda create -v --quiet --prefix << parameters.env >> --show-channel-urls --channel conda-forge << parameters.packages >> + source activate ~/project/<< parameters.env >> + conda uninstall --quiet fipy pip install scikit-fmm - - save_cache: - paths: - - /.conda - key: v1-dependencies-{{ arch }} + test_fipy: + description: "Run FiPy Tests" + + parameters: + mpirun: + type: string + default: "" + + steps: + - restore_conda_cache + + - attach_workspace: + at: ~/project - run: - name: install fipy + name: Run Tests + no_output_timeout: 30m command: | - source activate test-environment - python setup.py install + source activate ~/project/test-environment + if [[ ! -z "${FIPY_INLINE}" ]]; then + << parameters.mpirun >> python setup.py test > /dev/null 2>&1 || true; + fi + << parameters.mpirun >> python setup.py test - run: - name: run tests + name: Output Environment command: | - source activate test-environment - python setup.py test --pysparse + conda env export --prefix ~/project/test-environment - store_artifacts: path: test-reports destination: test-reports - test-27-scipy: - docker: - # specify the version you desire here - - image: continuumio/miniconda2 + test_fipy2: + description: "Run FiPy Tests with python 2.x" - working_directory: ~/repo + parameters: + mpirun: + type: string + default: "" steps: + - run: + name: Install libGLU + command: | + apt-get --yes update + apt-get --yes install libglu1-mesa + - checkout - # Download and cache dependencies + - test_fipy: + mpirun: << parameters.mpirun >> + + test_fipy3: + description: "Run FiPy Tests with Py3k" + + parameters: + mpirun: + type: string + default: "" + + steps: + - run: + name: Install libGL + command: | + apt-get --yes update + apt-get --yes install libglu1-mesa + apt-get --yes install libgl1-mesa-glx + apt-get --yes install libxrender1 + + - checkout + + - run: + name: 2to3 + command: | + 2to3 --write . &> /dev/null; + 2to3 --write --doctests_only . &> /dev/null; + + - test_fipy: + mpirun: << parameters.mpirun >> + + # localize changes to cache name to these two commands + save_conda_cache: + steps: + - save_cache: + paths: + - /opt/conda + - /root/.cache/pip + key: v7-dependencies-{{ arch }} + + restore_conda_cache: + description: "Restore cache holding conda and pip" + + steps: - restore_cache: keys: - - v1-dependencies-{{ arch }} + - v7-dependencies-{{ arch }} # fallback to using the latest cache if no exact match is found - - v1-dependencies- + - v7-dependencies- + install_dependencies: + steps: - run: - name: install dependencies + name: Install Dependencies command: | apt-get --yes update apt-get --yes install build-essential conda config --set always_yes yes --set changeps1 no conda update -q conda conda config --remove channels defaults - conda create -v --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=2.7 numpy scipy gmsh pysparse mpi4py matplotlib mayavi fipytrilinos weave - source activate test-environment - conda info -a - pip install scikit-fmm - - - save_cache: - paths: - - /.conda - key: v1-dependencies-{{ arch }} + remove_extracted_conda_packages: + description: "force conda to download packages into the cache and then + clean out extracted packages + after https://gist.github.com/mcg1969/cbb1760cea6b0671959d8cbf957c89bf" + steps: - run: - name: install fipy + name: Remove Extracted Conda Packages command: | - source activate test-environment - python setup.py install + conda clean --packages - - run: - name: run tests - command: | - source activate test-environment - python setup.py test --scipy + install_conda_packages: + description: "Restore conda environment and install packages" - - store_artifacts: - path: test-reports - destination: test-reports + parameters: + packages: + type: string + default: "" + + steps: + # Download and cache dependencies + - restore_conda_cache + + - install_dependencies + + - createenv: + env: "test-environment" + packages: << parameters.packages >> + + - remove_extracted_conda_packages + + - save_conda_cache + + - persist_to_workspace: + root: ~/project + paths: + - test-environment + +jobs: + conda2_env: + <<: *defaults2 + + steps: + - install_conda_packages: + packages: "python=2.7 fipy" + + conda3_env: + <<: *defaults3 + + steps: + - install_conda_packages: + packages: "python=3.6 fipy" + + test-27-pysparse: + <<: *defaults2 + + steps: + - test_fipy2 + environment: + FIPY_SOLVERS: pysparse + + test-27-inline: + <<: *defaults2 + + steps: + - test_fipy2 + environment: + FIPY_SOLVERS: pysparse + FIPY_INLINE: 1 + + test-27-scipy: + <<: *defaults2 + + steps: + - test_fipy2 + environment: + FIPY_SOLVERS: scipy + + test-27-trilinos: + <<: *defaults2 + + steps: + - test_fipy2 + environment: + FIPY_SOLVERS: trilinos + + test-27-parallel: + <<: *defaults2 + + steps: + - test_fipy2: + mpirun: "mpirun -np 2" + environment: + FIPY_SOLVERS: trilinos + OMP_NUM_THREADS: 1 + + test-36-scipy: + <<: *defaults3 + + steps: + - test_fipy3 + environment: + FIPY_SOLVERS: scipy workflows: version: 2 test: jobs: - - test-27-pysparse - - test-27-scipy - \ No newline at end of file + - conda2_env + - conda3_env + - test-27-pysparse: + requires: + - conda2_env +# - test-27-inline: +# requires: +# - conda2_env + - test-27-scipy: + requires: + - conda2_env + - test-27-trilinos: + requires: + - conda2_env + - test-27-parallel: + requires: + - conda2_env + - test-36-scipy: + requires: + - conda3_env diff --git a/.travis.yml b/.travis.yml index efd4f89376..453dcb6d83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,47 +3,37 @@ # language: python causes grief on osx language: generic os: - # - osx - - linux + - osx + # - linux env: - TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=pysparse - # - TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=pysparse FIPY_INLINE=1 +# - TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=pysparse FIPY_INLINE=1 - TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=scipy - TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=trilinos - TRAVIS_PYTHON_VERSION=2.7 MPIRUN="mpirun -np 2" FIPY_SOLVERS=trilinos - TRAVIS_PYTHON_VERSION=3.6 MPIRUN= FIPY_SOLVERS=scipy cache: apt -addons: - apt: - packages: - # - liblapack3 - # - liblapack.so.3 - # - libatlas-dev - # - libatlas-base-dev - # - liblapack-dev - # - liblapack3gf - # - gfortran branches: except: - nist-pages before_install: # sudo ln -s /usr/lib/lapack/liblapack.so.3gf /usr/lib/lapack/liblapack.so.3; # sudo ldconfig; - - if [[ $TRAVIS_OS_NAME -eq "linux" ]]; then + - if [[ $TRAVIS_OS_NAME = "linux" ]]; then sudo apt-get update; fi # We do this conditionally because it saves us some downloading if the # version is the same. - PY3K=$(echo "$TRAVIS_PYTHON_VERSION >= 3.0" | bc) - - if [[ $TRAVIS_OS_NAME -eq "linux" ]]; then + - if [[ $TRAVIS_OS_NAME = "linux" ]]; then export MINICONDA_OS_NAME=Linux; - elif [[ $TRAVIS_OS_NAME -eq "osx" ]]; then + elif [[ $TRAVIS_OS_NAME = "osx" ]]; then export MINICONDA_OS_NAME=MacOSX; fi - if [[ $PY3K -eq 1 ]]; then export MINICONDA_VERSION=3; else - export MINICONDA_VERSION=; + export MINICONDA_VERSION=2; fi - wget https://repo.continuum.io/miniconda/Miniconda${MINICONDA_VERSION}-latest-${MINICONDA_OS_NAME}-x86_64.sh -O miniconda.sh; - bash miniconda.sh -b -p $HOME/miniconda @@ -51,18 +41,9 @@ before_install: - hash -r - conda config --set always_yes yes --set changeps1 no - conda update -q conda - # fipy conda package does not properly load scipy and numpy from - # conda-forge channel when on linux - - if [[ $TRAVIS_OS_NAME -eq "linux" ]]; then - if [[ $PY3K -eq 1 ]]; then - conda create --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=$TRAVIS_PYTHON_VERSION numpy scipy gmsh matplotlib; - else - conda create --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=$TRAVIS_PYTHON_VERSION numpy scipy gmsh pysparse mpi4py matplotlib mayavi pytrilinos weave; - fi - elif [[ $TRAVIS_OS_NAME -eq "osx" ]]; then - conda create --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=$TRAVIS_PYTHON_VERSION fipy; - fi + - conda create --quiet --name test-environment --show-channel-urls --channel conda-forge python=$TRAVIS_PYTHON_VERSION fipy; - source activate test-environment + - conda uninstall --quiet fipy # Useful for debugging any issues with conda - conda info -a - pip install scikit-fmm @@ -76,15 +57,17 @@ before_script: # lack of display causes tests to abort at VtkViewer # Workaround @ http://docs.enthought.com/mayavi/mayavi/tips.html#rendering-using-the-virtual-framebuffer # and https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI - - if [[ $TRAVIS_OS_NAME -eq "linux" ]]; then + - if [[ $TRAVIS_OS_NAME = "linux" ]]; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; sleep 3; fi + # inline must be run twice to clear out compiler warnings + # we don't care if it fails the first time + - if [[ ! -z "${FIPY_INLINE}" ]]; then + travis_wait 40 $MPIRUN python setup.py test || true; + fi script: - # inline must be run twice to clear out compiler warnings - # we don't care if it fails the first time - - if [[ ! -z "${FIPY_INLINE}" ]]; then - $MPIRUN python setup.py test > /dev/null 2>&1 || true; - fi - - $MPIRUN python setup.py test; + - $MPIRUN python setup.py test; +after_success: + - conda env export diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ed6d55026e..1a1743a574 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1094,8 +1094,7 @@ The significant changes since version 1.0 are: - Installation on Windows has been made considerably easier by constructing executable installers for :term:`FiPy` and its - dependencies. Instructions for Windows installation can be found in - :ref:`WINDOWS-INSTALLATION`. + dependencies. - The arithmetic for ``Variable`` subclasses now works, and returns sensible answers. For example, ``VectorCellVariable * CellVariable`` diff --git a/INSTALLATION.rst b/INSTALLATION.rst index 1db9ee6a4b..42d5e07b2f 100644 --- a/INSTALLATION.rst +++ b/INSTALLATION.rst @@ -55,7 +55,7 @@ Recommended Method * `install Miniconda`_ on your computer * run:: - $ conda create --name --channel guyer --channel conda-forge fipy nomkl + $ conda create --name --channel conda-forge python= fipy .. note:: @@ -66,14 +66,19 @@ Recommended Method .. attention:: - Note, this does not work on Windows. On that platform, you should be able to do:: + Note, this does not work on Windows x86, as conda-forge_ no longer + supports that platform. For Python 2.7.x, you should be able to do:: - conda create --name --channel guyer --channel conda-forge python numpy scipy matplotlib mayavi - activate - pip install fipy + conda create --name --channel conda-forge python=2.7 numpy scipy matplotlib pysparse mayavi weave - There are presently no conda packages of any solver suite but scipy available for Windows. + and for Python 3.x, you should be able to do:: + conda create --name --channel conda-forge python=3.6 numpy scipy matplotlib pysparse + + followed, for either, by:: + + activate + pip install fipy * enable this new environment with:: @@ -102,6 +107,10 @@ Recommended Method .. _install Miniconda: http://conda.pydata.org/docs/install/quick.html .. _guyer: https://anaconda.org/guyer .. _conda-forge: https://conda-forge.github.io/ +.. _Mac OS X: http://www.apple.com/macosx/ +.. _Linux: http://www.linux.org/ +.. _Windows: http://www.microsoft.com/windows/ + -------------------------- Installing Python Packages @@ -171,8 +180,8 @@ with Git_. Installing FiPy --------------- -Details of the `Required Packages`_ and links are given below and in -`platform-specific instructions`_, but for the courageous and the +Details of the `Required Packages`_ and links are given below, +but for the courageous and the impatient, :term:`FiPy` can be up and running quickly by simply installing the following prerequisite packages on your system: @@ -234,7 +243,7 @@ on many operating systems, which you can check by opening a terminal and typing ``python``, *e.g.*:: $ python - Python 2.3 (#1, Sep 13 2003, 00:49:11) + Python 2.7.15 | ... ... Type "help", "copyright", "credits" or "license" for more information. >>> @@ -244,7 +253,7 @@ If necessary, you can download_ and install it for your platform .. note:: - :term:`FiPy` requires at least version 2.4.x of :term:`Python`. See + :term:`FiPy` requires at least version 2.7.x of :term:`Python`. See the specialized instructions if you plan on :ref:`RunningUnderPython3`. .. _download: http://www.python.org/download/ @@ -252,22 +261,13 @@ If necessary, you can download_ and install it for your platform :term:`Python` along with many of :term:`FiPy`'s required and optional packages is available with one of the following distributions. -conda ------ - -http://conda.pydata.org - -This package manager provides a wide array of both :term:`Python`-based and -general scientific packages. In addition to the default packages, many -other developers (including us) provide "channels" to distribute their own -builds of a variety of software. - -In a given conda_ environment, you can install :term:`FiPy` with:: - - $ conda install --channel guyer --channel conda-forge fipy +NumPy +===== +http://numpy.scipy.org -.. _EPD: +Obtain and install the :term:`NumPy` package. :term:`FiPy` requires at +least version 1.0 of NumPy_. Scientific Python Packages ========================== @@ -286,6 +286,25 @@ Linux_, `Mac OS X`_, and Windows_. :term:`Python` distributions include cryptographic software packages, and may be subject to export control laws. +Continuum Analytics Anaconda +---------------------------- + +http://continuum.io/anaconda + +In addition to the scientific :term:`Python` stack, the Anaconda package manager +also provides virtual environment management. Keeping separate installations is useful +*e.g.* for comparing :term:`Python` 2 and :term:`Python` 3 software stacks, or +when the user does not have sufficient privileges to install software system-wide. + +In addition to the default packages, many +other developers (including us) provide "channels" to distribute their own +builds of a variety of software. These days, the most useful channel is +`conda-forge`, which provides everything necessary to install :term:`FiPy`. + +In a given conda_ environment, you can install :term:`FiPy` with:: + + $ conda install --channel conda-forge fipy + .. _PYPI: Pip Installs Python @@ -303,25 +322,10 @@ using :term:`pip` run a somewhat elevated risk of unmet dependencies as the independent codes evolve. Stable releases of :term:`FiPy` are packaged for distribution through :term:`PyPI`. -.. _ANACONDA: - -Continuum Analytics Anaconda ----------------------------- - -http://continuum.io/anaconda - -In addition to the scientific :term:`Python` stack, the Anaconda package manager -also provides virtual environment management. Keeping separate installations is useful -*e.g.* for comparing :term:`Python` 2 and :term:`Python` 3 software stacks, or -when the user does not have sufficient privileges to install software system-wide. - -.. attention:: - - :term:`Pysparse` and :term:`FiPy` are not presently included in Anaconda, - so you will need to separately install them manually. - .. _ECP: +.. _EPD: + Enthought Canopy ---------------- @@ -351,14 +355,6 @@ for Windows_. :term:`Pysparse` and :term:`FiPy` are not presently included in Python(x,y), so you will need to separately install them manually. -NumPy -===== - -http://numpy.scipy.org - -Obtain and install the :term:`NumPy` package. :term:`FiPy` requires at -least version 1.0 of NumPy_. - .. _OPTIONALPACKAGES: ----------------- @@ -431,128 +427,6 @@ https://github.com/ktchu/LSMLIB/tree/master/pylsmlib#pylsmlib. .. _PyLSMLIB: https://github.com/ktchu/LSMLIB/tree/master/pylsmlib#pylsmlib .. _LSMLIB: http://ktchu.serendipityresearch.org/software/lsmlib/index.html ------------------------------- -Platform-Specific Instructions ------------------------------- - -:term:`FiPy` is `tested regularly`_ on `Mac OS X`_, `Debian Linux`_, -`Ubuntu Linux`_, and `Windows XP`_. We welcome reports of compatibility -with other systems, particularly if any additional steps are necessary to -install (see `Miscellaneous Build Recipes`_ for user contributed -installation tips). - -The only elements of :term:`FiPy` that are likely to be -platform-dependent are the :ref:`VIEWERS` but at least one viewer -should work on each platform. All other aspects should function on -any platform that has a recent :term:`Python` installation. - -Mac OS X Installation -===================== - -There is no official package manager for `Mac OS X`_, but there are -several third-party package managers that provide many, but not all of -:term:`FiPy`'s :ref:`REQUIREDPACKAGES` and :ref:`OPTIONALPACKAGES`. -Options include - - Fink_ - is based on the Debian package management system. It installs all of its - dependencies into :file:`/sw`. - MacPorts_ - is a package manager originally part of OpenDarwin. It installs all of - its dependencies into :file:`/opt`. - Homebrew_ - is a recent, lightweight package manager based on Ruby scripts. It - installs all of its dependencies into :file:`/usr/local` (although it - can be directed not to). - -In addition, there is an :ref:`ECP` installer for `Mac OS X`_. - -.. attention:: - - :term:`Pysparse` and :term:`FiPy` are not presently included in any of - these package managers or installers, so you will need to separately - install them manually. - -We presently find that the combination of Homebrew_ and :term:`pip` is a -pretty straightforward way to get most of :term:`FiPy`'s prerequisites. - -See the `Miscellaneous Build Recipes`_ for up-to-date directions. - -.. _Fink: http://www.finkproject.org/ -.. _MacPorts: http://www.macports.org/ -.. _Homebrew: http://mxcl.github.com/homebrew/ - -.. _WINDOWS-INSTALLATION: - -Windows Installation -==================== - -There is no official package manager for Windows_, but the :ref:`ECP` -and :ref:`PYTHONXY` installers provide most of :term:`FiPy`'s -prerequisites. - -.. attention:: - - :term:`Pysparse` and :term:`FiPy` are not presently included in Canopy or - Python(x,y), so you will need to separately install them manually. - -Ubuntu/Debian Installation -========================== - -:term:`FiPy` now has a `.deb` for Ubuntu/Debian systems that can be -downloaded from . Simply run:: - - $ VERSION=x.y-z # choose the version you want - $ apt-get install gmsh libsuperlu3 python-central python-sparse - $ curl -O http://www.ctcms.nist.gov/fipy/download/python-fipy_${VERSION}_all.deb - $ dpkg -i python-fipy_${VERSION}_all.deb - -to install. The `.deb` includes dependencies for all of the -:ref:`REQUIREDPACKAGES` and :ref:`OPTIONALPACKAGES`. - -.. _tested regularly: http://matforge.org/fipy/build -.. _Mac OS X: http://www.apple.com/macosx/ -.. _Linux: http://www.linux.org/ -.. _Debian Linux: http://www.debian.org/ -.. _RedHat Linux: http://www.redhat.com/ -.. _OpenSUSE Linux: http://www.opensuse.org/ -.. _Ubuntu Linux: http://www.ubuntu.com/ -.. _Solaris: http://oracle.com/solaris -.. _Windows: http://www.microsoft.com/windows/ -.. _Windows XP: http://www.microsoft.com/windowsxp/ - - -.. Nix Installation - ================ - -.. include:: nix/README.rst - -.. toctree:: - :hidden: - - ../nix/README - -Miscellaneous Build Recipes -=========================== - -We often post miscellaneous installation instructions on the -:term:`FiPy` blog_ and wiki_ pages. The most useful of these include: - - * `Installing FiPy on Mac OS X using Homebrew`_ - * `Building a 64-bit scientific python environment for FiPy from source`_ - * `Installing FiPy with pip`_ - -.. note:: - - We encourage you to contribute your own build recipes on the wiki_ - if they are significantly different. - -.. _Installing FiPy on Mac OS X using Homebrew: http://matforge.org/fipy/wiki/InstallFiPy/MacOSX/HomeBrew -.. _Building a 64-bit scientific python environment for FiPy from source: http://matforge.org/fipy/wiki/InstallFiPy/MacOSX/SnowLeopard -.. _Installing FiPy with pip: http://matforge.org/fipy/wiki/InstallFiPy/PipInstallsPython -.. _wiki: http://matforge.org/fipy -.. _blog: http://matforge.org/fipy/blog - .. _ENVIRONMENT: ----------------------- @@ -571,45 +445,26 @@ directories. The reasons for this include: * or not having admin privileges. -The simplest way to use a :term:`Python` package without installing it -is to work in the base directory of the unpacked package and set -the :envvar:`PYTHONPATH` environment variable to "``.``". In order to work in an -directory other than the package's base directory, the :envvar:`PYTHONPATH` -environment variable must be set to ":file:`~/path/to/package`". This -method of working is adequate for one package, but quickly becomes -unmanageable with multiple :term:`Python` packages. In order to manage -multiple packages, it is better to choose a standard location other -than the default installation path. - -If you do not have administrative privileges on your computer, or if -for any reason you don't want to tamper with your existing -:term:`Python` installation, most packages (including :term:`FiPy`) -will allow you to install to an alternative location. Instead of -installing these packages with ``python setup.py install``, you would -use :samp:`python setup.py install --home={dir}`, where :samp:`{dir}` -is the desired installation directory (usually "``~``" to indicate -your home directory). You will then need to append -:file:`{dir}/lib/python` to your :envvar:`PYTHONPATH` environment -variable. See the `Alternate Installation`_ section of the -:term:`Python` document "`Installing Python Modules`_" -:cite:`InstallingPythonModules` for more information, such as circumstances -in which you should use :option:`--prefix` instead of -:option:`--home`. - -.. _Alternate Installation: http://docs.python.org/inst/alt-install-windows.html - -.. _Installing Python Modules: http://docs.python.org/inst/ - -An alternative to setting the :envvar:`PYTHONPATH` is to employ one of the -utilities that manage packages and their dependencies independently of -the system package manager and the system directories. These utilities -include Conda_, Stow_, Virtualenv_ and zc.buildout_, amongst others. Here we'll -describe the use of Conda_, which we highly recommend. +To avoid tampering with the system Python_ installation, you can employ one +of the utilities that manage packages and their dependencies independently +of the system package manager and the system directories. These utilities +include conda_, Stow_, Virtualenv_ and zc.buildout_, amongst others. +Conda_ is the only one of these we have the resources to support. + +Our preferred development environment is set up with:: + $ conda create --name --channel conda-forge python= fipy + $ source activate + $ pip install scikit-fmm + $ conda remove --channel conda-forge fipy + $ git clone https://github.com/usnistgov/fipy.git + $ cd fipy + $ python setup.py develop + +.. _Conda: https://conda.io .. _Stow: http://savannah.gnu.org/projects/stow/ .. _zc.buildout: http://pypi.python.org/pypi/zc.buildout .. _Virtualenv: https://virtualenv.pypa.io -.. _Conda: https://conda.io .. _documentation:GIT: diff --git a/README.rst b/README.rst index 13071ee561..556093d985 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,7 @@ Overview .. only:: html - | |TravisCI|_ |AppVeyor|_ + | |CircleCI|_ |TravisCI|_ |AppVeyor|_ | |GitHub|_ |PyPi|_ |Codacy|_ |CondaForge|_ |Binder|_ | |gitter|_ |Depsy|_ |OpenHub|_ @@ -160,7 +160,9 @@ or a .. _GitHub: https://github.com/usnistgov/fipy .. |gitter| image:: https://badges.gitter.im/usnistgov/fipy.svg .. _gitter: https://gitter.im/usnistgov/fipy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge -.. |TravisCI| image:: https://img.shields.io/travis/usnistgov/fipy/develop.svg?label=Linux +.. |CircleCI| image:: https://img.shields.io/circleci/project/github/usnistgov/fipy/develop.svg?label=Linux +.. _CircleCI: https://circleci.com/gh/usnistgov/fipy +.. |TravisCI| image:: https://img.shields.io/travis/usnistgov/fipy/develop.svg?label=macOS .. _TravisCI: https://travis-ci.org/usnistgov/fipy .. |AppVeyor| image:: https://ci.appveyor.com/api/projects/status/github/usnistgov/fipy?branch=develop&svg=true&failingText=Windows%20-%20failing&passingText=Windows%20-%20passing&pendingText=Windows%20-%20pending .. _AppVeyor: https://ci.appveyor.com/project/guyer/fipy diff --git a/documentation/ADMINISTRATA.rst b/documentation/ADMINISTRATA.rst index 747fd7f9d4..b9754f42ee 100644 --- a/documentation/ADMINISTRATA.rst +++ b/documentation/ADMINISTRATA.rst @@ -48,8 +48,8 @@ Submit branch for code review $ git push origin $BRANCH - Check the Buildbot_ status. Fix (or, if absolutely necessary, document) - any failures. + Check the `Continuous Integration`_ status. Fix (or, if absolutely + necessary, document) any failures. Paste the result of:: @@ -130,6 +130,50 @@ If appropriate, after successful code review and merger to the When complete, the ``version-n_m`` branch is not merged to ``master``. + +.. _CONTINUOUSINTEGRATION: + +====================== +Continuous Integration +====================== + +We use three different cloud services for continuous integration (CI). Each +service offers unique capabilities, but this also serves to distribute the +load. + +.. only:: html + + | |CircleCI|_ |TravisCI|_ |AppVeyor|_ + +----- +Linux +----- + +Linux builds are performed on CircleCI_. This CI is configured in +:file:`{FiPySource}/.circleci/config.yml`. + +-------- +Mac OS X +-------- + +Mac OS X builds are performed on TravisCI_. This CI is configured in +:file:`{FiPySource}/.travis.yml`. + +------- +Windows +------- + +Windows builds are performed on AppVeyor_. This CI is configured in +:file:`{FiPySource}/.appveyor.yml`. + +.. |CircleCI| image:: https://img.shields.io/circleci/project/github/usnistgov/fipy/develop.svg?label=Linux +.. _CircleCI: https://circleci.com/gh/usnistgov/fipy +.. |TravisCI| image:: https://img.shields.io/travis/usnistgov/fipy/develop.svg?label=macOS +.. _TravisCI: https://travis-ci.org/usnistgov/fipy +.. |AppVeyor| image:: https://ci.appveyor.com/api/projects/status/github/usnistgov/fipy?branch=develop&svg=true&failingText=Windows%20-%20failing&passingText=Windows%20-%20passing&pendingText=Windows%20-%20pending +.. _AppVeyor: https://ci.appveyor.com/project/guyer/fipy + + ================ Making a Release ================ @@ -177,8 +221,9 @@ Check items in the issues_ and update the :ref:`CHANGELOG`:: .. attention:: - If Buildbot_ doesn't show all green boxes for this release, make sure to - add appropriate notes in :file:`README.txt` or :file:`INSTALLATION.txt`! + If `Continuous Integration`_ doesn't show all green boxes for this + release, make sure to add appropriate notes in :file:`README.txt` or + :file:`INSTALLATION.txt`! .. _PyGithub: https://pygithub.readthedocs.io .. _Pandas: https://pandas.pydata.org @@ -292,7 +337,6 @@ executable and upload to download page. .. _GitHub issue: https://github.com/usnistgov/fipy/issues/new .. _issues: https://github.com/usnistgov/fipy/issues .. _pull requests: https://github.com/usnistgov/fipy/pulls -.. _Buildbot: http://build.cmi.kent.edu:8010/tgrid .. _fipy@nist.gov: mailto:fipy@nist.gov .. _PyVTK: http://cens.ioc.ee/projects/pyvtk/ .. _stdeb: http://github.com/astraw/stdeb diff --git a/documentation/GIT.rst b/documentation/GIT.rst index 4893abd557..87057ab3bf 100644 --- a/documentation/GIT.rst +++ b/documentation/GIT.rst @@ -73,14 +73,10 @@ Any other branches will not generally be of interest to most users. For some time now, we have done all significant development work on branches, only merged back to ``develop`` when the tests pass - successfully. Although we cannot guarantee that ``develop`` will never be - broken, you can always check our build status page - - http://build.cmi.kent.edu:8010 - + successfully. Although we cannot guarantee that ``develop`` will never + be broken, you can always check our :ref:`CONTINUOUSINTEGRATION` status to find the most recent revision that it is running acceptably. - For those who are interested in learning more about Git, a wide variety of online sources are available, starting with the `official Git website`_. The `Pro Git book`_ :cite:`ProGit` is particularly instructive. diff --git a/documentation/VIEWERS.rst b/documentation/VIEWERS.rst index 9292c164ea..10d69b6c62 100644 --- a/documentation/VIEWERS.rst +++ b/documentation/VIEWERS.rst @@ -39,13 +39,6 @@ visualizer. It displays 1D, 2D and 3D data. It is the only probably a better choice for 1D or 2D viewing. :term:`Mayavi` requires VTK_, which can be difficult to build from source. -:term:`Mayavi` and VTK_ can be most easily obtained through - - * the Ubuntu or Debian package managers - * the :ref:`Enthought Python Edition ` - * :ref:`python(x,y) ` - * the Homebrew_ package manager for `Mac OS X`_ (VTK_ only, not - :term:`Mayavi`) .. note:: @@ -53,4 +46,3 @@ probably a better choice for 1D or 2D viewing. .. _VTK: http://www.vtk.org/ .. _Mac OS X: http://www.apple.com/macosx -.. _Homebrew: http://mxcl.github.com/homebrew/ diff --git a/documentation/_templates/index.html b/documentation/_templates/index.html index dacf1c6b12..68b3a245a5 100644 --- a/documentation/_templates/index.html +++ b/documentation/_templates/index.html @@ -48,7 +48,8 @@

FiPy: A Finite Volume PDE Solver Using Python

href="documentation/references.html#nist-damascene-2001">[NIST:damascene:2001].

- TravisCI + CircleCI + TravisCI AppVeyor
GitHub diff --git a/documentation/introduction.rst b/documentation/introduction.rst index cc78713734..7fb7d82cc8 100644 --- a/documentation/introduction.rst +++ b/documentation/introduction.rst @@ -14,3 +14,4 @@ Introduction design FAQ glossary + ADMINISTRATA diff --git a/examples/diffusion/steadyState/otherMeshes/grid3Dinput.py b/examples/diffusion/steadyState/otherMeshes/grid3Dinput.py index fb97d201eb..d783861e70 100755 --- a/examples/diffusion/steadyState/otherMeshes/grid3Dinput.py +++ b/examples/diffusion/steadyState/otherMeshes/grid3Dinput.py @@ -17,7 +17,7 @@ from fipy import CellVariable, Grid2D, Grid3D, DiffusionTerm, Viewer from fipy.tools import numerix -nx = 10 +nx = 8 # FIXME: downsized temporarily from 10 due to https://github.com/usnistgov/fipy/issues/622 ny = 5 nz = 3 @@ -41,7 +41,7 @@ #do the 2D problem for comparison -nx = 10 +nx = 8 # FIXME: downsized temporarily from 10 due to https://github.com/usnistgov/fipy/issues/622 ny = 5 dx = 1. diff --git a/fipy/meshes/gmshMesh.py b/fipy/meshes/gmshMesh.py index 1d31fee323..fc10134f10 100755 --- a/fipy/meshes/gmshMesh.py +++ b/fipy/meshes/gmshMesh.py @@ -1479,7 +1479,7 @@ class Gmsh2D(Mesh2D): ... square = Gmsh2D(geo, background=bkg) # doctest: +GMSH ... x, y = square.cellCenters # doctest: +GMSH ... bkg = CellVariable(mesh=square, value=abs(x / 4) + 0.01) # doctest: +GMSH - ... std.append(numerix.std(numerix.sqrt(2 * square.cellVolumes) / bkg)) # doctest: +GMSH + ... std.append((numerix.sqrt(2 * square.cellVolumes) / bkg).std()) # doctest: +GMSH Check that the mesh is monotonically approaching the desired density @@ -1498,12 +1498,12 @@ class Gmsh2D(Mesh2D): >>> trisquare = Tri2D(nx=1, ny=1) >>> x, y = trisquare.cellCenters >>> bkg = CellVariable(mesh=trisquare, value=abs(x / 4) + 0.01) - >>> std1 = numerix.std(numerix.sqrt(2 * trisquare.cellVolumes) / bkg) + >>> std1 = (numerix.sqrt(2 * trisquare.cellVolumes) / bkg).std() >>> square = Gmsh2D(geo, background=bkg) # doctest: +GMSH >>> x, y = square.cellCenters # doctest: +GMSH >>> bkg = CellVariable(mesh=square, value=abs(x / 4) + 0.01) # doctest: +GMSH - >>> std2 = numerix.std(numerix.sqrt(2 * square.cellVolumes) / bkg) # doctest: +GMSH + >>> std2 = (numerix.sqrt(2 * square.cellVolumes) / bkg).std() # doctest: +GMSH >>> print std1 > std2 # doctest: +GMSH True diff --git a/fipy/tools/dimensions/physicalField.py b/fipy/tools/dimensions/physicalField.py index dffd7fb1aa..9997e559cf 100755 --- a/fipy/tools/dimensions/physicalField.py +++ b/fipy/tools/dimensions/physicalField.py @@ -520,14 +520,14 @@ def itemset(self, value): >>> print a.allclose("1.8288 m") 1 >>> a = PhysicalField(((3.,4.),(5.,6.)),"m") - >>> try: + >>> try: #doctest: +IGNORE_EXCEPTION_DETAIL ... a.itemset(PhysicalField("6 ft")) ... except IndexError: ... # NumPy 1.7 has changed the exception type ... raise ValueError("can only place a scalar for an array of size 1") Traceback (most recent call last): ... - ValueError: can only place a scalar for an array of size 1 + ValueError: can only convert an array of size 1 to a Python scalar >>> a.itemset(PhysicalField("2 min")) Traceback (most recent call last): ... diff --git a/fipy/variables/meshVariable.py b/fipy/variables/meshVariable.py index 48275a4d88..30dd2cf556 100644 --- a/fipy/variables/meshVariable.py +++ b/fipy/variables/meshVariable.py @@ -455,6 +455,30 @@ def allequalParallel(a, b): else: return Variable.allequal(self, other) + def std(self, axis=None, **kwargs): + """Evaluate standard deviation of all the elements of a `MeshVariable`. + + Adapted from http://mpitutorial.com/tutorials/mpi-reduce-and-allreduce/ + + >>> import fipy as fp + >>> mesh = fp.Grid2D(nx=2, ny=2, dx=2., dy=5.) + >>> var = fp.CellVariable(value=(1., 2., 3., 4.), mesh=mesh) + >>> print (var.std()**2).allclose(1.25) + True + """ + if self.mesh.communicator.Nproc > 1 and (axis is None or axis == len(self.shape) - 1): + def stdParallel(a): + N = self.mesh.globalNumberOfCells + mean = self.sum(axis=axis).value / N + sq_diff = (self - mean)**2 + + return numerix.sqrt(sq_diff.sum(axis=axis).value / N) + + return self._axisOperator(opname="stdVar", + op=stdParallel, + axis=axis) + else: + return Variable.std(self, axis=axis) def _shapeClassAndOther(self, opShape, operatorClass, other): """ diff --git a/fipy/variables/variable.py b/fipy/variables/variable.py index 83361d5229..80dd978b13 100644 --- a/fipy/variables/variable.py +++ b/fipy/variables/variable.py @@ -1392,6 +1392,11 @@ def min(self, axis=None): op=lambda a: a.min(axis=axis), axis=axis) + def std(self, axis=None, **kwargs): + return self._axisOperator(opname="stdVar", + op=lambda a: numerix.std(a, **kwargs), + axis=axis) + def _getitemClass(self, index): return self._OperatorVariableClass()