[Numpy-discussion] Objected-oriented SIMD API for Numpy

Pauli Virtanen pav+sp@iki...
Wed Oct 21 08:14:54 CDT 2009

Wed, 21 Oct 2009 14:47:02 +0200, Francesc Alted wrote:
>> Do you have any interest in adding SIMD to some core numpy
>> (transcendental functions). If so, I would try to go back to the
>> problem of runtime SSE detection and loading of optimized shared
>> library in a cross-platform way - that's something which should be done
>> at some point in numpy, and people requiring it would be a good
>> incentive.
> I don't personally have a lot of interest implementing this for numpy. 
> But in case anyone does, I find the next library:
> http://gruntthepeon.free.fr/ssemath/
> very interesting.  Perhaps there could be other (free)
> implementations...

Optimized transcendental functions could be interesting. For example for 
tanh, call overhead is overcome already for ~30-element arrays.

Since these are ufuncs, I suppose the SSE implementations could just be 
put in a separate module, which is always compiled. Before importing the 
module, we could simply check from Python side that the CPU supports the 
necessary instructions. If everything is OK, the accelerated 
implementations would then just replace the Numpy routines.

This type of project could probably also be started outside Numpy, and 
just monkey-patch the Numpy routines on import.

Pauli Virtanen

More information about the NumPy-Discussion mailing list