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 

FTN95 compile error
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Salvador



Joined: 25 Aug 2020
Posts: 9

PostPosted: Wed Aug 26, 2020 5:59 pm    Post subject: FTN95 compile error Reply with quote

I am brand new to Fortran. I was handed down a large file with Fortran code.
It compiles fine if I use a different compiler (g95), however, it won't compile using FTN95. My file has the .f extension instead of .f95 extension.
On the command line I run: g95 myfile.f -o myfile.exe and compiles creating myfile.exe but using plato interface I get many warnings which later turns into an error like this:
A REAL constant has been truncated with possible loss of precision - maybe a KIND is required

If I use the command prompt within Silverfrost and type:
FTN95 myfile.f I get the same errors.
Can anyone give me a hint on how to run myfile.f in plato?
I can provide the myfile.f upon request but it is really large.
I have an image of the plato errors and warnings here:
https://login.filesanywhere.com/fs/v.aspx?v=8c6a6b875d5e70ad6c9d
Thanks for your help


Last edited by Salvador on Wed Aug 26, 2020 6:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2174
Location: Yateley, Hants, UK

PostPosted: Wed Aug 26, 2020 6:09 pm    Post subject: Reply with quote

It sounds like the source code is in fixed format, and the .f extension implies that it is free format (or vice versa, I forget). You should have a look at the file and see which it is. Then you might have some luck by changing the file extension (say to ,for for fixed format), using a command line parameter to specify the file format, or making a setting in Plato (or a configuration option for FTN95).

Good luck.

Eddie
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2174
Location: Yateley, Hants, UK

PostPosted: Wed Aug 26, 2020 6:12 pm    Post subject: Reply with quote

Or, on second thoughts, it might be because your default real type is 4 bytes. You can change that to 8 bytes in a variaety of ways: one is to put the OPTIONS (DREAL) directive at the front of the source code (or on the command line, through a setting etc etc)

E
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1414

PostPosted: Wed Aug 26, 2020 6:12 pm    Post subject: Reply with quote

There is a line limit of about 100 lines on posts. For large files, it is best to zip the file, upload the zip to your cloud storage (Google Drive, Microsoft Onedrive, Dropbox, etc.), make the uploaded file "shared", and post a link to that shared cloud file.

You do not need to use Plato, unless you are familiar with it and like to use the facilities that it provides. Open a command window, run the Silverfrost provided batch file FVARS.BAT, and you can then compile and link your source file from the command window.

Note that a source file suffix of .f signifies fixed source format and .f90 signifies free format Fortran source. FTN95 also accepts the suffix .f95.
Back to top
View user's profile Send private message
Salvador



Joined: 25 Aug 2020
Posts: 9

PostPosted: Wed Aug 26, 2020 6:14 pm    Post subject: Reply with quote

Eddie: I have no idea how to do that Very Happy
Back to top
View user's profile Send private message
Salvador



Joined: 25 Aug 2020
Posts: 9

PostPosted: Wed Aug 26, 2020 6:18 pm    Post subject: Reply with quote

I will try to post my file and send the link as suggested. In the meantime, can you explain a bit more how to use FVARS.BAT?
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1414

PostPosted: Wed Aug 26, 2020 7:57 pm    Post subject: Reply with quote

Open a command window (I assume that you know how to do this. If not, stop here.)

Change to the drive and directory containing the FTN95 installation. Type "fvars", and the batch file will be run and the environment set up for Fortran development.

Change to the working directory where your source file of interest (dsibm_master2.f ?) is located. Compile it with the command

ftn95 dsibm_master2.f

If the file gets compiled with no errors, link the program:

slink dsibm_master2.obj

Run the program

dsibm_master2
Back to top
View user's profile Send private message
Salvador



Joined: 25 Aug 2020
Posts: 9

PostPosted: Wed Aug 26, 2020 11:29 pm    Post subject: Reply with quote

I followed all the steps but when I try to compile I get the same error described above. I will zip up the file and post it in a bit. It is a really large file.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2222
Location: Sydney

PostPosted: Thu Aug 27, 2020 3:09 am    Post subject: Reply with quote

The compiler report "A REAL constant has been truncated with possible loss of precision - maybe a KIND is required" is a WARNING, not an ERROR.

This would not prevent your program from running, as it is a warning only.

You need to review the Output box and find the ERROR reports that caused the Compilation Failed.

Alternatively you could compile in a DOS box to more easily see the errors.

ftn95 myfile.f /64 /check > myfile.tce
notepad myfile.tce
Back to top
View user's profile Send private message
Salvador



Joined: 25 Aug 2020
Posts: 9

PostPosted: Thu Aug 27, 2020 4:33 pm    Post subject: Reply with quote

As mentioned above, my fortran code compiles using the g95 compiler but it does not compile using ftn95. I get a lot of warnings and then stops. I don't know what the errors mean because I am new to Fortran.

Below is a link to the "ftn95_test.f" file. I would appreciate it if someone in this forum could try to compile it and let me know what those errors are and give me some hints on how to fix them.

Here is the link to the file:
https://login.filesanywhere.com/fs/v.aspx?v=8c6a6b875e6772b4b26d
Back to top
View user's profile Send private message
Salvador



Joined: 25 Aug 2020
Posts: 9

PostPosted: Thu Aug 27, 2020 4:47 pm    Post subject: Reply with quote

@ John Campbell-- I followed your suggestion and I understand that warnings don't prevent the code from executing, however, after multiple warnings my fortran code stops and I get a message:

WARNING - There are (at least) 1 truncated line(s) in this file
*** Compilation failed
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Aug 27, 2020 4:59 pm    Post subject: Reply with quote

There are also 2 error reports. REAL(8) must be changed. You could use DOUBLE PRECISION or REAL(2) or various other ways to represent REAL*8 variables. You could alternatively leave it as REAL(8) and use /alt_kinds on the FTN95 command line.

The errors are on line 11889 and 11890.
Back to top
View user's profile Send private message AIM Address
Salvador



Joined: 25 Aug 2020
Posts: 9

PostPosted: Thu Aug 27, 2020 10:44 pm    Post subject: Reply with quote

I tried on the command line:
ftn95 ftn95_test.f /alt_kinds

And still got the errors. Did I do it correctly
or you meant something different?
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1414

PostPosted: Fri Aug 28, 2020 2:12 am    Post subject: Reply with quote

Look for the string "alive female spawner", which is on line 2114. In column 73 of that line, there is 'g'. Move that to the next line, and the "truncated line" message should go away.

With that change, along with changing REAL(8) to REAL*8, and with the /silent option, compilation and linking occur without errors. If I had the necessary data files, I would have tried running the program.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2222
Location: Sydney

PostPosted: Fri Aug 28, 2020 3:53 am    Post subject: Reply with quote

There are also:
# occurrences of INTEGER(4) which could be changed to INTEGER*4 : As FTN95 has different default kind values, REAL*4, REAL*8 and INTEGER*4 is more portable than REAL(4), REAL(8) and INTEGER(4) when moving between FTN95 and other compilers.
# numerous warnings about truncation of REAL values : Should these be 32-bit reals or 64-bit reals ?

The origional development environment has not been documented. The use of "PARAMETER (PI=3.141592654)" is worrying for implied precision. DOUBLE PRECISION is also used, hopefully REAL*8.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
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