How to "convert" nested loops into code taking advantage of parallel computing?
Let's say you want to iterate over a,b,c,d each ranging from 0..99.  There are two ways to do that.

Approach #1: fewer nested loops

Set up a 100x100 grid, which will handle a,b.  Handle c,d by explicit nested loops:

treatPixel(a,b):
for c in 0..99:
    for d in 0..99:
        doSomething(a,b,c,d)


Approach #2: bigger grid

Set up a 10,000x10,000 grid.  Then decode the x-coordinate to a,b and the y-coordinate to c,d, like this:

treatPixel(x,y):
a := floor(x/100); b := x mod 100
c := floor(y/100); d := y mod 100
doSomething(a,b,c,d)


Which to choose?

Either one should work.

Assuming the number of iterations greatly exceeds the number of compute elements in the GPU, the difference between the two probably comes down to different memory locality effects.  You can try implementing both of them, benchmarking, and seeing if one is faster.  If there is little or no memory access and doSomething() is compute-bound, they'll probably both run at about the same speed.