Re: [accelerate-haskell] Avoiding nested parallelism

42 views
Skip to first unread message

Trevor McDonell

unread,
May 21, 2017, 12:41:22 AM5/21/17
to accelerat...@googlegroups.com

Hi Panos,

I am trying to process an Acc (Vector e) in the following way:
a) Apply take n and drop n repeatedly to get an [Acc (Vector e)].
b) Process each element (e.g. Prelude.map).
c) Join the results back together with Data.Array.Accelerate.++.

I keep running into the error "Cyclic definition of a value of type 'Acc'", which I believe is an indication of nested parallelism? My question is, is the above design itself (regardless of the particular operations) responsible for this?

Yes, this error is most commonly encountered through use of nested parallelism.

The above structure might be okay, but I wonder…

  • Where does n come from?

  • How are you controlling the list generation in Haskell-land? Be careful; you won’t be able to use any results from Accelerate-land to control this (this is perhaps one of the trickiest parts of embedded languages—-being very clear on which phase each part of your program occurs in, and not mixing the two in the wrong way (well, I guess you can do this, buy splitting your program into multiple Haskell -> run -> Haskell -> run … cycles)).

  • Probably you are processing each element of the list of Accelerate expressions in some more complex way than Prelude.map (since the rank-polymorphic operations should be able to handle this already?), but maybe there should be a way to do this in Accelerate land instead. Maybe you need a segmented operation?

And if it is: I worked around some of the above errors by using replicate and fold, but what design should one use if the operations cannot be expressed in terms of fold (e.g. some arbitrary function of all/many elements in a row)?

Could you give me a more concrete example of the kind of thing you want to do? This might help me answer the above as well, since I think I am just a bit confused…

The operators in Accelerate are all collective operations; i.e., apply some function to every element of an array in data-parallel. I vaguely feel like maybe your problem is more related to control flow (i.e. how to piece the different parts of your application together)?

P.S. How does one apply inline code markup with Google Groups? I keep getting block markup.

I’m using this plugin: http://markdown-here.com

Cheers,
-Trev

--
You received this message because you are subscribed to the Google Groups "Accelerate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelerate-hask...@googlegroups.com.
Visit this group at https://groups.google.com/group/accelerate-haskell.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages