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??
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.