PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

do while loops on GPU

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Dolf



Joined: 22 Mar 2012
Posts: 100

PostPosted: Thu Oct 11, 2012 3:46 pm    Post subject: do while loops on GPU Reply with quote

Hi group,

As I always promised you to bring here all the latest challenges I have moving fortran codes to the next level of GPU computing as much as possible, here is a question I am willing to know the answer for:

I do have a do while loop ( do while a <= threshold )
how can I run this kind of loops into GPU? I mean how can I design the grid?? what would be the size of block I would use to parallel the task as much as I can??

many thanks.

Dolf
Mechanical Engineering,
UC Berkeley.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5952
Location: The Portland Group Inc.

PostPosted: Thu Oct 11, 2012 4:01 pm    Post subject: Reply with quote

Hi Dolf,

Quote:
I do have a do while loop ( do while a <= threshold ) how can I run this kind of loops into GPU?
You can't since the number of loop iterations must be known before entering the loop. Also, the value of "a" is most likely dependent on the previous iterations value (i.e. a is some type of accumulator) so the loop can't be parallelized.

Sometimes you can reform the while loop to be a do loop where the loop bounds is the max number of possible iterations of the while loop. Then put an if statement in loop to ignore the values above the threshold. Though, I'd need to see the loop to know if it's possible or if is simply not parallelizable.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group