|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
KL Guest
|
Posted: Fri Dec 22, 2006 10:18 am Post subject: Error 429 with Matmul: |
|
|
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 (, 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 (, 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
|
Posted: Tue Jan 23, 2007 1:06 pm Post subject: |
|
|
Has anyone analysed the problem yet?
Best regards
Klaus Lassmann |
|
Back to top |
|
|
KL Guest
|
Posted: Tue Feb 27, 2007 1:27 pm Post subject: |
|
|
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: 7925 Location: Salford, UK
|
Posted: Tue Feb 27, 2007 3:49 pm Post subject: |
|
|
Klaus
We have not managed to investigate your problem yet.
It is in the queue.
Regards
Paul |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Wed Feb 28, 2007 2:26 am Post subject: |
|
|
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 (, 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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Feb 28, 2007 10:53 am Post subject: |
|
|
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 |
|
|
|
|
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
|