forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is it bad ?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
pierre



Joined: 04 Feb 2007
Posts: 24

PostPosted: Tue Feb 20, 2007 4:12 pm    Post subject: Is it bad ? Reply with quote

When I run my program (51s) from Plato3 I get this.

Compiling file: HW4.f95
Compilation completed with no errors.
Linking...
Creating executable: CheckMate\Win32\HW4.exe
Access violation:
The instruction at address 0042249d attempted to read from location 0000000c
0042248e _writeDebugLineNumbers(<ptr>char,<ptr>structÄ_file,shortÄint,int) [+000f]

0042261c massageDebugSymbolTable(<ptr>structÄ_file,<ptr>char,longÄunsignedÄint) [+02d3]

0041310e writeExecutable(<ptr>char) [+11ea]

0040766a parcelUpExe(void) [+097c]

0040c049 parseCommandLine(<ptr><ptr>char) [+03ab]

0040caf4 main [+00c3]

eax=046930c5 ebx=047ac7e4 ecx=00000000
edx=04692774 esi=00000001 edi=046924a0
ebp=0370ed88 esp=0370ed34 IOPL=0
ds=0023 es=0023 fs=003b
gs=0000 cs=001b ss=0023
flgs=00010202 [NC OP NZ SN DN NV]
0360/7820 TSTK=7 [ ]
0042249d mov eax,[ecx+0xc]

004224a0 mov [ebp-0x34],eax

Linking completed.

I have to say that this does not appear when I decrease the number of operation I do (I have 2 parameters which "control" two do loops(do i=1,N....). When they are small I do not have this message)

Is it bad ?
Will the problem really disappear if I use the .exe file instead of plato ?
Will it disappear if I use a more powerful computer ?
Back to top
View user's profile Send private message
DrTip



Joined: 01 Aug 2006
Posts: 74
Location: Manchester

PostPosted: Tue Feb 20, 2007 5:55 pm    Post subject: Reply with quote

Pierre

I couldn't say for sure

but my first guess is that you are attempting to access a bit of memory you should be.

this is usually because you have got a hard limit on an array bound and by extendeding you control parameters you are goinf past the limit of the array.

but I am guessing

try debugging in FULL DEBEUG which checks array bounds.


this will probably highlight an buggette in your code somewhere

I am not close enough to the debugger to interpret all the messgages without the actual code to guide me

Paul might be

Carl
Back to top
View user's profile Send private message
pierre



Joined: 04 Feb 2007
Posts: 24

PostPosted: Tue Feb 20, 2007 6:20 pm    Post subject: Reply with quote

I have tried to debug with "checks array bounds". When the debugger open I get a red sign: "access violation.......". When I close it, the debugger closes.

I get my results (3 .txt files at the end) with data in it. But are they right ? I do not know.

Here is the program (Finite difference with ABC)

PROGRAM test

integer j,N,time,l
Real*8 c,Pi,dt,dx,a,b,si,ti
parameter (c=299792458.0_2)
parameter (Pi=3.14159265358979323846)
parameter (time=8001) !you can try time=801
parameter (N=6004) ! you can try N=604
REAL*8, DIMENSION(0:N-1,-1:time) :: Phi
!Phi(position,time)=Phi(i,j) time=0 => t=0s
REAL*8, DIMENSION(0:N-1,1:5) :: Y
REAL*8, DIMENSION(0:N-1) :: X
REAL*8, DIMENSION(0:N-1,1:5) :: An
REAL START,FINISH

!beginning of the calculus
CALL CLOCK@(START)

dt=1.0/(20.0E9)_2
dx=c/(10.0E9)_2
b=c**2*dt**2/dx**2_2
a=2.0*(1.0_2-b)
si=3.0/(2.0*Pi*1.0E9)_2

!analytical solution
An(1,:)=0.0_2
Do j=0,N-1
x(j)=j*dx
end do
do l=1,5
ti=l*dt*1600.0_2 ! you can try ti=l*dt*160.0_2
An(:,l)=exp(-1.0/2.0*(((ti-x(:)/c)/si)-8.0_2)**2)
end do

Phi(:,-1:0)=0.0_2

!Absorbing boundary condition.
Do j=1,time
t=j*dt
Phi(0,j)=exp(-1.0/2.0*((t/si)-8.0_2)**2)
Phi(1:N-2,j)=-Phi(1:N-2,j-2)+a*Phi(1:N-2,j-1)+b*(Phi(2:N-1,j-1)+Phi(0:N-3,j-1))
Phi(N-1,j)=Phi(N-2,j-1)-1.0_2/3.0_2*(Phi(N-2,j)-Phi(N-1,j-1))
end do

