- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
I faced a "strange" behaviour of my Fortran program. It is MPI program of >50000 strings code.
I found that the values of array elements are dependent whether I write them by
write(*,*) 'phisuf22 = ', phisuf(ix,iy)
or not. If I make this WRITE the values of the array are those that are expected from arithmetics
used to calculate phisuf(ix,iy). If I do not make this WRITE the values are several order of
magnitude different. Of cource it is inpractical to make this WRITE only to "correct" calculations.
I guess this can be an issue of memory. I tried -check all compiler option but no error message appeared.
My compiler is Intel 12.0.
Has anybody an idea how to handle this problem?
Many thans in advance,
Victor, Moscow.
I faced a "strange" behaviour of my Fortran program. It is MPI program of >50000 strings code.
I found that the values of array elements are dependent whether I write them by
write(*,*) 'phisuf22 = ', phisuf(ix,iy)
or not. If I make this WRITE the values of the array are those that are expected from arithmetics
used to calculate phisuf(ix,iy). If I do not make this WRITE the values are several order of
magnitude different. Of cource it is inpractical to make this WRITE only to "correct" calculations.
I guess this can be an issue of memory. I tried -check all compiler option but no error message appeared.
My compiler is Intel 12.0.
Has anybody an idea how to handle this problem?
Many thans in advance,
Victor, Moscow.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which compiler options did you use? Does the error occur with optimization turned off?
How do you check the values of phisuf when there are no print statements to display those values?
Can you post a small example that captures the kind of behavior that you see?
How do you check the values of phisuf when there are no print statements to display those values?
Can you post a small example that captures the kind of behavior that you see?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I compile multiple source files as follows
mpif90 -O3 -c -fpp -module /home/users/stepanenko/ nh3dmpi/modules
par_ex.f -o /home/users/stepanenko/ nh3dmpi/objfiles/par_ex.o
The error does not occur when I exclude -O3 option.
I check values of phisuf by calling a subroutine that writes the whole array to a file.
Below is the header of my subroutine, declarations and the cycle computing
phisuf. In the cycle you see WRITE statement which "causes" the change
of phisuf values.
mpif90 -O3 -c -fpp -module /home/users/stepanenko/
The error does not occur when I exclude -O3 option.
I check values of phisuf by calling a subroutine that writes the whole array to a file.
Below is the header of my subroutine, declarations and the cycle computing
phisuf. In the cycle you see WRITE statement which "causes" the change
of phisuf values.
[fortran] SUBROUTINE SURPHN_MPI &
&(nx, ny, nx1, ny1, nchn1, verbose, &
& phisuf, dpdx10, dpdy01, tsuf, tsufi, psuf, psufi, hsuf, &
& dphsdx, dphsdy, &
& eigxy, trigsx, trigsy, &
& sipcox, simcox, sipcoy, simcoy, &
& ifax, ifay, &
& dx, dy, dxx, dyy, &
& phsout, prt)
! the following code performs the solution of the elliptic problem
! for the surface boundary condition for phis, using neuman non-
! -homogeneous boundary conditions, and integrates the hydrostatic
! equation to get phis everywhere.
!-----------------------------------------------------------------------
! re-evaluate reference state variables and compute phi at surface
! with pts prespecified
!-----------------------------------------------------------------------
use ALLOC, only : &
& r05, g
use MPI_VARIABLES, only : &
& nxs2i, nxs2e, nys2i, nys2e, &
& nxi, nxe, nyi, nye, &
& nx0i, nx1e, ny0i, ny1e, &
& xlbound, xrbound, ylbound, yrbound, &
& size_MPI, comm3d, rank_comm3d
implicit none
! include 'nh3dpa10.inc'
! common/bphi/ dphsdx(2,0:ny1),dphsdy(0:nx1,2)
! dimension hk11(0:nx1,0:ny1),hk12(0:nx1,0:ny1)
!-----------------------------------------------------------------------
! reevaluate variables of reference state from new pp(i,3)
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
! calculate bottom b.c. for phis from new surface pressure.
! solves poisson equation for surface phis, with neuman b.c.
! following williams (jfm,1969). both the diagnostic equation for
! phisuf and its lateral boundary conditions are imposed by pp.
!-----------------------------------------------------------------------
! Input/output variables
integer(4), intent(in) :: nx, ny, nx1, ny1
integer(4), intent(in) :: nchn1, verbose
real(8), intent(inout) :: phisuf(nxs2i:nxs2e,nys2i:nys2e)
real(8), intent(in) :: dpdx10(nxs2i:nxs2e,nys2i:nys2e,3:3)
real(8), intent(in) :: dpdy01(nxs2i:nxs2e,nys2i:nys2e,3:3)
real(8), intent(in) :: tsuf(nxs2i:nxs2e,nys2i:nys2e)
real(8), intent(in) :: tsufi(nxs2i:nxs2e,nys2i:nys2e)
real(8), intent(in) :: psuf(nxs2i:nxs2e,nys2i:nys2e)
real(8), intent(in) :: psufi(nxs2i:nxs2e,nys2i:nys2e)
real(8), intent(in) :: hsuf(nxs2i:nxs2e,nys2i:nys2e)
real(8), intent(inout) :: dphsdx(1:2,nys2i:nys2e)
real(8), intent(inout) :: dphsdy(nxs2i:nxs2e,1:2)
real(8), intent(inout) :: eigxy(2:nx,2:ny)
real(8), intent(inout) :: trigsx(1:nx-1), trigsy(1:ny-1)
real(8), intent(inout) :: sipcox(1:nx-1), simcox(1:nx-1)
real(8), intent(inout) :: sipcoy(1:ny-1), simcoy(1:ny-1)
integer(4), intent(inout) :: ifax(1:10), ifay(1:10)
real(8), intent(in) :: dx, dy, dxx, dyy
logical, intent(in) :: phsout, prt
! Local variables
integer(4) :: ix, iy
integer(4) :: i0, j0
integer(4) :: k19
integer(4) :: isend
real(8), allocatable :: hk11(:,:), hk12(:,:)
real(8) :: phsfco
real(8) :: tk
do iy = max(nyi,2), nye ! 2, ny
do ix = max(nxi,2), nxe ! 2, nx
phisuf(ix,iy) = -r05*( &
& (dpdx10(ix,iy,3)*(tsuf(ix+1,iy)/psuf(ix+1,iy)+tsuf(ix,iy) &
& /psuf(ix,iy)) &
& -dpdx10(ix-1,iy,3)*(tsuf(ix,iy)/psuf(ix,iy)+tsuf(ix-1,iy) &
& /psuf(ix-1,iy)))/dx &
& +(dpdy01(ix,iy,3)*(tsuf(ix,iy+1)/psuf(ix,iy+1)+tsuf(ix,iy) &
& /psuf(ix,iy)) &
& -dpdy01(ix,iy-1,3)*(tsuf(ix,iy)/psuf(ix,iy)+tsuf(ix,iy-1) &
& /psuf(ix,iy-1)))/dy)
! THIS OUTPUT CAUSES CHANGE OF PHISUF VALUE
! if (ix == 2 .and. iy == 2) write(*,*) 'phisuf22 = ', phisuf(ix,iy)
enddo
enddo[/fortran]
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