Answer the question
In order to leave comments, you need to log in
How to parallelize a nested loop?
There is a code:
for (j = 1; j <= p; j++) {
//Для всех индексов j = 1..p
for (k = -q; k <= q; k++) {
//и k = -q..q вычисляем значение свертки
double sum = 0;
for (i = -q; i <= q; i++) {
//сумма по i = -q..q
sum += (filterWb(k, i) * G[j - 1][i + q]);
}
V[j - 1][k + q] = h * sum;
}
}
Answer the question
In order to leave comments, you need to log in
Poidei can parallelize the calculation of the sum. We divide the interval i...q into n parts and calculate n sums for these sections in different flows (optionally in n). Then we sum them up and continue the calculations further.
You can try to parallelize something else, but this part will be simpler, I think.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question