Repository navigation
numpy umath.cpython SIGILL (1.14.2) #10787
Description
Activity
Are you running in some sort of unusual setup, e.g. virtualized? For some reason NumPy has detected that it thinks you have a recent CPU that supports AVX2 instructions, but then when it tries to use those instructions they're causing an "illegal instruction" error.
Yep, it's running inside a docker container inside another VM.
Downgrading to 1.11.3 worked. We will look into if we can not have as many virtualization layers to see if that helps too.
That cpu does not support avx2, odd it detects it. Which version of GCC was used to compile numpy?
can you compile and run this file:
#include <stdio.h> int main(void) { printf("avx2 %d\n", __builtin_cpu_supports("avx2")); }gcc file.c ./a.outI guess we should just parse /proc/cpuinfo to determine avx2 support.
@juliantaylor given all the weird reports we've gotten about different virtualization setups, I almost wonder whether we should test for it by running an instruction and catching the SIGILL (if any).
that would be a generic option, though a bit overkill as we currently only support avx with GCC, so linux.
I'll have a look how at how difficult that is to do.@juliantaylor I guess there's some theoretical problem where if two threads try to use a SIGILL handler like this at once, then they could collide (b/c signal handlers are process-global). This should be extremely rare, of course.
I just reviewed some of the other bug reports we've gotten about this, and you're right, generally
/proc/cpuinfoseems to be correct even withcpuidis broken. So I guess one option would be to figure out how/proc/cpuinfoknows, and do that. And another would be to continue to use__builtin_cpu_supports, but also check/proc/cpuinfoas well (on systems that have it), since this is a weird issue with broken systems, and we're just trying to reduce the frequency with which people hit it.the determination is currently during module load which runs under the gil so threads should not be a problem.
My though was to use the builtin and only if it says avx available also check sigill or cpuinfo.But I am still not really sure why this happens, fftw and openblas also just use cpuid and last I checked I did not see a bug in gccs code.
The only thing I can think if that the OS itself does not support avx, but that means it needs to be something as old as rhel5. Though you can disable it with a boot option, I'll test that.urg, yes disabling avx in the kernel crashes numpy unfortunate gcc does not also verify that in the builtin.
- added a commit that references this issue
on Jun 9, 2018
Downgrading numpy to 1.11.3 helped
I'm getting a segfault when using numpy 1.14.2. Here's the gdb trace:
Here is the code that can replicate this:
Python version and pip freeze