- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have been able to parallelize (with a bit of help) about 80% of an old-ish F77
code and now the remaining odd bits have begun to appear more noticeable in
the running of the code.
In trying to parallelize the remaining bits which involve dissimilar tasks, I use
the SECTIONS construct. The work array allocations return non-zero status flags.
I wonder if anyone has any ideas on why this occurs.
The OS is OpenSuse 11.1 64 and the compiler ifort 11.0. The command line is
ifort -O3 -openmp -fpp -parallel
In the short extract from the code below, all error flags are returned non zero.
In serial mode this runs fine. The arrays being allocated are work arrays and
are relatively small.
[plain] REAL*8, Allocatable :: WL1(:), WL2(:), WL3(:), WL4(:)
...
!$OMP PARALLEL SECTIONS DEFAULT(SHARED)
!$OMP+ PRIVATE(WL1,WL2,WL3,WL4,IERR1,IERR2,IERR3,IERR4)
c - N1P2 = 66
allocate( WL1(4*N1P2), STAT = IERR1 )
allocate( WL2(4*N1P2), STAT = IERR2 )
allocate( WL3(4*N1P2), STAT = IERR3 )
allocate( WL4(4*N1P2), STAT = IERR4 )
IF(IERR1.ne.0 .OR. IERR2.ne.0 .OR. IERR3.ne.0 .OR. IERR3.ne.0)Then
Write(6,*)' ** ERROR: IERR1, IERR2, IERR3, IERR4 = ',
. IERR1, IERR2, IERR3, IERR4
STOP '-Allocation'
End If
!$OMP SECTION
stuff
deallocate(WL1)
deallocate(WL2)
deallocate(WL3)
deallocate(WL4)
!$OMP END PARALLEL SECTIONS
Suggestions?
Thanks.
--
[/plain]
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
well, i am also a beginner and you may not consider me seriously, but 1 point that i can see is it is more easier to allocate and deallocate arrays outside the parallel region.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[cpp]!$OMP PARALLEL SECTIONS DEFAULT(SHARED)
!$OMP+ PRIVATE(WL1,WL2,WL3,WL4,IERR1,IERR2,IERR3,IERR4)
c - N1P2 = 66
allocate( WL1(4*N1P2), STAT = IERR1 )
allocate( WL2(4*N1P2), STAT = IERR2 )
allocate( WL3(4*N1P2), STAT = IERR3 )
allocate( WL4(4*N1P2), STAT = IERR4 )
IF(IERR1.ne.0 .OR. IERR2.ne.0 .OR. IERR3.ne.0 .OR. IERR3.ne.0)Then
Write(6,*)' ** ERROR: IERR1, IERR2, IERR3, IERR4 = ', &
IERR1, IERR2, IERR3, IERR4
STOP '-Allocation'
End If
stuff for section 1
deallocate(WL1)
deallocate(WL2)
deallocate(WL3)
deallocate(WL4)
!$OMP SECTION
c - N1P2 = 66
allocate( WL1(4*N1P2), STAT = IERR1 )
allocate( WL2(4*N1P2), STAT = IERR2 )
allocate( WL3(4*N1P2), STAT = IERR3 )
allocate( WL4(4*N1P2), STAT = IERR4 )
IF(IERR1.ne.0 .OR. IERR2.ne.0 .OR. IERR3.ne.0 .OR. IERR3.ne.0)Then
Write(6,*)' ** ERROR: IERR1, IERR2, IERR3, IERR4 = ', &
IERR1, IERR2, IERR3, IERR4
STOP '-Allocation'
End If
stuff for section 2
deallocate(WL1)
deallocate(WL2)
deallocate(WL3)
deallocate(WL4)
!$OMP SECTION
c - N1P2 = 66
allocate( WL1(4*N1P2), STAT = IERR1 )
allocate( WL2(4*N1P2), STAT = IERR2 )
allocate( WL3(4*N1P2), STAT = IERR3 )
allocate( WL4(4*N1P2), STAT = IERR4 )
IF(IERR1.ne.0 .OR. IERR2.ne.0 .OR. IERR3.ne.0 .OR. IERR3.ne.0)Then
Write(6,*)' ** ERROR: IERR1, IERR2, IERR3, IERR4 = ', &
IERR1, IERR2, IERR3, IERR4
STOP '-Allocation'
End If
stuff for section 3
deallocate(WL1)
deallocate(WL2)
deallocate(WL3)
deallocate(WL4)
!$OMP SECTION
...
!$OMP END PARALLEL SECTIONS
[/cpp]
Jim Dempsey- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you.
The problem persists. The single SECTION construct below still
returns non-zero status flags.
[plain]!$OMP PARALLEL SECTIONS DEFAULT(SHARED)
!$OMP+ PRIVATE( WL1,WL2,WL3,WL4, IERR1,IERR2,IERR3,IERR4 )
allocate( WL1(4*N1P2), STAT = IERR1 )
allocate( WL2(4*N1P2), STAT = IERR2 )
allocate( WL3(4*N1P2), STAT = IERR3 )
allocate( WL4(4*N1P2), STAT = IERR4 )
IF(IERR1.ne.0 .OR. IERR2.ne.0 .OR. IERR3.ne.0 .OR. IERR3.ne.0)Then
Write(6,*)' ** ERROR: IERR1, IERR2, IERR3, IERR4 = ',
. IERR1, IERR2, IERR3, IERR4
STOP '-Allocation'
End If
calculating stuff here
deallocate(WL1)
deallocate(WL2)
deallocate(WL3)
deallocate(WL4)
!$OMP END PARALLEL SECTIONS
[/plain]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is likely that the unallocated array descriptors are a) not on the stack, and/or b) not being duplicated as uninitialized within the parallel section.
Add ", automatic" to the declaration in the subroutine.
Then add COPYIN(WL1, WL2, WL3, WL4) to the !$OMP PARALLEL statement.
i.e. copy in the unallocated array descriptor.
If that fails, then place the contents of the parallel sections into seperate subroutines and then call them (pass in any required arguments), but place the arrays WL1, WL2, WL3, WL4 in the subroutines (add the ", automatic".
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jim,
Your suggestion to create separate subroutines and use SECTION for each separate call has worked.
Thanks again. You've been of great help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - arktos
Jim,
Your suggestion to create separate subroutines and use SECTION for each separate call has worked.
Thanks again. You've been of great help.
Remember to rate the forum posts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - jimdempseyatthecove
Remember to rate the forum posts.
Oooooooooooooops! I pressed the wrong star rating in your earlier post. It does not allow me to undo it.
Can I correct it? (I put the correct rating in your later post but the previous one is still there.)
APOLOGIES JIM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks as if your corrected rating was used.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page