I really like Repa
's interface, even regardless of its concurrency capabilities. And I actually need repa's arrays to be sequential, since my arrays are relatively small ones and parallelization on them is useless, even harmful.
However I do use parallelization in my program with parallel-io, so I compile it -threaded
and run with +RTS -Nx
. And this enables parallelization for repa. Is there a way to turn off repa's concurrency features?
Hm, while writing this I understood that it is unlikely I will need anything other then DIM1
, so maybe I should switch to Vector
. But nevertheless the answer to the question will be useful.
The warning message I get with parallel run is
Data.Array.Repa: Performing nested parallel computation sequentially.
You've probably called the 'force' function while another instance was
already running. This can happen if the second version was suspended due
to lazy evaluation. Use 'deepSeqArray' to ensure that each array is fully
evaluated before you 'force' the next one.
I actually have no force
in my code.
Use the development version of Repa 3 from http://code.ouroborus.net/repa/repa-head. It has a version of "force" (how called computeS) that will evaluate the array sequentially.
Repa does not automatically sequentialise operations on small arrays. With (map f xs) the runtime depends as much on what 'f' is doing as the size of 'xs'. Repa does not attempt to work out what the 'f' is doing (that would be hard), so it doesn't know how expensive the computation will be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With