!end of the calculus
CALL CLOCK@(FINISH)
PRINT *,'seconds used = ',FINISH-START

y(:,1)=Phi(:,1600) ! you can try y(:,1)=Phi(:,160)
y(:,2)=Phi(:,3200) ! you can try y(:,2)=Phi(:,320)
y(:,3)=Phi(:,4800) ! you can try y(:,3)=Phi(:,480)
y(:,4)=Phi(:,6400) ! you can try y(:,4)=Phi(:,640)
y(:,5)=Phi(:,8000) ! you can try y(:,5)=Phi(:,800)

!output to a .txt file
OPEN (UNIT=5,FILE='X.txt')
write(5,*) x
Close(5)

!output to a .txt file
OPEN (UNIT=5,FILE='Y.txt')
write(5,*) y
Close(5)

!output to a .txt file
OPEN (UNIT=5,FILE='An.txt')
write(5,*) An
Close(5)

END PROGRAM test
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Tue Feb 20, 2007 6:37 pm    Post subject: Reply with quote

This appears to be caused by a compiler bug.

All you can do in the short term is to find the line of code that causes the error and then do the same calculation in a different way.

You may have to comment out blocks of code in order to isolate the line that is causing the problem.

If the program is short, you can post it here for me to look at.
Otherwise send me a message with your email address and I will reply with an address to send your code to.
Back to top
View user's profile Send private message AIM Address
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Wed Feb 21, 2007 2:03 am    Post subject: Reply with quote

Pierre,

You have a number of syntax problems. To the best of my knowledge,
dt=1.0/(20.0E9)_2

should be
dt=1.0_2 / 20.0D9

It would certainly be preferred.
20.0E9 implies real*4, while 20.0D9 is real*8
1.0 is real*4 while 1.0_2 or 1.0D0 is real*8, although for 0.5,1,2,3 or 8 there is no difference, unlike 0.1 which is not a power of 2.

I don't think you can have ")_2" to imply kind=2 (real*Cool

I have changed your program and use ..d0 for real*8 and also changed the write statements to put one value per line. This is just my preferred style, which you are free to ignore.
I also introduced "k" to take array syntax out of EXP. Again just my style preference.

The program ran ok using either
ftn95 pierre /debug /link
or
ftn95 pierre /check /link

It takes about 400mb of memory to run.



PROGRAM test
!
integer j,N,time,l , k
Real*8 c,Pi,dt,dx,a,b,si,ti ,t
parameter (c=299792458.0_2)
parameter (Pi=3.14159265358979323846d0)
parameter (time=8001) !you can try time=801
parameter (N=6004) ! you can try N=604
REAL*8, DIMENSION(0:N-1,-1:time) :: Phi
!Phi(position,time)=Phi(i,j) time=0 => t=0s
REAL*8, DIMENSION(0:N-1,1:5) :: Y
REAL*8, DIMENSION(0:N-1) :: X
REAL*8, DIMENSION(0:N-1,1:5) :: An
REAL START,FINISH

! beginning of the calculus
CALL CLOCK@(START)

dt = 1.0d0 / 20.0d9
dx = c / 10.0d9
b = c**2 * dt**2 / dx**2
a = 2.0d0 * (1.0d0-b)
si = 3.0d0 / (2.0d0*Pi*1.0d9)

! analytical solution
An = 0
Do j=0,N-1
x(j) = j*dx
end do
do l=1,5
ti = l *dt*1600.0d0 ! you can try ti=l*dt*160.0_2
do k = 0,n-1
An(k,l)= exp(-1.0d0/2.0d0 * (((ti-x(k)/c)/si)-8.0d0)**2 )
end do
end do

Phi(:,-1:0) = 0

! Absorbing boundary condition.
Do j=1,time
t = j*dt
Phi(0,j) = exp (-1.0d0/2.0d0*((t/si)-8.0d0)**2)
do k = 1,n-2
Phi(k,j) = -Phi(k,j-2) + a*Phi(k,j-1) + b*(Phi(k+1,j-1) + Phi(k-1,j-1))
end do
Phi(N-1,j) = Phi(N-2,j-1) - 1.0d0/3.0d0*(Phi(N-2,j) - Phi(N-1,j-1))
end do

!end of the calculus
CALL CLOCK@(FINISH)
PRINT *,'seconds used = ',FINISH-START

