Reputation: 63
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:
!$omp parallel do reduction(+:f) private(n,m,l,i,j,k, &
!$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)) &
-dy*(abs(j-m)) &
-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
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 ( link ).
Thanks for any help/comments!
Upvotes: 1
Views: 2314
Reputation: 105
I'm using Intel Fortran compiler, but I have had a similar experience like you, segmentation fault at runtime.
In my case, the following solves the problem, which increases thread stack size. I hope this helps.
[hoge@hoge]$ ulimit -s unlimited
[hoge@hoge]$ export OMP_STACKSIZE=1g # 1GB for thread stack size
Upvotes: 1