Note that there are some explanatory texts on larger screens.

plurals
  1. POFortran 90/95 OpenMP reduction with an array (sum)
    text
    copied!<p>I'm working on adding some OpenMP directives to a large set of fairly expensive nested loops. I believe I need to use a reduction clause with my directive since the operations on the array on not necessarily independent. However, when attempting to add the reduction directive my application core dumps (but does compile). I'm using IBM's XL Fortran compiler enabled with OpenMP 3.0. My (simplified) code is below:</p> <pre><code>!$omp parallel do reduction(+:f) private(n,m,l,i,j,k, &amp; !$omp parm,ista,iend,jsta,jend,ksta,kend) do n=1,lm !k do m=1,jm !j do l=1,im !i if (val(l,m,n) .ne. zero) then jsta=max j bounds in box jend=min j bounds in box ista=max i bounds in box iend=min i bounds in box ksta=min k bounds in box kend=max k bounds in box do k=ksta,kend do j=jsta,jend do i=ista,iend parm = exp( -dx*(abs(i-l)) &amp; -dy*(abs(j-m)) &amp; -dz*(abs(k-n))) f(i,j,k) = f(i,j,k)+ val(l,m,n) * parm end do end do end do end if end do end do end do </code></pre> <p>Where f has dimension (im,jm,lm). Is this simply an issue of syntax? I've been trying this out on several smaller, toy problems but I'm having trouble getting what I learn with a smaller test to apply in this context. For reference purposes I asked a similar question a few months back but the problem has changed slightly since then and I don't believe the solution is as straightforward now ( <a href="https://stackoverflow.com/questions/6257887/openmp-f90-95-nested-do-loops-problems-getting-improvement-over-serial-impleme" title="link">link</a> ).</p> <p>Thanks for any help/comments!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload