12 ms·
In practice, it's very hard to make Python's distutils do this. I tried to figure it out years ago, see http://stackoverflow.com/questions/15527611/how-do-i-spe
by dalke 10y ago
In practice, it's very hard to make Python's distutils do this. I tried to figure it out years ago, see http://stackoverflow.com/questions/15527611/how-do-i-specify-different-compiler-flags-in-distutils-for-just-one-python-c-ext http://stackoverflow.com/questions/15527611/how-do-i-specify... . I also asked on the distutils list. No one had a clean solution.
The best solution I have is to interpose my own "CC", which looks at what is being compile and adds the correct compiler options for the right files before calling the real compiler. This is hacky and inflexible.
- wiredfool 10y agoI'm curious how scpiy and numpy manage it. I'm pretty sure that they have solved some of this before.
- dalke 10y agoIn my short search, I didn't see evidence that either package has run-time dispatch based on the processor type. I don't see "cpuid" used in the scipy code base, and the only intrinsic I found is specifically in a MS Windows #ifdef. Numpy doesn't use cpuid. It does have compile-time options for intrinsics, but not run-time.
- tavert 10y agoEntirely handled by the underlying BLAS library, OpenBLAS and MKL have this feature but few if any other libraries do. I believe FFTW has something similar, but scipy doesn't use FFTW.