Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Old Feature

nichols__john
Beginner
1,697 Views

I was looking at some old code in a Structures manual.

IF(ALPHA) 105,104,105

Alpha is the co-efficient of thermal expansion.  I thought arithmetic if statement had been taken out of Fortran, but for fun I tested it and it worked, much to my surprise.  Here it was used to make sure the alpha had a value if they forget to put on into the input routine.

My next thought is how zero is the zero in the middle?

Will it actually be removed or is it just a wish that it should not be used.  Makes it horrible to read code.

John

 

0 Kudos
1 Solution
GWats1
New Contributor I
1,697 Views

Steve Lionel (Intel) wrote:

Do these young engineers want to get a job in an engineering field, especially one that involves HPC? They'll almost certainly need to know Fortran.

As I get closer to retirement and try to pass my knowledge on to the younger engineers, nobody has learned Fortran and although modern computer software has come a long way since I started to write programs for work in 1973 it seems that Fortran is not taught in school anymore. I'm a Structural Engineer and we analyze steel structures. Back in the old days nobody had software to do what we were doing so I wrote programs to do it.

I wrote the programs for myself because I'm an Engineer and not a programmer. An Engineer that writes a program finishes it to his satisfaction and starts using it. If he wants it to do more, he adds more code statements.  The "user's manual" consists of looking at the read statements and constructing an input file. When some other engineer asks to use the program, the problems start. The original engineer/programmer has to write a real User's Manual to describe how to run the program. The inevitable request for added features comes and the original engineer morphs more into being a programmer because although the program works as it was written, "it would be a little bit nicer if it would only do..." and the changes start taking longer to implement. What sound like a simple addition of a couple of commas and parenthesis, may take days of re-coding.

The big FEM programs like ANSYS and the one I use, GTSTRUDL, are great for their intended purpose, but they are very general in nature. If you want to look into some very special structures or the connections between members you write programs to do the task. I wrote some post processors to take the output from the big FEM's and do some designs on the connections. It seems like MS Excel has come along to do this task.

After I retire, someone may have to learn enough Fortran to maintain the programs I wrote.  

View solution in original post

0 Kudos
37 Replies
mecej4
Honored Contributor III
654 Views

You need to be able to go back in time a bit to understand some of these old codes. If TR is equal to zero, the DO loop has no effect other than using up some CPU/FPU time multiplying by zero and adding zeros. When we were writing code for 8086+8087, multiplying by zero still consumed CPU time, so the IF statement simply checks to see if a DAXPY operation can be skipped entirely. In the code that you listed (AUXO.f90), there are also several places where extra lines of code and three-way IF statements are used to bypass loops such as DO nnn I=1,nx for values of nx < 1.

0 Kudos
nichols__john
Beginner
654 Views

Yes I was thinking about the other if statements as well.  Interestingly this code predates the 8086 by several years.  I used the old Compaq portable with the 4 inch screen and 2 floppies to run this type of code and saving on the do loops was important - I remember MS Fortran 3.3.1 and using VEDIT to execute the compiler, a good old system. I still use VEDIT - a good editor for huge files.

The problem I am looking at, at the moment, has minute changes in the temperature which yield measurable accelerations using the CX1 accelerometer. Structural engineers mainly ignore temp differences except in some special cases - maybe this is wrong, but the way we program makes it automatic to ignore - I am asking myself whether conceptually I should make the engineers who use this future system consider temp, or if I recode it how small is the delta to skip it to save code steps. Optimization comes in many forms. ( they will not use this code - this is just for theoretical thinking like this). The real problem is the CX1 has taken the acceleration data down to 10 micro-g's -- the other data collection is not at this level.

I think I should set a small temp delta that is skips the do loop - but make the engineer think about it not just leave it out and it is an automatic zero.

0 Kudos
jimdempseyatthecove
Honored Contributor III
654 Views

Careful. 10 uG's for a long time is not insignificant.

Jim Dempsey

0 Kudos
nichols__john
Beginner
654 Views

Jim:

According to the math guys the central limit theorem should apply -- unfortunately the CLT has not heard of temperature drift, warping of the MIL SPEC case due to electrical heating or variations in g associated with tides moon etc... or voodoo (just joking). So position is our next problem. It is a lot of fun.

Of course... no let us not go there

0 Kudos
nichols__john
Beginner
654 Views

So I was looking at the sample problems to put some units into the output file, so it  might actually make some engineering sense. I noticed that the programmer has put the lengths in in feet, the areas in in square inches and the force units in thousands of pounds and pressure in thousands of pounds per square inch. He did not adjust the units in the code. Nor did he say what they were although that is obvious.

We fail our students for such errors in exams. Does anyone else see this type of coding problem?

I wonder how hard it would be to add the mass matrix and solve the eigenvector problem - which solver would you all recommend ?

