- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am a beginner of using OPENMP in intel fortran 90/95 program.
The following parallel routine gives "forrtl: severe (157): Program exception - access violation"
--------------------------------------------------------
! calculate the additional normal modes
!$omp parallel
!$omp do
do i = 1, tn_subst
print *, PHI(i).lambda( 1 : 4 )
end do
!$omp end do
!$omp end parallel
--------------------------------------------------------
where, PHI(:) is a derived data which is allocated and PHI(:).lambda(:) is also allocated variable.
The size of "PHI(:).lambda" is of course exceeds 4.
I look forward to getting your precious comments.
Thank you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your part code gives insufficient information given about the total code. Please submit a total source code to replicate the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Verify assumptions:
! calculate the additional normal modes !$omp parallel !$omp do do i = 1, tn_subst if(allocated(PHI(i)) then if(allocated(PHI(i).lambda) then print *, PHI(i).lambda( 1 : 4 ) else print *,'PHI(',i,').lambda not allocated' endif else print *,'PHI(',i,') not allocated' endif end do !$omp end do !$omp end parallel
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also,
How is PHI made visible to your code?
In particular: is it as a DUMMY? If so, what is the declaration?
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PHI is a derived data type.
It is declared like:
----------------------------------------------------------------------
type :: modefull_type
integer(i4b) :: nev ! number of modes
integer(i4b), allocatable :: connr_eqn(:) ! connectivity from local row
! eqn to global eqn
integer(i4b), allocatable :: connc_eqn(:) ! connectivity from local column
! eqn to generalized coefficient
! eqn
real(kp), allocatable :: lambda(:) ! eigenvalues
real(kp), allocatable :: aa(:,:)
end type
.....
allocate( PHI(0:tn_subst) )
do i = 1, tn_subst
...
allocate( PHI(i).lambda( nev1(i) ) )
...
end do
----------------------------------------------------------------------
Of course, nev1(:) is greater than 4.
After compiling and executing your code, I got the same error:
----------------------------------------------------------------------
...........
3.29670329670329 1.15384615384615 1.15384615384615
1.15384615384615
0.671962571596566 0.249678894356279 6.850377764331367E-002
5.216858879043861E-002
shell returned -1073740940
Hit any key to close this window...
----------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
jimdempseyatthecove wrote:
Verify assumptions:
! calculate the additional normal modes !$omp parallel !$omp do do i = 1, tn_subst if(allocated(PHI(i)) then if(allocated(PHI(i).lambda) then print *, PHI(i).lambda( 1 : 4 ) else print *,'PHI(',i,').lambda not allocated' endif else print *,'PHI(',i,') not allocated' endif end do !$omp end do !$omp end parallelJim Dempsey
I tried, but I got the components of PHI(i).lambda(1:4) and "error with shell return -~~".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
jimdempseyatthecove wrote:
Also,
How is PHI made visible to your code?
In particular: is it as a DUMMY? If so, what is the declaration?
Jim Dempsey
PHI is a derived data type which is defined and allocated as:
----------------------------------------------------------------------------------
type :: modefull_type
integer(i4b) :: nev ! number of modes
integer(i4b), allocatable :: connr_eqn(:) ! connectivity from local row
! eqn to global eqn
integer(i4b), allocatable :: connc_eqn(:) ! connectivity from local column
! eqn to generalized coefficient
! eqn
real(kp), allocatable :: lambda(:) ! eigenvalues
real(kp), allocatable :: aa(:,:)
end type
type(modefull_type), allocatable :: PHI(:)
...................
allocate( PHI(0:tn_subst) )
..................
allocate( PHI(i).lambda( nev1(i) ) )
------------------------------------------------------------------------------------
where the components of nev1(:) are greater than 4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What you listed above is what you assume you know is happening in the program and further what you assume you know is passed on to further assumptions.
The question I have is:
Did you put the asserts (test) in and run a test?
My guess is no.
In your latest code outline you have:
allocate( PHI(0:tn_subst) ) .................. allocate( PHI(i).lambda( nev1(i) ) ) ...................
In your first post you had:
do i = 1, tn_subst print *, PHI(i).lambda( 1 : 4 ) end do
Now, for me, I see an indicator for a potential error with assumptions. This potential error would have been caught (if present) to some extent my the assert (test) I recommended. Still don't see the potential for error?
The allocation of PHI is zero based indexing, nothing inherently wrong with this... as long as the rest of your code is written with this zero-based indexing in mind. The first post code used 1 based indexing (default for Fortran) as indicated by your do i=1, tn_subst.
Had the part of the code that allocates the .lambda use 1 based indexing for the PHI(i) index, then PHI(0).lambda would not be allocated. The tests I suggested would expose this (though you would have to figure out why).
Also, "print *, PHI(i).lambda(1:4)" assumes the earlier allocation was issued, and that the nev1(i) used for the allocation was not 0, and was of a size .ge. 4. Had 0 been contained in nev1(i), then no allocation been made as size is 0.
Jim Dempsey

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page