 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Mon Apr 11, 2016 6:04 am Post subject: Re: |
|
|
narayanamoorthy_k wrote: | mecej4 wrote: | I'm afraid that your code fragments add up to more lines of code than I am inclined to read line by line.
Not much can be done until you post the source codes for all the subroutines, modules and the main program plus any needed data files, and provide instructions for building and running the program in such a way that the bug can be reproduced.
The Silverfrost forum does not allow posting large amounts of code. Please zip up all the files that you need, upload the zip file to a shareable cloud storage space such as OneDrive, DropBox, Google Drive, etc., and provide a link in a post to this forum. |
Thanks mecej4. I realised this while posting my message. but before "submit"ting the post, while seeing the "Preview", it shows me the complete post preview, hence Am submitted that post.
I will follow the code sending like the way you suggested. Thanks a lot. |
Hi John, mecej4
Greetings.
I have uploaded my code in rar file in the Google Drive. Pls. find the link below.
https://drive.google.com/file/d/0B0mTpY0HUClYNmE5bFF0X2pXYjQ/view?usp=docslist_api
It consists the following:
Fortran files:
BiFact_01.f95 = Main file
Remaining f95 = associated fortran files
TestIn1a.dat = Input data file.
Just simply build it using our FTN95 and the JIT issues can be seen in .NET building the solution or this project.
Pls. let me know, if you see any issues why it is not successfully running during Runtime, when it has been built in .NET environment.
Thanks a lot in advance and for your attention. _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Tue Apr 12, 2016 3:18 am Post subject: |
|
|
Moorthy,
I have no experience with .net so am not able to advise on it's use.
My understanding of .net is that it is not suited to solution to large sets of equations, although the example size you have supplied is not large.
I did look at the code you supplied. It is not a style of code that I would use, as you have extensive use of GOTO and statement numbers.
Fortran 90 provides for CYCLE and EXIT in DO loops and IF () THEN ; ELSE constructs, which can assist with the flow of the code. However, if you prefer the use of GOTO and statement numbers, this code will still work, if the logic is correct. I changed SUBROUTINE DIRECTSOLUTIONSYMMATRIX to use some of these features (hopefully correctly) to give you an idea of a different coding approach. Others probably have different ideas that are also valid.
This should not be the source of your .net problem.
Code: | SUBROUTINE DIRECTSOLUTIONSYMMATRIX
USE globalmaster ! Inputs : NORDR, NSEQ(*), LCOL(*), LNXT(*), ITAG(*), V(*), CE(*)
INTEGER :: L, i,j,k ! variables not used KP, LK, IP, LN, LA, MIN, M,
real :: CF, SUM
! The following are not required
! KP=0
! LK=0
! IP=0
! LN=0
! LA=0
! MIN=0
! M=0
!
! L=0
! CF=0.
! SUM=0.
DO J = 1,NORDER
K = NSEQ(J)
CF = V(K)
V(K) = 0
L = LCOL(K)
DO WHILE (L > 0)
I = ITAG(L)
V(I) = V(I) + CE(L)*CF
L = LNXT(L)
END DO
END DO
DO J = (NORDER-1),1,-1
K = NSEQ(J)
SUM = V(K)
L = LCOL(K)
DO WHILE (L > 0)
I = ITAG(L)
IF ( I /= K ) SUM = SUM + CE(L)*V(I)
L = LNXT(L)
END DO
V(K) = SUM
END DO
DirectSolution = .true.
print*, 'Direction Solution just completed.....'
!!!
!!! print*, 'No. LCOL NOZE NSEQ'
!!! DO II = 1, (YMAT1SIZE) !IARRAYCOLSIZE
!!! WRITE(*,222) II,LCOL(II), NOZE(II),NSEQ(II)
!!! END DO
!!!
!!! PRINT*, 'YMAT2 MATRIX'
!!! PRINT*, 'II, ITAG, LNXT, CE'
!!! DO II = 1, (YMAT2SIZE)
!!! WRITE(*,223) II, ITAG(II), LNXT(II),CE(II)
!!! END DO
!!!
!!! 222 FORMAT(I2,' ',I3,' ',I3,' ', I3)
!!! 223 FORMAT(I2,' ',I3,' ',I3,' ',F8.2)
!!!
END SUBROUTINE DIRECTSOLUTIONSYMMATRIX
|
|
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Tue Apr 12, 2016 3:21 am Post subject: |
|
|
As I suspected, the program has bugs and is rather cluttered :
o Pointer variables are used with ALLOCATED
o The output file is opened with STATUS='OLD'
o Unit numbers 5 and 6 are used to open disk files
o Lots of lines of code that have been commented out
o Many variables are declared (and assigned values) unnecessarily.
I have cleaned up the code and placed it at
https://www.dropbox.com/s/g07ljzp2t2c9tzt/symmat.rar?dl=0
The cleaned up code can be compiled and linked either for Win32 or .NET. It runs to completion and outputs results that appear reasonable (but you must check if the results are, in fact, correct).
While cleaning up the code and attempting to run it, I found that FTN95 sometimes outputs buggy code when expressions containing UBOUND are used as indices (and, perhaps, in the loop control list of a DO construct. I have reported this bug separately ( http://forums.silverfrost.com/viewtopic.php?t=3239 ) . To side-step this bug, use a local variable, assign the UBOUND value to the local variable and use the local variable in subscript expressions and DO loop control lists. |
|
Back to top |
|
 |
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Tue Apr 12, 2016 5:05 am Post subject: Re: |
|
|
JohnCampbell wrote: | Moorthy,
I have no experience with .net so am not able to advise on it's use.
My understanding of .net is that it is not suited to solution to large sets of equations, although the example size you have supplied is not large.
I did look at the code you supplied. It is not a style of code that I would use, as you have extensive use of GOTO and statement numbers.
Fortran 90 provides for CYCLE and EXIT in DO loops and IF () THEN ; ELSE constructs, which can assist with the flow of the code. However, if you prefer the use of GOTO and statement numbers, this code will still work, if the logic is correct. I changed SUBROUTINE DIRECTSOLUTIONSYMMATRIX to use some of these features (hopefully correctly) to give you an idea of a different coding approach. Others probably have different ideas that are also valid.
|
John
Thank you very much for your time in taking my code and suggested the improved way of coding. Thanks a lot, Your ideas are very useful. In fact, I learn out of your suggestions as well.
I was focussing the logic to make it work correctly. But,I am new to FTN95 advanced features that uses fortran 90 specs. However, I will improve the code further too.
Thanks a lot and I will continue to remodel my code. Thank you _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
 |
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Tue Apr 12, 2016 5:30 am Post subject: Re: |
|
|
mecej4 wrote: | As I suspected, the program has bugs and is rather cluttered :
o Pointer variables are used with ALLOCATED
o The output file is opened with STATUS='OLD'
o Unit numbers 5 and 6 are used to open disk files
o Lots of lines of code that have been commented out
o Many variables are declared (and assigned values) unnecessarily.
I have cleaned up the code and placed it at
https://www.dropbox.com/s/g07ljzp2t2c9tzt/symmat.rar?dl=0
The cleaned up code can be compiled and linked either for Win32 or .NET. It runs to completion and outputs results that appear reasonable (but you must check if the results are, in fact, correct).
While cleaning up the code and attempting to run it, I found that FTN95 sometimes outputs buggy code when expressions containing UBOUND are used as indices (and, perhaps, in the loop control list of a DO construct. I have reported this bug separately ( http://forums.silverfrost.com/viewtopic.php?t=3239 ) . To side-step this bug, use a local variable, assign the UBOUND value to the local variable and use the local variable in subscript expressions and DO loop control lists. |
Dear mecej4
Thank you very much for your time in cleaning up my code to help me out to run them cleanly in win32 and .NET. Thanks a lot.
I will go through the code again and verify its working.
Its true that I also found the strange behaviour of UBOUND and added to that, the arrays keep the junk value which is observed in single-step debug mode, but while printing it prints the values correctly. Anyhow, I am happy that my code has helped to bring out one bug that can be fixed and improves our FTN95 compiler.
Once again, thanks a lot for your time and Ideas.. Its nice learning experience also to me to improve my code.
Thank you and John and to our forum to help me out to improve the way of the usage of FTN95. Fantastic and Amazing. A Big salute to you all and to our Forum.. Thanks a lot.. _________________ Thanks and Regards
Moorthy |
|
Back to top |
|
 |
narayanamoorthy_k
Joined: 19 Jun 2014 Posts: 142 Location: Chennai, IN
|
Posted: Tue Apr 12, 2016 2:11 pm Post subject: Re: |
|
|
John-Silver wrote: |
I'd suggest you also try downloading and installing VS Community Edition (this was mentioned in one of your other recent posts) and using the latest Personal Compiler version (which is 7.2), simply because the version of compiler is v5.4 in Express and was released a long time ago and also the cut-down VS shell used goes way back too.
|
Hi John
I just downloaded the VS Community 2013 and installed, and later reinstalled the FTN95 Personal edition. Just Establishing a better platform again to make my life easier.
As you said the VS Shell 2008 was there as part of Express. I will uninstall that also.
Thanks for your suggestions John. _________________ Thanks and Regards
Moorthy |
|
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
|