John

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
654 Views

John,

Over ten years ago I wrote a simulation system where the input data came in all kinds of units. Also, sample code that I incorporated into the simulator use various different units depending on the author and time the code was developed. The simulation code was in C++. As such, I was able to declare types and operators that enforced dimensional consistency.

feet_t feet = 1234.5
hours_t  hour = 6;
meters_per_second_t speed = feet / hour; // performed conversion and type checking
meters_per_second_t badSpeed = feet * hour; // error wrong dimension

This eliminated all kinds of conversion errors and dimensional inconsistency errors.

Jim Dempsey

0 Kudos
dboggs
New Contributor I
654 Views

Interesting comments about past and modern education in programming--especially the comment about how MIT uses a basic concepts approach such as LISP.

I learned programming at MIT more than 40 years ago. We used FORTRAN, because of course nearly all engineering applications used fortran; nothing else was really considered (except the occasional PL1 or Algol, etc.). Today, nearly all engineering students are taught Matlab and only Matlab. Really too bad. Matlab is really good for some things, such as immediate short-term problem solving (I call it a "very powerful tool for the rapid development of disposable software"), and the schools may be right, assuming that is their target audience. They don't want to be bothered with the need for educating software engineers for the specialized, big, massive efforts on which long-term careers are based.

At MIT, software engineering is a part of the electrical engineering (Course 6) department, and the basic class is 6.00 Intro to Programming. The software they use is--drumroll--Python! I assume this is because (1) it is free, (2) it is very good for developing basic logic and programming skills (at least if you believe in OOP) that can then be applied to many other languages. In addition, I understand that the numerical extension to Python (NumPy) is setting up to really give Matlab a run for its money. There's a lot going for it (and a lot going against Matlab).

Where does this leave Fortran? I like (love) it, and I support it very strongly in our office for our hard-core applications that need to be bullet proof and long-lived. But I fight a very uphill battle because the young crowd don't appreciate that. After all they learned Matlab, right, so why should they have to learn anything else?  

0 Kudos
Steven_L_Intel1
Employee
654 Views

Do these young engineers want to get a job in an engineering field, especially one that involves HPC? They'll almost certainly need to know Fortran.

0 Kudos
FortranFan
Honored Contributor II
654 Views

jm-nichols@tamu.ed wrote:

So I was looking at the sample problems to put some units into the output file, so it  might actually make some engineering sense. I noticed that the programmer has put the lengths in in feet, the areas in in square inches and the force units in thousands of pounds and pressure in thousands of pounds per square inch. He did not adjust the units in the code. Nor did he say what they were although that is obvious.

We fail our students for such errors in exams. Does anyone else see this type of coding problem? ..

See this link: http://www.sciencedirect.com/science/article/pii/S1877750315000563

As well as ISO/IEC JTC1/SC22/WG5, Units of measure for numerical quantities, April 2013. N1696, ftp://ftp.nag.co.uk/sc22wg5/N1951-N2000/N1969.pdf

and: ISO/IEC JTC1/SC22/WG5 N1970, Units of Measure in Fortran, 2013. N1970,ftp:// ftp.nag.co.uk/sc22wg5/N1951-N2000/N1970.pdf

