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 

Error 429 with Matmul:

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





PostPosted: Fri Dec 22, 2006 10:18 am    Post subject: Error 429 with Matmul: Reply with quote

Dear Paul,

The following program calculates the outer product
of matrix_d and matrix_c. Matrix_c is obtained by
matrix_a * matrix_b. The program shows two versions:
one works correctly (commented out) and one fails with
error number 429: Internal Error: Stack pointer
corrupt.

I cannot see an error in the program. In your
last comment to the “WHERE Problem” you mentioned
that if a nonelemental function is referenced in an
expression, then the function is fully evaluated.
In my opinion this is here the case.

I have run the program with FTN95 Version 5.0
and a bat file:

del comp.lis
del *.obj
del *.exe

ftn95 Utilities.f95 /Checkmate >> comp.lis
ftn95 Matmul03.f95 /Checkmate /underflow /Link >> comp.lis

sdbg Matmul03.exe



The program is:

Winapp

Program Matmul03

Use Utilities

Implicit None
Integer , Parameter :: Dim = 4

Real , Dimension (Dim) :: matrix_a
Real , Dimension (Dim,Dim) :: matrix_b
Real , Dimension (Dim) :: matrix_c
Real , Dimension (Dim) :: matrix_d
Real , Dimension (Dim,Dim) :: matrix_e

Integer :: j = 3
Integer :: k = 2
Integer :: m = 3

matrix_a = 2.
matrix_b = 3.

matrix_d = 4.

matrix_c (:k) = Matmul ( matrix_a (:m), matrix_b (:m,:k) )

! This statement works:

! matrix_e (:j,:k) = outerprod ( matrix_d (:j), matrix_c (:k) )

! This statement leads to error 429:
! "Internal Error: Stack pointer corrupt

matrix_e (:j,:k) = outerprod ( matrix_d (:j), &
Matmul ( matrix_a (:m), matrix_b (:m,:k) ) )

Write (*,*) matrix_e (:j,:k)

End Program Matmul03



Module Utilities

Contains

! Function outerprod (a,b)
! Real , Dimension (Smile, Intent (IN) :: a,b
! Real , Dimension ( size (a), size (b) ) :: outerprod

! outerprod = spread(a,dim=2,ncopies=size(b)) * &
! spread(b,dim=1,ncopies=size(a))
! End Function outerprod


Function outerprod (a,b)
Implicit none
Real , Dimension (Smile, Intent (in) :: a,b
Real , Dimension ( size (a), size (b) ) :: outerprod

Integer :: i, j

Do i = 1, size (a)
Do j = 1, size (b)
outerprod (i,j) = a (i) * b (j)
End Do
End Do
End Function outerprod

End Module Utilities
Back to top
KL
Guest





PostPosted: Tue Jan 23, 2007 1:06 pm    Post subject: Reply with quote

Has anyone analysed the problem yet?
Best regards
Klaus Lassmann
Back to top
KL
Guest





PostPosted: Tue Feb 27, 2007 1:27 pm    Post subject: Reply with quote

Paul, what do I have to do to receive an answer?
Best regards, Klaus
Back to top
PaulLaidler
Site Admin


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

PostPosted: Tue Feb 27, 2007 3:49 pm    Post subject: Reply with quote

Klaus

We have not managed to investigate your problem yet.
It is in the queue.

Regards

Paul
Back to top
View user's profile Send private message AIM Address
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Wed Feb 28, 2007 2:26 am    Post subject: Reply with quote

KL,

try the following change to your program.
I don't know why you tried to make your function call so complex ?
Try the KISS principal.

regards John

Module Utilities

Contains

! Function outerprod (a,b)
! Real , Dimension (, Intent (IN) :: a,b
! Real , Dimension ( size (a), size (b) ) :: outerprod

! outerprod = spread(a,dim=2,ncopies=size(b)) * &
! spread(b,dim=1,ncopies=size(a))
! End Function outerprod


Function outerprod (a,b)
Implicit none
Real , Dimension (Smile, Intent (in) :: a,b
Real , Dimension ( size (a), size (b) ) :: outerprod

Integer :: i, j

Do i = 1, size (a)
Do j = 1, size (b)
outerprod (i,j) = a (i) * b (j)
End Do
End Do
End Function outerprod

End Module Utilities

Program Matmul03

Use Utilities

Implicit None
Integer , Parameter :: Dim = 4

Real , Dimension (Dim) :: matrix_a
Real , Dimension (Dim,Dim) :: matrix_b
Real , Dimension (Dim) :: matrix_c
Real , Dimension (Dim) :: matrix_d
Real , Dimension (Dim,Dim) :: matrix_e

integer , Dimension (Dim) :: size_matrix_c
integer :: rank_matrix_c

Integer :: j = 3
Integer :: k = 2
Integer :: m = 3

matrix_a = 2.
matrix_b = 3.

matrix_d = 4.

matrix_c (:k) = Matmul ( matrix_a (:m), matrix_b (:m,:k) )
!
size_matrix_c = 0
size_matrix_c = shape(Matmul ( matrix_a (:m), matrix_b (:m,:k) ) )
write (*,*) 'size_matrix_c', size_matrix_c

rank_matrix_c = size (shape(Matmul ( matrix_a (:m), matrix_b (:m,:k) ) ) )
write (*,*) 'rank_matrix_c', rank_matrix_c

! This statement works:

! matrix_e (:j,:k) = outerprod ( matrix_d (:j), matrix_c (:k) )

! This statement leads to error 429:
! "Internal Error: Stack pointer corrupt

! matrix_e (:j,:k) = outerprod ( matrix_d (:j), &
! Matmul ( matrix_a (:m), matrix_b (:m,:k) ) )

! Write (*,*) matrix_e (:j,:k)

End Program Matmul03
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 28, 2007 10:53 am    Post subject: Reply with quote

Klaus

I have had a quick look at your program and I can see that it fails to run when using /CHECK. In the short term you could either avoid using /CHECK or you could simplify the line that causes the problem.

Basically I think it will always be possible to get FTN95 to fail (particularly when using the checking options) if you make an expression sufficiently complex (I don't know whether to blame FTN95 or the breadth and looseness of the Fortran 90 standard). I am happy to put these problems into a queue but of necessity we have to focus on the more elementary issues.
Back to top
View user's profile Send private message AIM Address
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