Dag Sverre Seljebotn wrote: > Stefan Behnel wrote: >>> Ah, so all you really want is a SIMD data type, right? > > Right :-) Now linear algebra support in the compiler *would* be taking > things quite overboard (and probably only slow things down, unless N is > really small, like 4x4 3D game matrices...), I'm actually against that. > >> ... which would then also support parallel operations as in >> >> some_int_array *= 2 >> >> to multiply all entries by two, and > > That's actually an example in the CEP :-)
Yes, and I skipped over it because that was a tiny section titled "numerical calculations". It was far from obvious to me that that was the main point of the proposal. >> some_float_array = math.sqrt(some_int_array) >> >> to take the square-root of all entries in parallel? > > Well, the issue here is function namespaces -- do we "misuse" the Python > library like this? I was more thinking of math.h here, i.e. C functions. > But the idea -- certainly. At least it should be easy > to call C stdlib's sin in parallell on a double array. > > And it should be possible to create custom functions to call in > parallel, either by > > cdef extern from "stdlib.h": > double sin(double) > cdef myfunc(double x): ... > myfunc(sin(arr)) # SIMD, by convention, as we know they > # take single element Are you sure you always know where the parallelism ends? > or, if people think that is too magic, by a decorator: > > cdef extern from "stdlib.h": > @cython.array.elementwise > double sin(double) > @cython.array.elementwise > cdef myfunc(double x): ... Not if we can avoid it in any way. > I suggest we deal with this particular issue much later though -- for > now it's nice to have a roadmap and figure out the syntax for > concatenateable vs. SIMD, but any actual work on componentwise > operations will happen after everything else works. I don't have the impression that this proposal is accepted yet. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