The problem has been recognized and some solutions have been proposed,even for the Fortran standard (but I'm not too hot on this; I prefer to do it differently)

0 Kudos
dboggs
New Contributor I
654 Views

Steve: No, HPC is completely unknown to them. The thing is, HPC--as well as programs in excess of 50 - 100,000 lines or so of code--is simply not needed by the vast vast majority of practicing engineers in commercial environments; say practicing civil, structural, mechanical, and even aerospace engineering. Virtually all of such people, much to my chagrin, are using Matlab for everything. And if that didn't result in the most appropriate solution, or if they or their client or the public complains about it running too slow--well "they'll have to live with it", because they did it using what was available and what they knew how to use.

0 Kudos
DavidWhite
Valued Contributor II
654 Views

dboggs wrote:

if they or their client or the public complains about it running too slow--well "they'll have to live with it"

Or Intel will develop a faster chip and then we'll all be happy :-/

David

0 Kudos
John_Campbell
New Contributor II
654 Views

mecej4 wrote:

IF statements are used to bypass loops such as DO nnn I=1,nx for values of nx < 1.

Some of the UCB code is pre F77, so DO nnn=1,nx can be a 1 pass DO for values of nx < 1. An IF test was required to enforce the skip. You need to check what makes sense.
Back then, using an IF zero test inside the inner DO could be effective for improving run times. My impression is these should now be removed to improve vectorization, although some (most?) optimizing compilers can recognise this.

I studied engineering in early 70's. Even then, few undergrads learnt Fortran, although a double BSc/BE degree was popular to also learn computer science. All postgrad work was done using Fortran, although the learning of Fortran could be by using the previous post grad student's work. There were no forums in those days. We taught out supervisors how to write better Fortran, as some of the old Fortran looked more like basic with lots of statement numbers, goto's and few subroutines. There are a number of textbooks from those days that demonstrate that old style Fortran, although the engineering approaches have changed little. Graham Powell (Drain3dx) also published the skyline equation solver in 1974, which still is a useful solver today (in conjunction with a bandwidth or storage optimiser).

0 Kudos
nichols__john
Beginner
654 Views

I did not know this would generate such an intense debate.

 

----------------------------------------------------------------------------

I learned programming at MIT more than 40 years ago. We used FORTRAN, because of course nearly all engineering applications used fortran; nothing else was really considered (except the occasional PL1 or Algol, etc.). Today, nearly all engineering students are taught Matlab and only Matlab. Really too bad. Matlab is really good for some things, such as immediate short-term problem solving (I call it a "very powerful tool for the rapid development of disposable software"), and the schools may be right, assuming that is their target audience. They don't want to be bothered with the need for educating software engineers for the specialized, big, massive efforts on which long-term careers are based.

----------------------------------------------------------------------------

MATLAB is for the average civil engineer who has little ability in the math field and limited interest.

In terms of MIT is was referring to the courses taught by Abelson and Sussman -- if you want to program well in any language read those books, and the one by Horne.  If you can LISP well you can FORTRAN in a few weeks. If you can FORTRAN well it still takes a year to learn LISP. Different mind sets.

Python is a phase a bit like LSD looks good for a short while, it does not produce nice looking code -- I know I tried with RHINO and it is just a mess - there are those who like and good luck to them -- Fortran is still better - but that is a personal opinion.

Powell's stuff is everywhere -- they were brilliant group - some are still around. I still think the guy who wrote ULARC was their best conceptual guy in coding - brilliant code. 

You can do a lot with it.

John

 

 

0 Kudos
nichols__john
Beginner
654 Views

David White wrote:

Quote:

dboggs wrote:

 

if they or their client or the public complains about it running too slow--well "they'll have to live with it"

 

 

Or Intel will develop a faster chip and then we'll all be happy :-/

David

And then the problems with get bigger

Say I want to do FFT by taking a single data point forward and redoing ad infinitum -- Fortran maybe and a lot of help from mecej4 and it might just work in real time. Only 2000 FFT per second in real time -- on three channels - from one instrument - multiplied by a 1000 instruments - sure Python will work here.  Maybe just maybe mecej4 and PARSISO and FORTRAN and a big computer and you might just do it. By the way do the stat analysis on top of that and still have time for a cup of tea from my FORTRAN MUG - no crumpets the EP does not like crumpets.

 

0 Kudos
nichols__john
Beginner
654 Views

I fixed the Harrison program to rid it off all the arithmetic ifs and added some output statements so that units how up properly.

Have not had a chance to check the final result by hand.

It now calculates the engineering strain and the problem is the one from the book - but the lengths are now in inches in the analysis to match the other units.

John

 

0 Kudos
GWats1
New Contributor I
1,698 Views

Steve Lionel (Intel) wrote:

Do these young engineers want to get a job in an engineering field, especially one that involves HPC? They'll almost certainly need to know Fortran.

As I get closer to retirement and try to pass my knowledge on to the younger engineers, nobody has learned Fortran and although modern computer software has come a long way since I started to write programs for work in 1973 it seems that Fortran is not taught in school anymore. I'm a Structural Engineer and we analyze steel structures. Back in the old days nobody had software to do what we were doing so I wrote programs to do it.

I wrote the programs for myself because I'm an Engineer and not a programmer. An Engineer that writes a program finishes it to his satisfaction and starts using it. If he wants it to do more, he adds more code statements.  The "user's manual" consists of looking at the read statements and constructing an input file. When some other engineer asks to use the program, the problems start. The original engineer/programmer has to write a real User's Manual to describe how to run the program. The inevitable request for added features comes and the original engineer morphs more into being a programmer because although the program works as it was written, "it would be a little bit nicer if it would only do..." and the changes start taking longer to implement. What sound like a simple addition of a couple of commas and parenthesis, may take days of re-coding.

The big FEM programs like ANSYS and the one I use, GTSTRUDL, are great for their intended purpose, but they are very general in nature. If you want to look into some very special structures or the connections between members you write programs to do the task. I wrote some post processors to take the output from the big FEM's and do some designs on the connections. It seems like MS Excel has come along to do this task.

After I retire, someone may have to learn enough Fortran to maintain the programs I wrote.  

0 Kudos
nichols__john
Beginner
654 Views

Precisely.

Although you could have added the caveat that we learnt AutoLISP in the 1980's so we could speed up the drawing process.

John

0 Kudos
Reply