Skip to content

Commit

Permalink
Merge branch 'master' into lijunzh-open_memmap_docs
Browse files Browse the repository at this point in the history
* master: (25 commits)
  BUG: fix unravel_index when dimension is greater than 'intp'
  MANT: refactor unravel_index for code repetition (numpy#13446)
  BLD, TST: implicit func errors
  DOC: document existance of linalg backends
  BLD: streamlined library names in site.cfg sections (numpy#13157)
  MAINT: fixed typo 'wtihout' from numpy/core/shape_base.py
  BUG: fixing bugs in AVX exp/log while handling special value floats (numpy#13415)
  update sequence
  Add analysis check
  BUG: blindly add TypeError to accepted exceptions
  MAINT: fixed several PYTHONOPTIMIZE=2 failures
  BUG: fixed PYTHONOPTIMIZE run
  MAINT: fixed typo 'Mismacth' from numpy.core.setup_common.py
  MAINT: fixed last issues and questions according to numpy#13132
  MAINT: improve efficiency of pad by avoiding use of apply_along_axis
  DOC: dimension sizes are non-negative, not positive
  BUILD, BUG: fix from review, fix bug in git_version
  MAINT: mention 'make dist' in error messsage
  BUILD: allow version-check to pass if GITVER is Unknown (sdist build)
  BUILD: fail documentation build if numpy version does not match
  ...
  • Loading branch information
lijunzh committed May 2, 2019
2 parents 27357a7 + f16c558 commit 9c6fc2d
Show file tree
Hide file tree
Showing 20 changed files with 583 additions and 299 deletions.
3 changes: 3 additions & 0 deletions .lgtm.yml
Expand Up @@ -16,3 +16,6 @@ extraction:
index:
build_command:
- python3 setup.py build

queries:
- include: py/file-not-closed
5 changes: 5 additions & 0 deletions .travis.yml
Expand Up @@ -53,6 +53,11 @@ matrix:
- python: 3.6
env:
- PYTHONOPTIMIZE=2
- BLAS=None
- LAPACK=None
- ATLAS=None
- NPY_BLAS_ORDER=mkl,blis,openblas,atlas,accelerate,blas
- NPY_LAPACK_ORDER=MKL,OPENBLAS,ATLAS,ACCELERATE,LAPACK
- USE_ASV=1
- python: 3.5
dist: trusty # remove after April 2019
Expand Down
40 changes: 28 additions & 12 deletions doc/Makefile
Expand Up @@ -10,10 +10,14 @@
PYVER:=$(shell python3 -c 'from sys import version_info as v; print("{0}.{1}".format(v[0], v[1]))')
PYTHON = python$(PYVER)

NUMPYVER:=$(shell python3 -c "import numpy; print(numpy.version.git_revision[:10])")
GITVER ?= $(shell cd ..; python3 -c "from setup import git_version; \
print(git_version()[:10])")

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = LANG=C sphinx-build
PAPER =
SPHINXOPTS ?=
SPHINXBUILD ?= LANG=C sphinx-build
PAPER ?=

FILES=

Expand All @@ -24,7 +28,7 @@ ALLSPHINXOPTS = -WT --keep-going -d build/doctrees $(PAPEROPT_$(PAPER)) \
$(SPHINXOPTS) source

.PHONY: help clean html web pickle htmlhelp latex changes linkcheck \
dist dist-build gitwash-update
dist dist-build gitwash-update version-check

#------------------------------------------------------------------------------

Expand All @@ -44,6 +48,18 @@ help:
clean:
-rm -rf build/* source/reference/generated

version-check:
ifeq "$(GITVER)" "Unknown"
# @echo sdist build with unlabeled sources
else ifneq ($(NUMPYVER),$(GITVER))
@echo installed numpy $(NUMPYVER) != current repo git version \'$(GITVER)\'
@echo use '"make dist"' or '"GITVER=$(NUMPYVER) make $(MAKECMDGOALS) ..."'
@exit 1
else
# for testing
# @echo installed numpy $(NUMPYVER) matches git version $(GITVER); exit 1
endif

gitwash-update:
rm -rf source/dev/gitwash
install -d source/dev/gitwash
Expand Down Expand Up @@ -119,7 +135,7 @@ build/generate-stamp: $(wildcard source/reference/*.rst)
mkdir -p build
touch build/generate-stamp

html: generate
html: generate version-check
mkdir -p build/html build/doctrees
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html $(FILES)
$(PYTHON) postprocess.py html build/html/*.html
Expand All @@ -132,7 +148,7 @@ html-scipyorg:
@echo
@echo "Build finished. The HTML pages are in build/html."

pickle: generate
pickle: generate version-check
mkdir -p build/pickle build/doctrees
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle $(FILES)
@echo
Expand All @@ -142,7 +158,7 @@ pickle: generate

web: pickle

htmlhelp: generate
htmlhelp: generate version-check
mkdir -p build/htmlhelp build/doctrees
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp $(FILES)
@echo
Expand All @@ -153,11 +169,11 @@ htmlhelp-build: htmlhelp build/htmlhelp/numpy.chm
%.chm: %.hhp
-hhc.exe $^

qthelp: generate
qthelp: generate version-check
mkdir -p build/qthelp build/doctrees
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp $(FILES)

latex: generate
latex: generate version-check
mkdir -p build/latex build/doctrees
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex $(FILES)
$(PYTHON) postprocess.py tex build/latex/*.tex
Expand All @@ -167,18 +183,18 @@ latex: generate
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."

coverage: build
coverage: build version-check
mkdir -p build/coverage build/doctrees
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) build/coverage $(FILES)
@echo "Coverage finished; see c.txt and python.txt in build/coverage"

changes: generate
changes: generate version-check
mkdir -p build/changes build/doctrees
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes $(FILES)
@echo
@echo "The overview file is in build/changes."

linkcheck: generate
linkcheck: generate version-check
mkdir -p build/linkcheck build/doctrees
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck $(FILES)
@echo
Expand Down
2 changes: 1 addition & 1 deletion doc/source/reference/arrays.ndarray.rst
Expand Up @@ -9,7 +9,7 @@ The N-dimensional array (:class:`ndarray`)
An :class:`ndarray` is a (usually fixed-size) multidimensional
container of items of the same type and size. The number of dimensions
and items in an array is defined by its :attr:`shape <ndarray.shape>`,
which is a :class:`tuple` of *N* positive integers that specify the
which is a :class:`tuple` of *N* non-negative integers that specify the
sizes of each dimension. The type of items in the array is specified by
a separate :ref:`data-type object (dtype) <arrays.dtypes>`, one of which
is associated with each ndarray.
Expand Down
13 changes: 13 additions & 0 deletions doc/source/reference/routines.linalg.rst
Expand Up @@ -5,6 +5,19 @@
Linear algebra (:mod:`numpy.linalg`)
************************************

The NumPy linear algebra functions rely on BLAS and LAPACK to provide efficient
low level implementations of standard linear algebra algorithms. Those
libraries may be provided by NumPy itself using C versions of a subset of their
reference implementations but, when possible, highly optimized libraries that
take advantage of specialized processor functionality are preferred. Examples
of such libraries are OpenBLAS_, MKL (TM), and ATLAS. Because those libraries
are multithreaded and processor dependent, environmental variables and external
packages such as threadpoolctl_ may be needed to control the number of threads
or specify the processor architecture.

.. _OpenBLAS: https://www.openblas.net/
.. _threadpoolctl: https://github.com/joblib/threadpoolctl

.. currentmodule:: numpy

Matrix and vector products
Expand Down
60 changes: 59 additions & 1 deletion doc/source/user/building.rst
Expand Up @@ -118,12 +118,70 @@ means that g77 has been used. If libgfortran.so is a dependency, gfortran
has been used. If both are dependencies, this means both have been used, which
is almost always a very bad idea.

Accelerated BLAS/LAPACK libraries
---------------------------------

NumPy searches for optimized linear algebra libraries such as BLAS and LAPACK.
There are specific orders for searching these libraries, as described below.

BLAS
~~~~

The default order for the libraries are:

1. MKL
2. BLIS
3. OpenBLAS
4. ATLAS
5. Accelerate (MacOS)
6. BLAS (NetLIB)


If you wish to build against OpenBLAS but you also have BLIS available one
may predefine the order of searching via the environment variable
``NPY_BLAS_ORDER`` which is a comma-separated list of the above names which
is used to determine what to search for, for instance::

NPY_BLAS_ORDER=ATLAS,blis,openblas,MKL python setup.py build

will prefer to use ATLAS, then BLIS, then OpenBLAS and as a last resort MKL.
If neither of these exists the build will fail (names are compared
lower case).

LAPACK
~~~~~~

The default order for the libraries are:

1. MKL
2. OpenBLAS
3. ATLAS
4. Accelerate (MacOS)
5. LAPACK (NetLIB)


If you wish to build against OpenBLAS but you also have MKL available one
may predefine the order of searching via the environment variable
``NPY_LAPACK_ORDER`` which is a comma-separated list of the above names,
for instance::

NPY_LAPACK_ORDER=ATLAS,openblas,MKL python setup.py build

will prefer to use ATLAS, then OpenBLAS and as a last resort MKL.
If neither of these exists the build will fail (names are compared
lower case).


Disabling ATLAS and other accelerated libraries
-----------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Usage of ATLAS and other accelerated libraries in NumPy can be disabled
via::

NPY_BLAS_ORDER= NPY_LAPACK_ORDER= python setup.py build

or::

BLAS=None LAPACK=None ATLAS=None python setup.py build


Expand Down
2 changes: 1 addition & 1 deletion numpy/core/setup_common.py
Expand Up @@ -81,7 +81,7 @@ def get_api_versions(apiversion, codegen_dir):
return curapi_hash, apis_hash[apiversion]

def check_api_version(apiversion, codegen_dir):
"""Emits a MismacthCAPIWarning if the C API version needs updating."""
"""Emits a MismatchCAPIWarning if the C API version needs updating."""
curapi_hash, api_hash = get_api_versions(apiversion, codegen_dir)

# If different hash, it means that the api .txt files in
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/shape_base.py
Expand Up @@ -832,7 +832,7 @@ def block(arrays):

# Theses helper functions are mostly used for testing.
# They allow us to write tests that directly call `_block_slicing`
# or `_block_concatenate` wtihout blocking large arrays to forse the wisdom
# or `_block_concatenate` without blocking large arrays to forse the wisdom
# to trigger the desired path.
def _block_setup(arrays):
"""
Expand Down

0 comments on commit 9c6fc2d

Please sign in to comment.