2
$\begingroup$

I am asking this here for the possibility that someone here is familiar with OpenMP offloading. Is there some other way to parallelise Fortran array operations outside of unrolling the loops of the array operations? I know for multithreading !$omp workshare seems to work but not for target regions.

An example piece of code would be something like this:

omp target  
a(:,:) = a(:,:) + b(:,:)   
omp end target 

Which can be done by unrolling the loop:

omp teams distribute parallel do   
do i=1,10;   
  do j=1,10  
    a(i,j) = a(i,j) + b(i,j)   
  end do;   
end do;  
omp end teams distribute parallel do  

And this parallizes nicely. I would want to avoid unrolling all the array operations but that seems to be necessary

$\endgroup$
6
  • 1
    $\begingroup$ What do you mean by target regions. Could you provide a minimal working example of a loop that you want to parallelize? $\endgroup$
    – MPIchael
    Commented Jun 27, 2023 at 0:15
  • $\begingroup$ @ToukoPuro Please edit the original question. $\endgroup$ Commented Jun 27, 2023 at 14:52
  • $\begingroup$ You're probably better asking this in Stackoverflow $\endgroup$
    – Ian Bush
    Commented Jun 28, 2023 at 16:24
  • $\begingroup$ Duplicate of scicomp.stackexchange.com/questions/14337/… i believe $\endgroup$ Commented Jun 28, 2023 at 22:30
  • $\begingroup$ Im not sure if you gain anything by further unrolling. Shouldn't one division be enough to make use of multiple cores? $\endgroup$
    – MPIchael
    Commented Jul 3, 2023 at 11:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.