diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2020-12-31 09:40:33 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2020-12-31 09:40:33 +0900 |
commit | 55930b012d13b8b16f02e358e4c884f9fdc269c9 (patch) | |
tree | 8c387e18ef69cf0f3fc053d47dfa55a8874307f7 | |
parent | 8fba8334be80177304a51cae72db20bcc62e3fdd (diff) | |
download | python-numpy-55930b012d13b8b16f02e358e4c884f9fdc269c9.tar.gz python-numpy-55930b012d13b8b16f02e358e4c884f9fdc269c9.tar.bz2 python-numpy-55930b012d13b8b16f02e358e4c884f9fdc269c9.zip |
Imported Upstream version 1.18.4upstream/1.18.4
-rw-r--r-- | azure-pipelines.yml | 24 | ||||
-rw-r--r-- | azure-steps-windows.yml | 27 | ||||
-rw-r--r-- | doc/changelog/1.18.4-changelog.rst | 23 | ||||
-rw-r--r-- | doc/source/release.rst | 1 | ||||
-rw-r--r-- | doc/source/release/1.18.4-notes.rst | 36 | ||||
-rw-r--r-- | doc/source/user/setting-up.rst | 1 | ||||
-rw-r--r-- | doc/source/user/troubleshooting-importerror.rst | 125 | ||||
-rw-r--r-- | numpy/core/__init__.py | 34 | ||||
-rw-r--r-- | numpy/core/src/multiarray/arraytypes.c.src | 69 | ||||
-rw-r--r-- | numpy/random/src/distributions/distributions.c | 53 | ||||
-rw-r--r-- | numpy/random/tests/test_generator_mt19937.py | 38 | ||||
-rw-r--r-- | numpy/random/tests/test_randomstate.py | 24 | ||||
-rw-r--r-- | pavement.py | 2 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rw-r--r-- | tools/openblas_support.py | 2 |
15 files changed, 412 insertions, 49 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5c8930770..77837275d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -92,25 +92,35 @@ stages: # now stuck getting the full gcc toolchain instead of # just pulling in gfortran - script: | - # same version of gfortran as the wheel builds - brew install gcc49 - # manually link critical gfortran libraries - ln -s /usr/local/Cellar/gcc@4.9/4.9.4_1/lib/gcc/4.9/libgfortran.3.dylib /usr/local/lib/libgfortran.3.dylib - ln -s /usr/local/Cellar/gcc@4.9/4.9.4_1/lib/gcc/4.9/libquadmath.0.dylib /usr/local/lib/libquadmath.0.dylib + set -xe + # same version of gfortran as the open-libs and numpy-wheel builds + curl -L https://github.com/MacPython/gfortran-install/raw/master/archives/gfortran-4.9.0-Mavericks.dmg -o gfortran.dmg + GFORTRAN_SHA256=$(shasum -a 256 gfortran.dmg) + KNOWN_SHA256="d2d5ca5ba8332d63bbe23a07201c4a0a5d7e09ee56f0298a96775f928c3c4b30 gfortran.dmg" + if [ "$GFORTRAN_SHA256" != "$KNOWN_SHA256" ]; then + echo sha256 mismatch + exit 1 + fi + hdiutil attach -mountpoint /Volumes/gfortran gfortran.dmg + sudo installer -pkg /Volumes/gfortran/gfortran.pkg -target / + otool -L /usr/local/gfortran/lib/libgfortran.3.dylib # Manually symlink gfortran-4.9 to plain gfortran for f2py. # No longer needed after Feb 13 2020 as gfortran is already present # and the attempted link errors. Keep this for future reference. # ln -s /usr/local/bin/gfortran-4.9 /usr/local/bin/gfortran - displayName: 'make gfortran available on mac os vm' + displayName: 'make libgfortran available on mac os for openblas' # use the pre-built openblas binary that most closely # matches our MacOS wheel builds -- currently based # primarily on file size / name details - script: | + set -xe + python -m pip install urllib3 target=$(python tools/openblas_support.py) ls -lR $target # manually link to appropriate system paths - cp $target/lib/* /usr/local/lib/ + cp $target/lib/lib* /usr/local/lib/ cp $target/include/* /usr/local/include/ + otool -L /usr/local/lib/libopenblas* displayName: 'install pre-built openblas' - script: python -m pip install --upgrade pip setuptools wheel displayName: 'Install tools' diff --git a/azure-steps-windows.yml b/azure-steps-windows.yml index f17039455..46b8c1ff9 100644 --- a/azure-steps-windows.yml +++ b/azure-steps-windows.yml @@ -9,12 +9,21 @@ steps: - script: python -m pip install -r test_requirements.txt displayName: 'Install dependencies; some are optional to avoid test skips' - powershell: | - $pyversion = python -c "from __future__ import print_function; import sys; print(sys.version.split()[0])" - Write-Host "Python Version: $pyversion" - $target = "C:\\hostedtoolcache\\windows\\Python\\$pyversion\\$(PYTHON_ARCH)\\lib\\openblas$env:OPENBLAS_SUFFIX.a" - Write-Host "target path: $target" - $openblas = python tools/openblas_support.py - cp $openblas $target + $ErrorActionPreference = "Stop" + # Download and get the path to "openblas.a". We cannot copy it + # to $PYTHON_EXE's directory since that is on a different drive which + # mingw does not like. Instead copy it to a directory and set OPENBLAS, + # since OPENBLAS will be picked up by the openblas discovery + python -m pip install urllib3 + $target = $(python tools/openblas_support.py) + mkdir openblas + echo Copying $target to openblas/openblas$env:OPENBLAS_SUFFIX.a + cp $target openblas/openblas$env:OPENBLAS_SUFFIX.a + If ( Test-Path env:NPY_USE_BLAS_ILP64 ){ + echo "##vso[task.setvariable variable=OPENBLAS64_]$pwd\openblas" + } else { + echo "##vso[task.setvariable variable=OPENBLAS]$pwd\openblas" + } displayName: 'Download / Install OpenBLAS' - powershell: | @@ -31,7 +40,7 @@ steps: refreshenv } python -c "from tools import openblas_support; openblas_support.make_init('numpy')" - pip wheel -v -v -v --wheel-dir=dist . + pip wheel -v -v -v --no-build-isolation --no-use-pep517 --wheel-dir=dist . ls dist -r | Foreach-Object { pip install $_.FullName @@ -39,7 +48,7 @@ steps: displayName: 'Build NumPy' - bash: | pushd . && cd .. && target=$(python -c "import numpy, os; print(os.path.abspath(os.path.join(os.path.dirname(numpy.__file__), '.libs')))") && popd - pip download -d destination --only-binary --no-deps numpy==1.14 + pip download -d destination --only-binary :all: --no-deps numpy==1.14 cd destination && unzip numpy*.whl && cp numpy/.libs/*.dll $target ls $target displayName: 'Add extraneous & older DLL to numpy/.libs to probe DLL handling robustness' @@ -53,4 +62,4 @@ steps: inputs: testResultsFiles: '**/test-*.xml' failTaskOnFailedTests: true - testRunTitle: 'Publish test results for Python $(PYTHON_VERSION) $(BITS)-bit $(TEST_MODE) Windows'
\ No newline at end of file + testRunTitle: 'Publish test results for Python $(PYTHON_VERSION) $(BITS)-bit $(TEST_MODE) Windows' diff --git a/doc/changelog/1.18.4-changelog.rst b/doc/changelog/1.18.4-changelog.rst new file mode 100644 index 000000000..f3524b5f5 --- /dev/null +++ b/doc/changelog/1.18.4-changelog.rst @@ -0,0 +1,23 @@ + +Contributors +============ + +A total of 4 people contributed to this release. People with a "+" by their +names contributed a patch for the first time. + +* Charles Harris +* Matti Picus +* Sebastian Berg +* Warren Weckesser + +Pull requests merged +==================== + +A total of 6 pull requests were merged for this release. + +* `#16055 <https://github.com/numpy/numpy/pull/16055>`__: BLD: add i686 for 1.18 builds +* `#16090 <https://github.com/numpy/numpy/pull/16090>`__: BUG: random: ``Generator.integers(2**32)`` always returned 0. +* `#16091 <https://github.com/numpy/numpy/pull/16091>`__: BLD: fix path to libgfortran on macOS +* `#16109 <https://github.com/numpy/numpy/pull/16109>`__: REV: Reverts side-effect changes to casting +* `#16114 <https://github.com/numpy/numpy/pull/16114>`__: BLD: put openblas library in local directory on windows +* `#16132 <https://github.com/numpy/numpy/pull/16132>`__: DOC: Change import error "howto" to link to new troubleshooting... diff --git a/doc/source/release.rst b/doc/source/release.rst index 31bd819d6..fc582bd58 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -5,6 +5,7 @@ Release Notes .. toctree:: :maxdepth: 3 + 1.18.4 <release/1.18.4-notes> 1.18.3 <release/1.18.3-notes> 1.18.2 <release/1.18.2-notes> 1.18.1 <release/1.18.1-notes> diff --git a/doc/source/release/1.18.4-notes.rst b/doc/source/release/1.18.4-notes.rst new file mode 100644 index 000000000..227b3dba1 --- /dev/null +++ b/doc/source/release/1.18.4-notes.rst @@ -0,0 +1,36 @@ +========================== +NumPy 1.18.4 Release Notes +========================== + +This is that last planned release in the 1.18.x series. It reverts the +``bool("0")`` behavior introduced in 1.18.3 and fixes a bug in +``Generator.integers``. There is also improved help in the error message +emitted when numpy import fails due to a link to a new troubleshooting section +in the documentation that is now included. + +The Python versions supported in this release are 3.5-3.8. Downstream +developers should use Cython >= 0.29.15 for Python 3.8 support and OpenBLAS >= +3.7 to avoid errors on the Skylake architecture. + +Contributors +============ + +A total of 4 people contributed to this release. People with a "+" by their +names contributed a patch for the first time. + +* Charles Harris +* Matti Picus +* Sebastian Berg +* Warren Weckesser + +Pull requests merged +==================== + +A total of 6 pull requests were merged for this release. + +* `#16055 <https://github.com/numpy/numpy/pull/16055>`__: BLD: add i686 for 1.18 builds +* `#16090 <https://github.com/numpy/numpy/pull/16090>`__: BUG: random: ``Generator.integers(2**32)`` always returned 0. +* `#16091 <https://github.com/numpy/numpy/pull/16091>`__: BLD: fix path to libgfortran on macOS +* `#16109 <https://github.com/numpy/numpy/pull/16109>`__: REV: Reverts side-effect changes to casting +* `#16114 <https://github.com/numpy/numpy/pull/16114>`__: BLD: put openblas library in local directory on windows +* `#16132 <https://github.com/numpy/numpy/pull/16132>`__: DOC: Change import error "howto" to link to new troubleshooting... diff --git a/doc/source/user/setting-up.rst b/doc/source/user/setting-up.rst index f70dacf82..7ca3a365c 100644 --- a/doc/source/user/setting-up.rst +++ b/doc/source/user/setting-up.rst @@ -7,3 +7,4 @@ Setting up whatisnumpy install + troubleshooting-importerror diff --git a/doc/source/user/troubleshooting-importerror.rst b/doc/source/user/troubleshooting-importerror.rst new file mode 100644 index 000000000..f0af91751 --- /dev/null +++ b/doc/source/user/troubleshooting-importerror.rst @@ -0,0 +1,125 @@ +*************************** +Troubleshooting ImportError +*************************** + +.. note:: + + Since this information may be updated regularly, please ensure you are + viewing the most `up-to-date version <https://numpy.org/devdocs/user/troubleshooting-importerror.html>`_. + + +ImportError +=========== + +In certain cases a failed installation or setup issue can cause you to +see the following error message:: + + IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! + + Importing the numpy c-extensions failed. This error can happen for + different reasons, often due to issues with your setup. + +The error also has additional information to help you troubleshoot: + +* Your Python version +* Your NumPy version + +Please check both of these carefully to see if they are what you expect. +You may need to check your ``PATH`` or ``PYTHONPATH`` environment variables +(see `Check Environment Variables`_ below). + +The following sections list commonly reported issues depending on your setup. +If you have an issue/solution that you think should appear please open a +NumPy issue so that it will be added. + +There are a few commonly reported issues depending on your system/setup. +If none of the following tips help you, please be sure to note the following: + +* how you installed Python +* how you installed NumPy +* your operating system +* whether or not you have multiple versions of Python installed +* if you built from source, your compiler versions and ideally a build log + +when investigating further and asking for support. + + +Using Python from ``conda`` (Anaconda) +-------------------------------------- + +Please make sure that you have activated your conda environment. +See also the `conda user-guide <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment>`_. + + +Using Anaconda/conda Python within PyCharm +------------------------------------------ + +There are fairly common issues when using PyCharm together with Anaconda, +please see the `PyCharm support <https://www.jetbrains.com/help/pycharm/conda-support-creating-conda-virtual-environment.html>`_ + + +Raspberry Pi +------------ + +There are sometimes issues reported on Raspberry Pi setups when installing +using ``pip3 install`` (or ``pip`` install). These will typically mention:: + + libf77blas.so.3: cannot open shared object file: No such file or directory + + +The solution will be to either:: + + sudo apt-get install libatlas-base-dev + +to install the missing libraries expected by the self-compiled NumPy +(ATLAS is a possible provider of linear algebra). + +*Alternatively* use the NumPy provided by Raspbian. In which case run:: + + pip3 uninstall numpy # remove previously installed version + apt install python3-numpy + + +Debug build on Windows +---------------------- + +Rather than building your project in ``DEBUG`` mode on windows, try +building in ``RELEASE`` mode with debug symbols and no optimization. +Full ``DEBUG`` mode on windows changes the names of the DLLs python +expects to find, so if you wish to truly work in ``DEBUG`` mode you will +need to recompile the entire stack of python modules you work with +including NumPy + + +All Setups +---------- + +Occasionally there may be simple issues with old or bad installations +of NumPy. In this case you may just try to uninstall and reinstall NumPy. +Make sure that NumPy is not found after uninstalling. + + +Development Setup +----------------- + +If you are using a development setup, make sure to run ``git clean -xdf`` +to delete all files not under version control (be careful not to lose +any modifications you made, e.g. ``site.cfg``). +In many cases files from old builds may lead to incorrect builds. + + +Check Environment Variables +--------------------------- + +In general how to set and check your environment variables depends on +your system. If you can open a correct python shell, you can also run the +following in python:: + + import os + PYTHONPATH = os.environ['PYTHONPATH'].split(os.pathsep) + print("The PYTHONPATH is:", PYTHONPATH) + PATH = os.environ['PATH'].split(os.pathsep) + print("The PATH is:", PATH) + +This may mainly help you if you are not running the python and/or NumPy +version you are expecting to run. diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py index c3b3f0392..1efa907c2 100644 --- a/numpy/core/__init__.py +++ b/numpy/core/__init__.py @@ -28,25 +28,21 @@ except ImportError as exc: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! -Importing the numpy c-extensions failed. -- Try uninstalling and reinstalling numpy. -- If you have already done that, then: - 1. Check that you expected to use Python%d.%d from "%s", - and that you have no directories in your PATH or PYTHONPATH that can - interfere with the Python and numpy version "%s" you're trying to use. - 2. If (1) looks fine, you can open a new issue at - https://github.com/numpy/numpy/issues. Please include details on: - - how you installed Python - - how you installed numpy - - your operating system - - whether or not you have multiple versions of Python installed - - if you built from source, your compiler versions and ideally a build log - -- If you're working with a numpy git repository, try `git clean -xdf` - (removes all files not under version control) and rebuild numpy. - -Note: this error has many possible causes, so please don't comment on -an existing issue about this - open a new one instead. +Importing the numpy C-extensions failed. This error can happen for +many reasons, often due to issues with your setup or how NumPy was +installed. + +We have compiled some common reasons and troubleshooting tips at: + + https://numpy.org/devdocs/user/troubleshooting-importerror.html + +Please note and check the following: + + * The Python version is: Python%d.%d from "%s" + * The NumPy version is: "%s" + +and make sure that they are the versions you expect. +Please carefully study the documentation linked above for further help. Original error was: %s """ % (sys.version_info[0], sys.version_info[1], sys.executable, diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src index 598ee8537..6ec060db5 100644 --- a/numpy/core/src/multiarray/arraytypes.c.src +++ b/numpy/core/src/multiarray/arraytypes.c.src @@ -1527,8 +1527,16 @@ OBJECT_to_@TOTYPE@(void *input, void *output, npy_intp n, * #oskip = 1*18,(PyArray_DESCR(aop)->elsize)*3,1*2, * 1*18,(PyArray_DESCR(aop)->elsize)*3,1*2, * 1*18,(PyArray_DESCR(aop)->elsize)*3,1*2# + * #convert = 1*14, 0, 1*3, 0*3, 1*2, + * 1*14, 0, 1*3, 0*3, 1*2, + * 0*23# + * #convstr = (Int*9, Long*2, Float*4, Complex*3, Tuple*3, Long*2)*3# */ +#if @convert@ + +#define IS_@from@ + static void @from@_to_@to@(void *input, void *output, npy_intp n, void *vaip, void *aop) @@ -1542,10 +1550,41 @@ static void int oskip = @oskip@; for (i = 0; i < n; i++, ip+=skip, op+=oskip) { + PyObject *new; PyObject *temp = PyArray_Scalar(ip, PyArray_DESCR(aip), (PyObject *)aip); if (temp == NULL) { return; } + +#if defined(NPY_PY3K) && defined(IS_STRING) + /* Work around some Python 3K */ + new = PyUnicode_FromEncodedObject(temp, "ascii", "strict"); + Py_DECREF(temp); + temp = new; + if (temp == NULL) { + return; + } +#endif + /* convert from Python object to needed one */ + { + PyObject *args; + + /* call out to the Python builtin given by convstr */ + args = Py_BuildValue("(N)", temp); +#if defined(NPY_PY3K) +#define PyInt_Type PyLong_Type +#endif + new = Py@convstr@_Type.tp_new(&Py@convstr@_Type, args, NULL); +#if defined(NPY_PY3K) +#undef PyInt_Type +#endif + Py_DECREF(args); + temp = new; + if (temp == NULL) { + return; + } + } + if (@to@_setitem(temp, op, aop)) { Py_DECREF(temp); return; @@ -1554,6 +1593,36 @@ static void } } +#undef IS_@from@ + +#else + +static void +@from@_to_@to@(void *input, void *output, npy_intp n, + void *vaip, void *aop) +{ + @fromtyp@ *ip = input; + @totyp@ *op = output; + PyArrayObject *aip = vaip; + + npy_intp i; + int skip = PyArray_DESCR(aip)->elsize; + int oskip = @oskip@; + + for (i = 0; i < n; i++, ip+=skip, op+=oskip) { + PyObject *temp = PyArray_Scalar(ip, PyArray_DESCR(aip), (PyObject *)aip); + if (temp == NULL) { + return; + } + if (@to@_setitem(temp, op, aop)) { + Py_DECREF(temp); + return; + } + Py_DECREF(temp); + } +} + +#endif /**end repeat**/ diff --git a/numpy/random/src/distributions/distributions.c b/numpy/random/src/distributions/distributions.c index 0b46dc6d8..586e38aa5 100644 --- a/numpy/random/src/distributions/distributions.c +++ b/numpy/random/src/distributions/distributions.c @@ -6,6 +6,8 @@ #include <intrin.h> #endif +#include <assert.h> + /* Inline generators for internal use */ static NPY_INLINE uint32_t next_uint32(bitgen_t *bitgen_state) { return bitgen_state->next_uint32(bitgen_state->state); @@ -1149,6 +1151,8 @@ static NPY_INLINE uint64_t bounded_lemire_uint64(bitgen_t *bitgen_state, */ const uint64_t rng_excl = rng + 1; + assert(rng != 0xFFFFFFFFFFFFFFFFULL); + #if __SIZEOF_INT128__ /* 128-bit uint available (e.g. GCC/clang). `m` is the __uint128_t scaled * integer. */ @@ -1239,6 +1243,8 @@ static NPY_INLINE uint32_t buffered_bounded_lemire_uint32( uint64_t m; uint32_t leftover; + assert(rng != 0xFFFFFFFFUL); + /* Generate a scaled random number. */ m = ((uint64_t)next_uint32(bitgen_state)) * rng_excl; @@ -1273,6 +1279,8 @@ static NPY_INLINE uint16_t buffered_bounded_lemire_uint16( uint32_t m; uint16_t leftover; + assert(rng != 0xFFFFU); + /* Generate a scaled random number. */ m = ((uint32_t)buffered_uint16(bitgen_state, bcnt, buf)) * rng_excl; @@ -1308,6 +1316,9 @@ static NPY_INLINE uint8_t buffered_bounded_lemire_uint8(bitgen_t *bitgen_state, uint16_t m; uint8_t leftover; + assert(rng != 0xFFU); + + /* Generate a scaled random number. */ m = ((uint16_t)buffered_uint8(bitgen_state, bcnt, buf)) * rng_excl; @@ -1337,6 +1348,14 @@ uint64_t random_bounded_uint64(bitgen_t *bitgen_state, uint64_t off, return off; } else if (rng <= 0xFFFFFFFFUL) { /* Call 32-bit generator if range in 32-bit. */ + if (rng == 0xFFFFFFFFUL) { + /* + * The 32-bit Lemire method does not handle rng=0xFFFFFFFF, so we'll + * call next_uint32 directly. This also works when use_masked is True, + * so we handle both cases here. + */ + return off + (uint64_t) next_uint32(bitgen_state); + } if (use_masked) { return off + buffered_bounded_masked_uint32(bitgen_state, rng, mask, NULL, NULL); @@ -1450,22 +1469,34 @@ void random_bounded_uint64_fill(bitgen_t *bitgen_state, uint64_t off, out[i] = off; } } else if (rng <= 0xFFFFFFFFUL) { - uint32_t buf = 0; - int bcnt = 0; - /* Call 32-bit generator if range in 32-bit. */ - if (use_masked) { - /* Smallest bit mask >= max */ - uint64_t mask = gen_mask(rng); + /* + * The 32-bit Lemire method does not handle rng=0xFFFFFFFF, so we'll + * call next_uint32 directly. This also works when use_masked is True, + * so we handle both cases here. + */ + if (rng == 0xFFFFFFFFUL) { for (i = 0; i < cnt; i++) { - out[i] = off + buffered_bounded_masked_uint32(bitgen_state, rng, mask, - &bcnt, &buf); + out[i] = off + (uint64_t) next_uint32(bitgen_state); } } else { - for (i = 0; i < cnt; i++) { - out[i] = off + - buffered_bounded_lemire_uint32(bitgen_state, rng, &bcnt, &buf); + uint32_t buf = 0; + int bcnt = 0; + + if (use_masked) { + /* Smallest bit mask >= max */ + uint64_t mask = gen_mask(rng); + + for (i = 0; i < cnt; i++) { + out[i] = off + buffered_bounded_masked_uint32(bitgen_state, rng, mask, + &bcnt, &buf); + } + } else { + for (i = 0; i < cnt; i++) { + out[i] = off + + buffered_bounded_lemire_uint32(bitgen_state, rng, &bcnt, &buf); + } } } } else if (rng == 0xFFFFFFFFFFFFFFFFULL) { diff --git a/numpy/random/tests/test_generator_mt19937.py b/numpy/random/tests/test_generator_mt19937.py index da2e76928..2f542e4d9 100644 --- a/numpy/random/tests/test_generator_mt19937.py +++ b/numpy/random/tests/test_generator_mt19937.py @@ -521,6 +521,44 @@ class TestIntegers(object): assert_array_equal(val, val_bc) + @pytest.mark.parametrize( + 'bound, expected', + [(2**32 - 1, np.array([517043486, 1364798665, 1733884389, 1353720612, + 3769704066, 1170797179, 4108474671])), + (2**32, np.array([517043487, 1364798666, 1733884390, 1353720613, + 3769704067, 1170797180, 4108474672])), + (2**32 + 1, np.array([517043487, 1733884390, 3769704068, 4108474673, + 1831631863, 1215661561, 3869512430]))] + ) + def test_repeatability_32bit_boundary(self, bound, expected): + for size in [None, len(expected)]: + random = Generator(MT19937(1234)) + x = random.integers(bound, size=size) + assert_equal(x, expected if size is not None else expected[0]) + + def test_repeatability_32bit_boundary_broadcasting(self): + desired = np.array([[[1622936284, 3620788691, 1659384060], + [1417365545, 760222891, 1909653332], + [3788118662, 660249498, 4092002593]], + [[3625610153, 2979601262, 3844162757], + [ 685800658, 120261497, 2694012896], + [1207779440, 1586594375, 3854335050]], + [[3004074748, 2310761796, 3012642217], + [2067714190, 2786677879, 1363865881], + [ 791663441, 1867303284, 2169727960]], + [[1939603804, 1250951100, 298950036], + [1040128489, 3791912209, 3317053765], + [3155528714, 61360675, 2305155588]], + [[ 817688762, 1335621943, 3288952434], + [1770890872, 1102951817, 1957607470], + [3099996017, 798043451, 48334215]]]) + for size in [None, (5, 3, 3)]: + random = Generator(MT19937(12345)) + x = random.integers([[-1], [0], [1]], + [2**32 - 1, 2**32, 2**32 + 1], + size=size) + assert_array_equal(x, desired if size is not None else desired[0]) + def test_int64_uint64_broadcast_exceptions(self, endpoint): configs = {np.uint64: ((0, 2**65), (-1, 2**62), (10, 9), (0, 0)), np.int64: ((0, 2**64), (-(2**64), 2**62), (10, 9), (0, 0), diff --git a/numpy/random/tests/test_randomstate.py b/numpy/random/tests/test_randomstate.py index c12b685ad..3626f2c33 100644 --- a/numpy/random/tests/test_randomstate.py +++ b/numpy/random/tests/test_randomstate.py @@ -350,6 +350,30 @@ class TestRandint(object): res = hashlib.md5(val).hexdigest() assert_(tgt[np.dtype(bool).name] == res) + @pytest.mark.skipif(np.iinfo('l').max < 2**32, + reason='Cannot test with 32-bit C long') + def test_repeatability_32bit_boundary_broadcasting(self): + desired = np.array([[[3992670689, 2438360420, 2557845020], + [4107320065, 4142558326, 3216529513], + [1605979228, 2807061240, 665605495]], + [[3211410639, 4128781000, 457175120], + [1712592594, 1282922662, 3081439808], + [3997822960, 2008322436, 1563495165]], + [[1398375547, 4269260146, 115316740], + [3414372578, 3437564012, 2112038651], + [3572980305, 2260248732, 3908238631]], + [[2561372503, 223155946, 3127879445], + [ 441282060, 3514786552, 2148440361], + [1629275283, 3479737011, 3003195987]], + [[ 412181688, 940383289, 3047321305], + [2978368172, 764731833, 2282559898], + [ 105711276, 720447391, 3596512484]]]) + for size in [None, (5, 3, 3)]: + random.seed(12345) + x = self.rfunc([[-1], [0], [1]], [2**32 - 1, 2**32, 2**32 + 1], + size=size) + assert_array_equal(x, desired if size is not None else desired[0]) + def test_int64_uint64_corner_case(self): # When stored in Numpy arrays, `lbnd` is casted # as np.int64, and `ubnd` is casted as np.uint64. diff --git a/pavement.py b/pavement.py index 88d1d767c..f59291622 100644 --- a/pavement.py +++ b/pavement.py @@ -41,7 +41,7 @@ from paver.easy import Bunch, options, task, sh #----------------------------------- # Path to the release notes -RELEASE_NOTES = 'doc/source/release/1.18.3-notes.rst' +RELEASE_NOTES = 'doc/source/release/1.18.4-notes.rst' #------------------------------------------------------- @@ -58,7 +58,7 @@ Operating System :: MacOS MAJOR = 1 MINOR = 18 -MICRO = 3 +MICRO = 4 ISRELEASED = True VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) diff --git a/tools/openblas_support.py b/tools/openblas_support.py index 4a210cfe1..a8d5fb7fd 100644 --- a/tools/openblas_support.py +++ b/tools/openblas_support.py @@ -33,7 +33,7 @@ def get_arch(): ret = 'arm'; elif 'aarch64' in os.uname()[-1]: ret = 'arm'; - elif 'x86' in os.uname()[-1]: + elif 'x86' in os.uname()[-1] or os.uname()[-1] == 'i686': ret = 'x86' elif 'ppc64' in os.uname()[-1]: ret = 'ppc64' |