|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
KL
Joined: 16 Nov 2009 Posts: 144
|
Posted: Mon Mar 28, 2016 4:31 pm Post subject: Error in Checkmate -.NET? |
|
|
I am using since years a program for the Cholesky Decomposition, which is incorporated in several programs. Recently I tried to run one of these programs with the compiler option Checkmate -.NET in Plato as well as in Visual Studio Community 2013. In both environments the program failed with the error message
Salford.Fortran.Checkexception: 420: Reference through NULL Fortran Pointer.
The option Checkmate-Win32 does not give this error.
I have tried to localize the problem and I ended up with the two programs, which demonstrate the problem:
Code: |
WinApp
! ##############
Program Case01
! ##############
Implicit None
! ------------------------------------------------------------------
Double Precision , Dimension (:,:), Allocatable :: A
Double Precision , Dimension (: ), Allocatable :: X, B, diag
Integer :: j, k, n, nwrite
Logical :: Fail
Double Precision :: sum
Interface
SUBROUTINE choldc (a, p, fail)
Double Precision , DIMENSION (:,:), INTENT (INOUT) :: a
Double Precision , DIMENSION (: ), INTENT (OUT) :: p
Logical , INTENT (out) :: fail
End SUBROUTINE choldc
End Interface
! ------------------------------------------------------------------
n = 3
Allocate ( A ( 1:n, 1:n ) )
Allocate ( B ( 1:n ) )
Allocate ( X ( 1:n ) )
Allocate ( diag ( 1:n ) )
! ------------------------------------------------------------------
nwrite = 10
Open ( Unit = nwrite, File = 'Case01.out' )
! --- Example for normal system
a (1,1) = 10206.0625000d+00
a (1,2) = 9.62500000000d+00
a (1,3) = 4.81250000000d+00
b ( 1) = 55.7644855000d+00
a (2,1) = 0.00000000000d+00
a (2,2) = 0.125000000000d+00
a (2,3) = 6.250000000000d-02
b ( 2) = 0.699064500000d+00
a (3,1) = 0.00000000000d+00
a (3,2) = 0.00000000000d+00
a (3,3) = 6.250000000000d-02
b ( 3) = 0.335322250000d+00
! --- Fill in below the diagonal from symmetry
Do j = 2, n
Do k = 1, j-1
A(j,k) = A(k,j)
end Do
End Do
! ------------------------------------------------------------------
! --- Calculate Cholesky factor L
! L is stored in lower triangle of A,
! except for its diagonal elements
! which are returned in diag
! ###########
Call Choldc ( A (1:n, 1:n), &
diag (1:n) , &
Fail )
! ###########
! ------------------------------------------------------------------
! ======================
if ( .not. Fail ) then
! ======================
Write ( nwrite, * )
Write ( nwrite, * ) ' Problem runs OK'
Write ( nwrite, * ) ' ###############'
Write ( nwrite, * )
Write ( * , * )
Write ( * , * ) ' Problem runs OK:'
Write ( * , * ) ' ################'
Write ( * , * )
Pause
Stop
! ++++
! ======
end if
! ======
! ##################
End Program Case01
! ##################
|
[code:1:5eb5444121]
Subrout |
|
Back to top |
|
|
KL
Joined: 16 Nov 2009 Posts: 144
|
Posted: Mon Mar 28, 2016 4:36 pm Post subject: |
|
|
I try to continue: Code: |
Subroutine choldc ( A, p, Fail )
Implicit None
Double Precision , Dimension (:,:) , Intent (inout) :: A
Double Precision , Dimension (:) , Intent (out) :: p
Logical , Intent (out) :: Fail
Logical :: HPFortran
Fail = .false.
!!! HPFortran = .false.
HPFortran = .true.
! ---------------------
If ( HPFortran ) Then
! ---------------------
Call Choldc_95
! ----
Else
! ----
Call Choldc_77
! ------
End If
! ------
! ------------------------------------------------------------------
Contains
! ------------------------------------------------------------------
SUBROUTINE choldc_77
Implicit None
! ----------------------------------------------------------------
Fail = .false.
! --- Just for formal reasons
p(1) = a(1,1)
p(2) = a(2,2)
p(3) = a(3,3)
Return
END SUBROUTINE choldc_77
Subroutine choldc_95
Implicit None
fail = .false.
! --- Just for formal reasons
p(1) = a(1,1)
p(2) = a(2,2)
p(3) = a(3,3)
Return
End Subroutine choldc_95
End Subroutine choldc
|
|
|
Back to top |
|
|
KL
Joined: 16 Nov 2009 Posts: 144
|
Posted: Mon Mar 28, 2016 4:46 pm Post subject: |
|
|
Both programs can also be run with little batch files:
a) Checkmate-Win32 (LinklistCheckmate, RunCheckmate.bat:)
Code: |
Load Case01.obj
Load choldc.obj
File Case01.exe
| and
Code: |
del comp.lis
del *.dbk
del *.obj
del *.exe
ftn95 Case01.f95 /Checkmate /Debug >> comp.lis
ftn95 Choldc.f95 /Checkmate /Debug >> comp.lis
slink LinkListCheckMate >> comp.lis
sdbg Case01.exe
|
b) Checkmate-.NET (LinkListNet, RunNet.bat; normally I do not work with batch files for .NET) Code: |
Case01.exe
Case01.dbk
choldc.dbk
| and
Code: |
del comp.lis
del *.mod
del *.dbk
del *.exe
ftn95 Case01.f95 /Checkmate /Full_Debug /clr /clr_ver 4 >> comp.lis
ftn95 Choldc.f95 /Checkmate /Full_Debug /clr /clr_ver 4 >> comp.lis
DBK_Link4 @linklistNET >> comp.lis
Case01.exe
|
Have I somewhere overlooked something?
Best regards
KL |
|
Back to top |
|
|
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Tue Mar 29, 2016 9:33 am Post subject: |
|
|
Hi KL
Nice to know that you are using the Cholesky Decomposition program. May I know the areas of application of this Cholesky algorithm, that you use. Do you also deal with the Sparse Networks (Largely zeros) and what is the speed performance of this algorithm, say for Matrix inverse calculations?
Do you have the comparative speed performances of different algorithms. _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
|
KL
Joined: 16 Nov 2009 Posts: 144
|
Posted: Tue Mar 29, 2016 12:56 pm Post subject: |
|
|
Thank you very much for your interest, Moorthy. I use the algorithm from Numerical Recipes both in FORTRAN 77 and Fortran 90. In this book you find also a comprehensive discussion of solutions of linear algebraic equations.
Best regards,
KL |
|
Back to top |
|
|
KL
Joined: 16 Nov 2009 Posts: 144
|
Posted: Tue Jun 07, 2016 10:00 am Post subject: |
|
|
The same happens with FTN95 8.0. Any ideas? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Tue Jun 07, 2016 11:54 am Post subject: |
|
|
You could use /inhibit_check 10 with /check etc.
I have not checked your code but this check relates to checking the overwriting of a DO-loop index. It might be a problem with your code or it might be a bug in the compiler. |
|
Back to top |
|
|
KL
Joined: 16 Nov 2009 Posts: 144
|
Posted: Wed Jun 08, 2016 4:08 pm Post subject: |
|
|
Thank you Paul, I will test your proposal.
The problem is
either Checkmate/Win32 overlooks an error,
or Checkmate/.NET reports an error, which is no error.
Regards, Klaus |
|
Back to top |
|
|
KL
Joined: 16 Nov 2009 Posts: 144
|
Posted: Thu Jun 09, 2016 7:53 am Post subject: |
|
|
Paul, using the option /inhibit_check 10 solves this problem. But I do not know why.
The new Plato version offers 9 different (standard) compiler options: Checkmate, Debug and Release, each combined with .NET, Win32 and x64. Only the combination Checkmate/.NET fails, all other 8 combinations succeed.
Of course the code snippet is rather nonsense, but the original 'full' code is a standard algorithm used frequently by many users. Finding a hidden or an indirect error in the program would be very helpful, the more since this "technique" is applied in other algorithms also.
Klaus |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Jun 09, 2016 9:23 am Post subject: |
|
|
The failure is probably in FTN95/.NET but I hope that you can manage by using the work-around. If a fix is critical for you work then please let me know. |
|
Back to top |
|
|
KL
Joined: 16 Nov 2009 Posts: 144
|
Posted: Thu Jun 09, 2016 1:27 pm Post subject: |
|
|
Thank you very much, Paul.
This "error" (if it is an error at all) is not critical for me. Please inform me, if something is questionable in my program.
Klaus |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Jun 09, 2016 1:32 pm Post subject: |
|
|
OK. At the moment there is no reason to think that there is anything wrong with your code. |
|
Back to top |
|
|
KL
Joined: 16 Nov 2009 Posts: 144
|
Posted: Wed Oct 26, 2016 9:51 am Post subject: |
|
|
Paul, did anything happen with this "error"?
Best regards
KL |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Wed Oct 26, 2016 11:05 am Post subject: |
|
|
No. This is still on the list of things to do. |
|
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
|