On Dec 11, 2007 11:59 AM, Andrew Straw <strawman@astraw.com> wrote:
An idea that occurred to me after reading Fernando's email. A function could be called at numpy import time that specifically checks for the instruction set on the CPU running and makes sure that is completely covers the instruction set available through all the various calls, including to BLAS. If this kind of thing were added, numpy could fail with a loud warning rather than dying with mysterious errors later on. The trouble would seem that you can switch your BLAS shared library without re-compiling numpy, so numpy would have to do a run-time query of ATLAS, etc. for compilation issues. Which is likely library-dependent, and furthermore, not having looked into BLAS implementations, I'm not sure that (m)any of them provide such information. Do they? Is this idea technically possible?
It is possible, and has been done: that's how matlab did it when it used ATLAS. Now, it is not easy, and would require some changes Basically, the solution I would see would be to have a wrapper library, to which every call would be done, and the wrapper library could "reroute" the calls to the right, dynamically loaded library. This requires several things which are not theoretically difficult, but a pain to do right (cross platform library loader, etc...) David