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

Gregor Thalhammer gregor.thalhammer@gmail....
Wed Oct 21 11:38:10 CDT 2009


Pauli Virtanen schrieb:
> Wed, 21 Oct 2009 14:47:02 +0200, Francesc Alted wrote:
> [clip]
>
>>> 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.
>
I once wrote a module that replaces the built in transcendental
functions of numpy by optimized versions from Intels vector math
library. If someone is interested, I can publish it. In my experience it
was of little use since real world problems are limited by memory
bandwidth. Therefore extending numexpr with optimized transcendental
functions was the better solution. Afterwards I discovered that I could
have saved the effort of the first approach since gcc is able to use
optimized functions from Intels vector math library or AMD's math core
library, see the doc's of -mveclibabi. You just need to recompile numpy
with proper compiler arguments.

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


More information about the NumPy-Discussion mailing list