Paul, I understand.
Please find below two little test programs for those problems, which I can condense and send out:
Test98 gives for .NET Checkmate 'error 431: Active Do-loop index altered'. It is bad programming anyhow but it should not lead to an error
.
Program Test98
Implicit None
Integer :: abc, i, xyz, n
xyz = 0; n = 10
do i = 1,n
xyz = xyz + i
end do
call a
write (*,*) ' xyz = ', xyz
write (*,*) ' abc = ', abc
read (*,*)
contains
subroutine a
abc = xyz
do i = 1, n
abc = abc + i
end do
end Subroutine a
End Program Test98
Test99 runs successfully for Win31 and x64, but fails for .NET around timestep 230 (“Salford.Fortran.RuntimeException: 199: Run out of heap space”. This depends of course on heap space settings, but since the arrays are allocated only once, there should not be any space problems at all.
.
Module datatypes
Integer , Parameter :: i4b = Selected_int_kind (9)
Integer , Parameter :: i2b = Selected_int_kind (4)
Integer , Parameter :: i1b = Selected_int_kind (2)
Integer , Parameter :: sp = Kind (1.0)
Integer , Parameter :: dp = Kind (1.0d0)
Integer , Parameter :: xp = Selected_real_kind (18,99)
Integer , Parameter :: lgt = Kind (.true.)
End Module Datatypes
Module CommonData
Use DataTypes
Implicit None
Real (dp), Dimension (:,: ), Allocatable , Save :: vec
Real (dp), Dimension (:,:,:), Allocatable , Save :: mat
End Module CommonData
Module Interfaces
Interface
Subroutine A ( Iter , &
x_new , &
x_old , &
F_new , &
F_old , &
B_m1 )
Use DataTypes
Implicit None
Integer (i4b), Intent (in) :: Iter
Real (dp) , Dimension (:) , Intent (inout) :: x_new, &
x_old, &
F_old
Real (dp) , Dimension (:) , Intent (in) :: F_new
Real (dp) , Dimension (:,:) , Intent (inout) :: B_m1
End Subroutine A
End Interface
End Module Interfaces
Program Test99
Use DataTypes
Use CommonData
Use Interfaces
Implicit None
Integer (i4b) lb, ub, iter, i
lb = 3
ub = 851
Call Prepare
do i = 1, 2000
iter = i
vec = 0.0d+00
mat = 0.0d+00
Call A ( iter , &
vec ( lb :ub , 1 ) , &
vec ( lb :ub , 2 ) , &
vec ( lb :ub , 3 ) , &
vec ( lb :ub , 4 ) , &
mat ( lb :ub , lb :ub , 1 ) )
write (*,*) ' iter, vec, mat = ', iter, vec (lb, 1), mat (lb, lb, 1)
end do
write (*,*) 'end reached'
read (*,*)
End Program Test99
Subroutine A ( Iter , &
x_new , &
x_old , &
F_new , &
F_old , &
B_m1 )
Use DataTypes
Implicit None
Integer (i4b), Intent (in) :: Iter
Real (dp) , Dimension (:) , Intent (inout) :: x_new , &
x_old , &
F_old
Real (dp) , Dimension (:) , Intent (in) :: F_new
Real (dp) , Dimension (:,:) , Intent (inout) :: B_m1
x_new = 1.d+00
B_m1 = 0.1d+00
End Subroutine A
.
Subroutine Prepare
Use DataTypes
Use CommonData
Implicit None
Integer (i4b) :: nDim = 1000
Allocate ( vec (1:nDim, 1:4 ) )
Allocate ( mat (1:nDim, 1:nDim, 1:3 ) )
! --- Initialize matrices
vec = 0.0d+00
mat = 0.0d+00
End Subroutine Prepare
Klaus