Parallel for loop in freefem

Hi,

Is there any easy way to run a for loop in parallel in FreeFem++?

For example the majority of code below could be run in parallel:

int N = 1e6;
real[int] a(N), b(N);

// This loop could be parallel:
for (int i = 0; i < N; i++) {
  a(i) = i;
  b(i) = -i;
}

real[int] c(N);
// Also this could be parallel:
for (int i = 0; i < N; i++) {
  c(i) = a(i) - b(i);
}

you can use MPI and run each loop on a proc

Are there any simple examples on that?

1 Like