y = 0
y(:,1) = Phi(:,1600) ! you can try y(:,1)=Phi(:,160)
y(:,2) = Phi(:,3200) ! you can try y(:,2)=Phi(:,320)
y(:,3) = Phi(:,4800) ! you can try y(:,3)=Phi(:,480)
y(:,4) = Phi(:,6400) ! you can try y(:,4)=Phi(:,640)
y(:,5) = Phi(:,8000) ! you can try y(:,5)=Phi(:,800)

!output to a .txt file
OPEN (UNIT=5,FILE='X.txt')
do k = 0,n-1
write(5,*) k, x(k)
end do
Close(5)

!output to a .txt file
OPEN (UNIT=5,FILE='Y.txt')
do j = 1,5
do k = 0,n-1
write(5,*) j,k,y(k,j)
end do
end do
Close(5)

!output to a .txt file
OPEN (UNIT=5,FILE='An.txt')
do j = 1,5
do k = 0,n-1
write(5,*) j,k,An(k,j)
end do
end do
Close(5)

END PROGRAM test
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Wed Feb 21, 2007 10:27 am    Post subject: Reply with quote

On the face of it I can see very little wrong with this program.

Adding IMPLICIT NONE indicates that t has not been declared.
Using /CHECKMATE indicates that all values have been assigned before use.

For me the program runs to completion without any problems.

The arrays are very large but should not be a problem.

The follow statement is quite complex and I would recommend a small scale dry run to make sure that it does what you intend.

Phi(1:N-2,j)=-Phi(1:N-2,j-2)+a*Phi(1:N-2,j-1)+b*(Phi(2:N-1,j-1)+Phi(0:N-3,j-1))
Back to top
View user's profile Send private message AIM Address
pierre



Joined: 04 Feb 2007
Posts: 24

PostPosted: Wed Feb 21, 2007 3:06 pm    Post subject: Reply with quote

John;

You are right, I am a little bit confused with the precision issue but;
-Even if it is ugly what I wrote gives the good answer (I checked it)
-If use _2 all the time it is because x(1:2,1)={ 1.0D0, 2.0D0 } does not work (see the topic "Precision and FTN95")

Paul:
-I will declare t and put implicit none.
-Phi(1:N-2,j)=-Phi(1:N-2,j-2)+a*Phi(1:N-2,j-1)+b*(Phi(2:N-1,j-1)+Phi(0:N-3,j-1)) is complex but is beautiful isn't it ? (coding the Finite element difference in one line ....... Smile ). More seriously, It has been tested for some other cases, and it seems to hold. However it tooks a lot of unnecessary memory and I will not do like that next time.

I have done some tests. You can use N=6004 and t=800 without problems. I will try to run it without any checking options.

If it takes 400MB of memory it is perhaps the problem. I have just 512Mo and I am not sure 400Mo of them are free.

Anyway, thanks !
Back to top
View user's profile Send private message
pierre



Joined: 04 Feb 2007
Posts: 24

PostPosted: Wed Feb 21, 2007 11:37 pm    Post subject: Reply with quote

I have tried to close some applications and to run it without any debugger options.

=> It tooks 5 time less time and I do not have any error message.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Feb 22, 2007 2:38 am    Post subject: Reply with quote

Pierre,

The d0 format does work and is more general than _2. Try the following which demonstrates some different precision formats for real variables.

program test

real*8 :: t_2(3)
real*8 :: t_d(3)
real*8 :: t_e(3)

t_2 = (/0.5_2, 0.6_2, 0.7_2/)
write(*,*) t_2

t_d = (/0.5d0, 0.6d0, 0.7d0/)
write(*,*) t_d

t_e = (/0.5, 0.6, 0.7/)
write(*,*) t_e

end program

0.5 and 0.5e0 are the same
0.5_2 and 0.5d0 are the same
The problem with 0.5_2 is that 2 is the kind value only with Salford.
Other compilers use 8, ie 0.5_8, so the use of "2" or "8" should be avoided.

A more cumbersome form is by defining a parameter for 2, eg

integer*4, parameter :: r15 = selected_real_kind(15,0)
!
real(r15) :: x15 = 0
!
write (*,*) 'r15', r15, precision(x15), int(log10(huge(x15)))
write (*,*) 0.7_r15
end

There is also a real*10, which requires a 0.7_3 or 0.7_r18 style declaration. Real*10 is limited to Salford and is based on the old(?) 80 bit register format. I'm not sure if this is still available in Win/intel.

I hope this clarifies the issue.

John
Back to top
View user's profile Send private message
pierre



Joined: 04 Feb 2007
Posts: 24

PostPosted: Thu Feb 22, 2007 2:42 am    Post subject: Reply with quote

Yes thank you.

For those who wants to know more about precision and FTN95;
http://forums.silverfrost.com/viewtopic.php?t=742
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group