Is there any technique which can transform a dependent loop (I mean a loop in which the k-th iteration depends on the result of the previous iteration(s)) to an independent one making it a candidate for parallelization? It would be important because I have such a loop and I want to migrate it to the GPU. If it is a help, the loop is a for
loop with a-priori known iteration count.
for (int n = 1; n <= nmax; n++) {
t = nhVal;
Nv = gfft(pow(real(ifft(tile(i, N, 1) * kv)), 2));
a = E2 * v + QNv;
Na = gfft(pow(real(ifft(tile(i, N, 1) * ka)), 2));
b = E2 * v + QNa;
Nb = gfft(pow(real(ifft(tile(i, N, 1) * kb)), 2));
c = E2 * a + Q * (2 * Nb - Nv);
Nc = gfft(pow(real(ifft(tile(i, N, 1) * kc)), 2));
v = Ev + Nvf1 + 2 * (Na + Nb) * f2 + Ncf3;
if (mod(n, 100) == 0)
printf("n = %d\n", n);
if (mod(n, nplt) == 0) {
plotIdx++;
u = real(ifft(v));
}
}