Skip to content

Illegal instruction in dot #13426

Closed
Closed

Description

@sashkab

Recently I've upgraded my system to iMac Pro, which has Skylake CPU and one of the test started to fail.

Reproducing code example:

>>> from numpy import array
>>> x = array([1.,2.,3.,4.])
>>> x.dot(x)
Illegal instruction

Now, more detailed log:

$ docker run -it --rm alpine:3.9
/ # apk add python3 py3-numpy
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/16) Installing libgcc (8.3.0-r0)
(2/16) Installing libquadmath (8.3.0-r0)
(3/16) Installing libgfortran (8.3.0-r0)
(4/16) Installing openblas (0.3.3-r2)
(5/16) Installing libbz2 (1.0.6-r6)
(6/16) Installing expat (2.2.6-r0)
(7/16) Installing libffi (3.2.1-r6)
(8/16) Installing gdbm (1.13-r1)
(9/16) Installing xz-libs (5.2.4-r0)
(10/16) Installing ncurses-terminfo-base (6.1_p20190105-r0)
(11/16) Installing ncurses-terminfo (6.1_p20190105-r0)
(12/16) Installing ncurses-libs (6.1_p20190105-r0)
(13/16) Installing readline (7.0.003-r1)
(14/16) Installing sqlite-libs (3.26.0-r3)
(15/16) Installing python3 (3.6.8-r2)
(16/16) Installing py3-numpy (1.15.4-r0)
Executing busybox-1.29.3-r10.trigger
OK: 108 MiB in 30 packages
/ # python3
Python 3.6.8 (default, Apr  8 2019, 18:17:52)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import array
>>> x = array([1.,2.,3.,4.])
>>> x.dot(x)
Illegal instruction

I've tried to upgrade numpy to the latest version, and still see the problem.

This might be related to the OpenMathLib/OpenBLAS#1947.

Possible workaround, is to set OPENBLAS_CORETYPE environmental variable to haswell prior to starting Python:

/ # export OPENBLAS_CORETYPE=haswell
/ # python3
Python 3.6.8 (default, Apr  8 2019, 18:17:52)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import array
Core: Haswell
>>> x = array([1.,2.,3.,4.])
>>> x.dot(x)
30.0

Activity

  1. seberg commented on Apr 29, 2019

    @seberg
    Member

    @sashkab thanks for reporting, but since it seems to be a known upstream bug, I do not think there is much we can do about it.

    However, I am not quite sure which OpenBLAS version the numpy wheels use. @charris do we use 0.3.6 already, or should we make sure to use it for the next wheel release?

  2. added
    57 - Close?
    on Apr 29, 2019
  3. charris commented on Apr 29, 2019

    @charris
    Member

    do we use 0.3.6 already, or should we make sure to use it for the next wheel release?

    @seberg 1.16 is 3.3+, current master is 3.5, which was the latest not long ago. (checks) Looks like 3.6 was released three hours ago :) @tylerjereddy Want to take a shot at updating the OpenBLAS version?

  4. charris commented on Apr 29, 2019

    @charris
    Member

    Skylake? @matthew-brett Might be related to #13401.

  5. tylerjereddy commented on Apr 30, 2019

    @tylerjereddy
    Contributor

    Want to take a shot at updating the OpenBLAS version?

    Ok, I'll try to open a PR soon--will have to happen for MacPython ecosystem first, then trickle down to a second PR for NumPy wheels once that is ready / built.

  6. charris commented on Apr 30, 2019

    @charris
    Member

    @tylerjereddy Isn't all that is needed changing env_vars.sh once the libraries are built? Or is more involved?

  7. tylerjereddy commented on Apr 30, 2019

    @tylerjereddy
    Contributor

    @charris Yeah it is not bad for numpy-wheels once OpenBLAS binary is built--.appveyor.yml needs two URL changes as well, but should just be 4 character changes overall :)

    Our dev CI would be similar, except the more "exotic" test platforms that use "manual" builds of OpenBLAS like POWER, but that's hardly critical for now.

  8. mattip commented on May 30, 2019

    @mattip
    Member

    Fixed by updating OpenBLAS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    57 - Close?

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions