Silverfrost Forums

Welcome to our forums

gFortran

28 Aug 2017 7:29 #20064

Where do I learn about gFortran? I downloaded and installed it, but find the source files incomprehensible. I want to read up on the language, and how to compile and link it.

Thx,

Dan

29 Aug 2017 6:25 #20065

Dan

This forum is for the FTN95 compiler and not gFortran. Try Googling gFortran if you must use it otherwise download the free personal edition of FTN95 from here http://www.silverfrost.com/32/ftn95/ftn95_personal_edition.aspx

29 Aug 2017 9:56 #20070

Quoted from kaliuzhkin Where do I learn about gFortran? I downloaded and installed it, but find the source files incomprehensible. I want to read up on the language, and how to compile and link it.

Let us not confuse the language, Fortran, with a specific compiler for that language, Gfortran.

We do not know what you downloaded and what you installed. If by 'source files' you mean the source files from which the Gfortran compiler is built, those would be mostly in the C language and, if you are not familiar with parsers and code generation, you would find them incomprehensible regardless of whether those are in C or Fortran.

If you are new to Fortran, I recommend that you use Silverfrost FTN95 for now and postpone (or forget) using Gfortran. FTN95 is free for personal use, and provides excellent features that help the beginner to learn Fortran.

30 Aug 2017 6:21 #20071

On the grounds that the particular part of the Forum is dedicated to:

'General discussions on FTN95 ...'

I think Paul's reply would have been fair enough, but isn't it a little harsh when the rest of the blurb states:

'Fortran, Third Party tools...basically anything that takes your fancy!'

Indeed, as Clearwin64 was specifically targetted to gFortran initially, then again, it would seem that gF shouldn't be off limits.

You can even get an easy to install version with a GUI and lots of extensions from SimplyFortran. If you looked at the Polyhedron benchmarks, you might even go away with the idea that gF was better in some ways - the benchmarks show execution times lower than FTN95.

BUT. A lot of buts. If you use raw GNU stuff, as Mecej4 says, and the original poster knows, it is well nigh incomprehensible. In comparison to FTN95, it lacks the useful standard functions present in FTN since FTN77 days, as well as a fully-integrated Clearwin that enables very professional Windows applications to be developed. Indeed, if you want incomprehensible stuff, you can always tie FTN95 in with .NET !

Then again, FTN95 compiles extremely quickly, with great diagnostics: far more important to a developer than run times of a few seconds saved. You will be some time programming in Fortran before you create something with a significant run time.

SimplyFortran also has a free trial version - but it expires after 30 days, and if you can genuinely teach yourself Fortran in 30 days, then perhaps you have the brainpower to sort out a raw gF installation ...

You can try the rest, but perhaps as you found your way here, you should try the best.

11 Sep 2017 8:20 #20195

I defend myself against Paul’s charge that I posted an inappropriate post. My 34 word post merely asked where I could learn about gFortran. I asked for a referral. That’s all. If this is an inappropriate forum, then I merely asked where else I could look.

Mecej4 asks “what you downloaded and what you installed.” In fact, I downloaded and installed Silverfrost’s version. So an inquiry on a Silverfrost forum about how to use a Silverfrost product is quite appropriate.

The 'source files' I referred to are from Silverfrost, on my computer in C:\Program Files (x86)\Silverfrost\gFortran\gFortran\samples\ and C:\Fortran compilers\Silverfrost\GFortran\gFortran\samples\. There are 77 files with tag *.f95 and I can’t make sense of any of them. Readme.txt contains only limited information.

How do I compile and link gFortran? “x86_64-w64-mingw32-gfortran.exe/?” is useless.

Could I set up Plato to use it? Are there any other IDEs?

I’m not new to Fortran. I learned it in high school and college, professionally coded for five years in the 1970’s, and have continued on my own with Lahey Personal Fortran 77 and for the past five years or so with Silverfrost FTN95. My main references are “Fortran 95” by Counihan, “Introducing Fortran 95” by Slivers and Sleightholme, and “Fortran 95 Handbook” by Adams et al. I still have a lot to learn about Fortran 95.

Please, don’t assume the worst from a short post. 😄

Thanks for all the information. Dan

11 Sep 2017 9:03 #20199

You are confusing Gfortran and Silverfrost Fortran (FTN95) so thoroughly that it is nearly impossible to answer you.

Silverfrost does not distribute Gfortran or any Fortran compiler other than FTN95 at present. Any sample files included in the FTN95 installer would be FTN95 examples, not Gfortran examples.

Typically, the FTN95 sample files are installed in the user's home directory in a subdirectory called 'FTN95 Examples'. I have never used any of them, but they appear to be examples of GUI type programs, which I am not interested in.

You may have named the directory containing the FTN95 samples as 'gfortran', but that does not make them Gfortran samples any more than naming a Windows PC 'Torvalds' would make it a Linux PC.

From your mention of '...mingw...' I suspect that you may have also installed MINGW-Gfortran some time ago and have mixed up the two compiler directories.

You also state that you have been running FTN95 for a number of years. If so, you already know how to use FTN95 to compile and link the FTN95 sample files. What is the hold-up?

11 Sep 2017 10:29 #20200

http://www.silverfrost.com/beta/gFortran.exe. In Plato, under Tools, there's an option for gFortran. You then have a choice of downloading or locating it. Downloading brings you to the aforementioned URL. What gives? :?: :?:

11 Sep 2017 10:31 #20201

Oh, there's no hold up on FTN95. My question is limited to gFortran as furnished by Silverfrost.

Dan

11 Sep 2017 11:26 #20202

Thanks, I was not aware of the link that you provided. Searching the silverfrost main page with 'gfortran' shows nothing. That is probably why many of us did not recognize what you were writing about!

However, this post may explain what that is: https://forums.silverfrost.com/Forum/Topic/2286 . The last line of that post says, 'This folder contains a test suite of ClearWin+ samples that will run under either FTN95 or 64-bit gFortran.'

That post was made in 2013, and refers to a beta release of 64-bit Clearwin+, and a link to a 300 MB download of Gfortran. At that time, the x64 version of FTN95 did not exist.

We now have V8.1 of FTN95, which contains a 64-bit Silverfrost compiler. There is probably no more need for Silverfrost to provide updates to the beta release and the Gfortran download. Perhaps Paul can comment on this.

12 Sep 2017 4:47 #20205

When Clearwin 64 was released, as a 64 bit version of Clearwin to run with a 3rd party 64-bit compiler, Plato provided support for gFortran. In Oct 2013, it supports 64-bit gFortran, I think supplied from mingw-w64. this was to support 64-bit clearwin. In 2016, FTN95 /64 was released, which provides a better support for 64-bit clearwin graphics.

However PLATO still supports other gFortran compilers. I find the mix of compiler support; from gFortran to FTN95 /64 and FTN95 (/32) /check to provide a good mix of compiler checking. And use them frequently.

For gFortran support in PLATO, you must set up the gFortran path and environment variables to be able to run gFortran in a cmd.exe window. This is poorly described !! It deserves a better description both here and on the gFortran download websites. A problem area in PLATO for using gFortran is alternative compiler options, although it may simply be a problem with my usage. (I need to review how gFortran can operate with a PLATO project)

Using gFortran provides a number of advantages, which FTN95 is not expected to address in the near future.

Inclusion of F03 and F08 standard features.

!$OMP support with -fopenmp

Extensive vector instruction support, eg -O3 -mavx -march=native -ffast-math

However, FTN95 offers extensive code checking, debug facilities and integration with newer Clearwin features.

You should better understand what features you are looking for. If it is graphics then look to FTN95 /64 Clearwin features If it is !$OMP then look to gFortran

I shall try to post an information sheet on using a 3rd party gFortran compiler with PLATO, by setting up environment variables for support.

12 Sep 2017 5:58 #20207

Plato support for gFortran is of necessity fairly minimal. In particular, command line options for gFortran must be configured manually as opposed to selecting from a given list. Also we can't undertake to keep pace with new versions of gFortran as they are released.

12 Sep 2017 12:25 #20215

This thread has prompted me to build a project in PLATO. (In the past I have used a .bat file to do the build) I have had some success! Selecting Release x64 and use Tools>Options>Use gFortran/gcc, I have been able to set compile options in Project>Properties>gFortran options: I will continue to investigate what is available, but it appears to work successfully.

To enable gFortran to work in PLATO, I have installed the following environment variables in Control Panel > SYSTEM > Advanced system settings > Environment Variables

copy path to orig_path

New environment variables for selecting FTN95 ver 8.10 and gFortran Ver 7.1.0 ( values taken from .bat file example )

set pf_32=C:\Program Files (x86)

set ftn95_dir=%pf_32%\Silverfrost\ftn95_8.10
set f95include=%ftn95_dir%\include
set mod_path=%ftn95_dir%\include
set ftn95_path=%ftn95_dir%

set gcc_ver=7.1.0
set gcc_dir=%pf_32%\gcc_%gcc_ver%
set EQ_LIBRARY_PATH=%gcc_dir%\x86_64-w64-mingw32\lib
set gcc_path=%gcc_dir%\bin;%gcc_dir%\libexec\gcc\x86_64-w64-mingw32\%gcc_ver%

set Path=%gcc_path%;%ftn95_path%;%orig_path%;c:\utils

In some cases the environment variables are not updated (eg gcc_ver), so the %variable% needs to be replaced by the text value.

12 Sep 2017 12:49 #20216

John, if you can answer without much effort, I'm curious to know:

If you use Gfortran's -g option, can you do symbolic debugging of the resulting EXE, with SDBG/SDBG64? If not, with another debugger?

I'm curious because Lahey/Marlette, these days, focus most of their efforts on enabling symbolic debugging in Visual Studio of Gfortran-compiled programs, so that capability is probably out of reach without substantial effort from Silverfrost, but you never know when an obscure feature of a compiler package may afford a short cut!

Thanks.
12 Sep 2017 11:50 (Edited: 13 Sep 2017 12:13) #20222

mecej4,

Unfortunately I have limited experience with gFortran and have not yet tried any -g options. I used gdb a few times but again am not familiar with it's features. There are a huge number of compiler options available and I wonder which are incompatible. I still haven't found how to get a FTN95 .map file.

I have not used Lahey/Marlette lately, as the latest gFortran version I found was 5.3, while other sites are up to 7.1 ( equation.com and mingw-w64 )

My focus has been for using !$OMP, which again makes using debuggers more difficult and beyond my capability.

I am slow to change, as this week is the first time I have used projects in PLATO. I have been able to do most builds with .bat files, where environment variables and mixed compiler options can be easily managed. FTN95 /64 without the ability to create libraries makes a .bat file build a preferred approach.

I have also been experimenting by mixing different -f.. and -m.. gFortran features, which is easy to do in a .bat file. I find daxpy and ddot style routines can perform better with different options on different processors, although the benefits are questionable.

12 Sep 2017 11:57 #20223

About ten years ago, a symbolic debugger called Insight was available for use in Cygwin. I used it, and found it quite capable. It had panes for locals, stack, etc., quite similarly to the ones in SDBG. Unfortunately, it is gone now.

13 Sep 2017 3:35 #20224

Quoted from kaliuzhkin How do I compile and link gFortran? “x86_64-w64-mingw32-gfortran.exe/?” is useless.

One of the problems I have/had as a new user of gFortran was : Where is the usage documentation?

To be able to compile, link and run gFortran programs on Windows and in a cmd.exe box, you need to define their path: where the .exe files are located, (...\bin directory) and where the libraries are located. (...\lib directory)

The key to solving this is to modify the PATH environment variable.

The location of the .exe files must be included in the PATH environment variable. Some versions of gFortran can locate the libraries, based on the ...\bin path, while some versions define a lib environment variable, eg some versions of equation.com use EQ_LIBRARY_PATH=C:\Program Files (x86)\gcc_7.1.0\x86_64-w64-mingw32\lib

I previously posted examples of my approach to modifying the PATH environment variable by defining: GCC_PATH = exe path; lib path FTN95_PATH = exe path for FTN95 .exe programs orig_path = PATH that OS and other installs generate

I then define PATH=%gcc_path%;%ftn95_path%;%orig_path%;c:\utils This is done in control panel > SYSTEM > Advanced system settings > Environment Variables

I use c:\utils as my own area for .exe and .bat files that I have developed

Note: FTN95 also defines a directory for global <include> files (f95include) and .mod files. (mod_path) FTN95 has other environment variables, (documented somewhere ?) gFortran may have a similar approach, but I have not found it documented.

You could search the FTN95 and gFortran documentation for environment variable settings.

I don't know why I can't find this information ? Maybe it is just me or is it a test to make sure users have enough general knowledge to use the product ?

Finally, gFortran comes as 32 bit (i686) or 64 bit (x86_64). Unless you have a definite reason, I would recommend using the 64-bit version. Same applies to FTN95.

I hope this helps

20 Sep 2017 1:37 #20265

Quoted from PaulLaidler Plato support for gFortran is of necessity fairly minimal

It may be minimal, but I have found it to be quite functional. By creating a project in PLATO, I have been able to achieve an OpenMP build, using varying compile options for different routines. I selected Release x64 and Tools > Options... > Use gFortran/gcc for x64; I was able to build the project. The properties offers 'gFortran options', 'Linker Options' and 'Launch arguments' which have enabled me to build and run a fairly complex OpenMP test program. Other options; 'gcc options' and 'windres options' are provided, although as yet, I am not familiar with their use. Properties can be allocated to a project or a file, which helps with selective compile options for different files. Compile and link options for Clearwin64 are included as default. I could not turn them off, although they did not cause any problems. (A release .exe may require the .dll's?)

The only problem I have found is that the setting 'Tools > Options... > Use gFortran/gcc for x64' is not retained in the project definition file.

To use gFortran and PLATO, the default system PATH must be correctly configured, which is the answer to the original post in this thread.

Paul's use of the term 'minimal' may be referring to the lack of menu support for the gFortran compile options, which is quite understandable. It would be a significant task, especially if combined with a info pop-up for each option, although would be a big help!

PLATO is an IDE that works for gFortran.

John

20 Sep 2017 7:02 #20266

Thanks for the encouraging feedback John. You are right, I was thinking of the gFortran command line options; also that clearwin64f.dll might become incompatible with new releases of gFortran.

Regarding the switch between FTN95 and gFortran, I will check what is saved in the ini file.

20 Sep 2017 7:15 #20267

The gFortran switch is saved and restored correctly for me.

It is stored as UseGFortran in C:\Users\Paul\AppData\Roaming\SilverFrost\FTN95\Plato.ini on my machine.

20 Sep 2017 2:25 #20268

Hi Paul,

I have limited experience with projects in PLATO, as I am still becoming familiar with these features. The results are encouraging, especially for accessing OpenMP.

Regarding the gFortran selection in Tools > Options... : I was expecting that this status would be included in the project.ftn95p file. I was also expecting that the (Release x64) compile MODE drop down switch would also be included in the .ftn95p file.

If I change either the compile MODE or 'Tools > Options... > Use gFortran/gcc for x64' (eg when changing to other projects), this can disrupt the Project > Properties... display, when returning to a gFortran project.

Also, is it possible to adjust the clearwin64 compile and build options ? as you suggest clearwin64f.dll may not be compatible with other versions of windows gFortran. I have not experienced this problem, while I am using different versions of gFortran, that are not from mingw-w64.

The next phase I shall be attempting is use of .dll and libraries, associated with gFortran (and /64), which also needs some documentation. I will see what I can update.

John

Please login to reply.