Myles C. Maxfield | 28 Mar 07:35 2013
Picon

Parallel Data.Vector.generate?

Hello all. I'm using the Data.Vector.generate function with a complicated creation function to create a long vector. Is it possible to parallelize the creation of each element?


Alternatively, if there was something like parMap for vectors, I suppose I could pass id to Data.Vector.generate and use parMap. Does something like this exist?

Thanks,
Myles C. Maxfield
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Dmitry Dzhus | 28 Mar 11:32 2013

Re: Parallel Data.Vector.generate?

28.03.2013, 10:38, "Myles C. Maxfield" <myles.maxfield <at> gmail.com>:
> Hello all. I'm using the Data.Vector.generate function with a complicated creation function to create a
long vector. Is it possible to parallelize the creation of each element?
> Alternatively, if there was something like parMap for vectors, I suppose I could pass id to
Data.Vector.generate and use parMap. Does something like this exist?

You may use computeP + fromFunction from Repa. Wrapping of vectors to
Repa arrays (and vice versa) is O(1).
Myles C. Maxfield | 28 Mar 19:20 2013
Picon

Re: Parallel Data.Vector.generate?

Thanks for this! I didn't know about Repa, and it sounds like it's exactly what the doctor ordered. I think I'll port me entire program to it!


--Myles

On Thursday, March 28, 2013, Dmitry Dzhus wrote:
28.03.2013, 10:38, "Myles C. Maxfield" <myles.maxfield <at> gmail.com>:
> Hello all. I'm using the Data.Vector.generate function with a complicated creation function to create a long vector. Is it possible to parallelize the creation of each element?
> Alternatively, if there was something like parMap for vectors, I suppose I could pass id to Data.Vector.generate and use parMap. Does something like this exist?

You may use computeP + fromFunction from Repa. Wrapping of vectors to
Repa arrays (and vice versa) is O(1).
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane