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 

Visual compilation error diagnostics

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2583
Location: South Pole, Antarctica

PostPosted: Tue Jul 19, 2022 10:55 pm    Post subject: Visual compilation error diagnostics Reply with quote

This is what i like about gfortran and Intel with their method of explaining the compilation errors. Not only they describe the error, they also explicitly show it. Is it possible to implement this with FTN95 ?

Code:
src/io/diagnostics.F90(254): error #6405: The same named entity from different modules and/or program units cannot be referenced.   [I4]
    integer(i4) :: iCurrHDFconvertorVersion
------------^


Most of people barely know Fortran terminology and even English. This way they will not be turned off from this compiler
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Jul 20, 2022 7:58 am    Post subject: Reply with quote

Dan

You have not provided the code that produced this error report nor the corresponding FTN95 error report

Maybe you are right about this particular error but in general FTN95 has a good reputation regarding the clarity of its error reporting.

FTN95 provides the line number of the error but not the column number. It would be nice if we could also provide the column number but FTN95 begins by removing all unnecessary white space which means that column numbers are not easily available.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2583
Location: South Pole, Antarctica

PostPosted: Wed Jul 20, 2022 5:27 pm    Post subject: Reply with quote

Paul,

That compilation took place inside one of modules of that huge PIC code we discussed last month https://github.com/Warwick-Plasma/epoch. It will be almost impossible to me to reproduce this error as there is no Linux FTN95 and manually compiling in BATCH file hundreds of files i still not succeeded to do. So if we simplify the code to this
Code:
!! INTEGER, PARAMETER :: i4  = SELECTED_INT_KIND(9)
   integer(i4) :: iCurrHDFconvertorVersion

   iCurrHDFconvertorVersion=1
   print *, iCurrHDFconvertorVersion
end

(note i commented out the definition of i4) then Intel gives the following report
Code:
aaa.f90(2): error #6683: A kind type parameter must be a compile-time constant.   [I4]
   integer(i4) :: iCurrHDFconvertorVersion
-----------^
compilation aborted for aaa.f90 (code 1)

and gFortran fingers not with the arrow but with the number 1 below
Code:
aaa.f90:2.11:

   integer(i4) :: iCurrHDFconvertorVersion
           1
Error: Parameter 'i4' at (1) has not been declared or is a variable, which does not reduce to a constant expression


The FTN95 error report is here
Code:
0002)    integer(i4) :: iCurrHDFconvertorVersion
*** Only INTEGER constants are allowed as a KIND parameter
    1 ERROR  [<main program> FTN95 v8.83.0]
*** Compilation failed


Words in all cases are so different and are in general right but the novice will break his mind deciphering them. For such users definitely just showing on the wrong place is the most valuable hint.

I understand that there will be a difficulty to implement this nice direct fingering on a wrong place. Intel and gFortran are doing this because they also have the warning if you are using TABs in source code instead of spaces. Here is an example from Intel Fortran when i inserted a tab before WRITE:
Code:
src/io/diagnostics.F90(603): warning #5112: Extension to FORTRAN-90: tab formatting
          WRITE(333) chCurrHDFconvertorVersion

The FTN95 does not care about tabs which i think is good though John Campbell may disagree. But may be FTN95 will ask you if you are going to lose a bit your freedom by rejecting all TABs in your source files in favor of spaces and for that as a bonus you will get direct fingering with an arrow on your potential error place ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Jul 20, 2022 6:23 pm    Post subject: Reply with quote

Dan

The FTN95 error report seems reasonable to me.

I won't go into the details but it is not simply a matter of dealing with tabs.

One of these days we could investigate using column numbers when reporting errors but there are many more useful things to do first.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2583
Location: South Pole, Antarctica

PostPosted: Wed Jul 20, 2022 6:46 pm    Post subject: Reply with quote

Paul, Please keep this feature in your list. To show is 100 times better than to say. May be this was that hidden miracle reason i still do not completely understand why to me and my colleagues the best compiler in the world (way more advanced, feature rich and capable) starting from 1990 like FTN77 was absolutely unknown to the Fortran masses. I participated in 90th in the major Fortran discussion forum comp.lang.Fortran which was very busy spot on the subject. At that time all other compilers were literally a dumb laughable junk compared to Salford Fortran but only one person John Appleyard was familiar with this compiler there and he also agreed that the Salford was the best. In research labs though i worked or visited (the major ones, up to 5-10k people, i will note) not a single person even knew the Salford name, there were no single request for the software in their procurement departments when i asked to buy one for me.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Jul 20, 2022 9:22 pm    Post subject: Reply with quote

Dan

FTN95 with /CHECKMATE detects all of the runtime errors in John Appleyard's compiler diagnostic comparisons. The 92% in the following table is now 100%.

https://www.fortran.uk/fortran-compiler-comparisons/win32-fortran-compiler-comparisons-diagnostic-capabilities/.

Compilation is also relatively fast, very fast when compared with gFortran and iFort.

FTN95 runtimes are relatively slow in the Polyhedron benchmark suite but these programs may not be truly representative. If fast runtimes are really important then users can switch to iFort for the final release.

Then there is ClearWin+ which can be used with third party compilers such as iFort.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2583
Location: South Pole, Antarctica

PostPosted: Thu Jul 21, 2022 2:54 am    Post subject: Reply with quote

Cool. Please do not forget to inform John A to update the table. Tables sometimes not updated for years. We also will remind him
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2583
Location: South Pole, Antarctica

PostPosted: Mon Jul 25, 2022 10:04 pm    Post subject: Reply with quote

Just sent them a message. Information is a key.

But FTN95 has to be best with everything. So the next my wish would be - i do not know how about other users - to support of parallelization but not the proprietary way like today, or not via third-party libraries like LAIPE, but with the standard one with Open MPI. FTN95 for example supports OpenGL why not MPI? Hopefully this will be easier than support automatic parallelization of serial codes like some compilers also became capable recently. Most probably major rebuild would require SDGB64 to be able to debug the parallel threads, but i am not sure.

Then next still would be the Polyhedron run-time benchmarks. They still have to be improved. The fact the FTN95 is pretty behind in some tests means they can be relatively easily substantially improved without much pain and work. May be you are right and these tasks indeed are not good representatives of real world applications. I might check that by transferring my code with Clearwin to, say, Intel Fortran but unfortunately i have no free time. Plus even it is faster i would not switch to Intel because as i wrote here many times it is the programmer's time which is most important for my codes not the run time. For run time we have different codes and the supercomputers. If FTN95 had Linux version then all that would matter much more

And here is the third wish. All Fortran compilers now have Linux versions. And all support MPI parallelization. Why there is no FTN95 for Linux? FTN95 is the last one who does not run on Linux. What are the difficulties to port just the Fortran (without Clearwin for example if porting last one is not that trivial - i do not know if it is or not, but clearly there are no WinAPI ). Not sure Clearwin will be even needed if you run on supercomputers, the results still better visualize on Windows, plus people mostly make the presentations and prepare text in Powerpoint and Word not in buggy Open Office for Linux/Windows. But who knows, may be soon all computers will be supercomputers and all parallel tasks will run on graphics cores (prices of some processors and memory are artificially kept by monopolies 2 orders of magnitude larger than the others. Compare recent 20 Billion core cell phone processors prices at around $100 with Intel and specifically AMD server chips which are much easier to produce because they consist of 8-core chiplets and despite that they still go close to $10k. Even NVIDIAs 50+ B transistors chips go 10x cheaper)


Last edited by DanRRight on Tue Jul 26, 2022 7:50 am; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Jul 26, 2022 7:41 am    Post subject: Reply with quote

On the face of it, it is possible that one could use FTN95 with Open MPI. If anyone has tried then please report back on your experience.

At some point we do plan to revisit the Polyhedron benchmarks in order to investigate the differences.

Porting to Linux would not be quick and easy. FTN95 generates object code directly with separate "backends" for Win32, x64 and .NET. Porting to a new platform requires a major investment of time and resources.

There is software available (e.g. WINE) for running the Windows API under Linux. It may be possible to run FTN95 under Linux via something like WINE.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2583
Location: South Pole, Antarctica

PostPosted: Thu Aug 04, 2022 7:57 am    Post subject: Re: Reply with quote

PaulLaidler wrote:
On the face of it, it is possible that one could use FTN95 with Open MPI. If anyone has tried then please report back on your experience.


If someone has spare time they can play with MPI initially with Intel and Gfortran and then try if FTN95 will also work.

Here is an example where anyone can easily learn the major things of MPI. Just one example and you will already in the theme. (By the way i learned Clearwin and OpenGL on Salford Examples only. Just the few examples and you are mostly done without reading any boring manuals. The Clearwin and OpenGL examples are still supplied with the compiler by the different name and unfortunately in the inconvenient place)

Code:
PROGRAM hello_world_mpi
include 'mpif.h'

integer process_Rank, size_Of_Cluster, ierror, tag

call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size_Of_Cluster, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, process_Rank, ierror)

print *, 'Hello World from process: ', process_Rank, 'of ', size_Of_Cluster

call MPI_FINALIZE(ierror)
END PROGRAM

Now the code is complete and ready to be compiled. Because this is an MPI program, we have to use a specialized compiler. The compilation command will be one of the following:

GNU Fortran Compiler

Code:
mpif90 hello_world_mpi.f90 -o hello_world_mpi.exe

Intel Fortran Compiler

Code:
mpiifort hello_world_mpi.f90 -o hello_world_mpi.exe


This will produce an executable we can pass to as a batch job in special queue for many users waiting their timeshare or execute MPI compiled code from your keyboard. In both case a special command must be used:

Code:
mpirun -np 4 ./hello_world_mpi.exe


The flag -np specifies the number of processor that are to be utilized in execution of the program (that command was for Linux obviously, they all start run by that dumb way: ./a.exe )

Our output file should look something like this (note the order of ranks isnít necessarily sequential):

Hello World from process 3 of 4
Hello World from process 2 of 4
Hello World from process 1 of 4
Hello World from process 0 of 4

That is already 90% of what most of people will need because it shows how it works. One more such example in ref below and it will be 99%. See Reference on this text https://curc.readthedocs.io/en/latest/programming/MPI-Fortran.html#setup-and-hello-world

In the source code example above I do not immediately know how to supply mpif.h for FTN95 to become MPI capable, this is probably for more experienced guys than me.

And to install Linux i recommend VirtualBox. This way you will run Linux simultaneously with Windows, Linux will be just one more window on your screen, they will communicate with each other, commonly use files, queues, clipboard etc. Super cool and easy like 2+2. See great Youtube video by ProgrammingKnowledge "How to install Ubuntu 22.04 LTS on VirtualBox in Windows 11" (works with Windows 10 too, like it is in my case). You will need to allow virtualization in BIOS if installation of VirtualBox fail. Thanks to Youtube the never user-friendly Linux because very useful and convenient. And in some cases even more user-friendly than Windows. For example if you try to compile and there is no compiler or some other program needed, it will ask you if you like that it will install it for you.


Last edited by DanRRight on Fri Aug 05, 2022 10:35 am; edited 3 times in total
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Thu Aug 04, 2022 3:41 pm    Post subject: Reply with quote

It is interesting that Dan appears to be mentally conflating the role of compiler error messages with actually diagnosing what is wrong with the code taken as a whole. A good example of this might be:

The variable PARsdvfrwklfrmdrsT1 has been used without being given a value

whereas the proper diagnosis of what went wrong is:

Your cat walked over your keyboard without you noticing.

The point at which the compiler detects an error is not necessarily where the error in the program lies, and certainly it cannot always tell what caused it!

Short of Paul becoming an expert in telepathy we may simply have to live with the error messages that FTN95 emits (and which are quite good enough for me).

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



Joined: 10 Mar 2008
Posts: 2583
Location: South Pole, Antarctica

PostPosted: Fri Aug 05, 2022 3:41 am    Post subject: Reply with quote

Eddie,
The FTN95 messages are too good for rednecks like me who learned English after teenage years. To me the FTN95 error messages always sounded like pure elitist cult. If just one single word in them you do not know the exact meaning -- the whole message becomes like a cryptogram. The compiler translates your code and gives the error verdict, then a programmer with bad knowledge of Fortran and English and Standard needs to translate this error report into something understandable. I remember in the past i even did not read these messages, just looked at the error message line number. My Fortran text was much closer to me because i wrote it, while the error message wrote someone with 80th level of knowledge of English like from finishing school.

From the other side imagine FTN95 developers will turn all their diagnostics messages into total nonsense like this
Code:
src/io/diagnostics.F90(254): error #6405: blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah     [I4]
    integer(i4) :: iCurrHDFconvertorVersion
------------^
but will leave the arrow above, and may be the Fortran variables at fault - then i guarantee people with little English/Fortran knowledge (90-99% of population) will understand them 10x faster. Paradox is - the richer is your vocabulary the smaller will be circle of people who will understand you. To show is always better than to say.

P.S. I am not even sure i fully understood your message, as Google translator has only one meaning of the word "conflating" i hear for the first time in my life while you assume that i know 20 meanings, 30 synonyms and 40 related idioms for it Smile
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Fri Aug 05, 2022 8:52 am    Post subject: Reply with quote

Hi Dan,

Conflating to me means in this context joining together and considering them to be the same.

Note that I don't compile dictionaries!

Eddie

PS Sometimes the dictionary translation is just plain wrong - it isn't always the first definition that applies!
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1707

PostPosted: Fri Aug 05, 2022 11:17 am    Post subject: Reply with quote

As we may have noticed often, Dan has a love-hate relationship with compilers and with English. So, when the compiler issues an error message such as

Code:
   The quality of mercy is not strained


Dan wants it to add, "at line <nnn> column <ccc> of file <xyz.f90>", so that he can try to overcome the problem by adding

Code:
CALL STRAIN(MERCY)


Here is some wise advice that, should he accept it, may be of help to him sometimes:

Though justice be thy plea, consider this:
That in the course of justice none of us
Should see salvation. We do pray for mercy,
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Fri Aug 05, 2022 1:06 pm    Post subject: Reply with quote

Mecej4,

I saw an article about machine translation that after changing the English aphorism (there's one for Dan):

Out of sight, out of mind

to some other language and back again, in one cycle it became

Invisible, insane.

As for Shakespearean Quotations, perhaps Dan could consider programming in Shakespeare https://shakespearelang.com/1.0/

Eddie
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 -> Suggestions All times are GMT + 1 Hour
Page 1 of 1

 
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