[Info-vax] [OT] Current students apparently can't read Fortran code...

Don Baccus dhogaza at gmail.com
Fri Apr 15 08:32:32 EDT 2022


On Friday, April 15, 2022 at 5:18:33 AM UTC-7, Arne Vajhøj wrote:
> On 4/15/2022 8:04 AM, Dan Cross wrote: 
> > In article <6258c4e1$0$693$1472... at news.sunsite.dk>, 
> > Arne Vajhøj <ar... at vajhoej.dk> wrote: 
> >> On 4/13/2022 10:02 PM, Don Baccus wrote: 
> >>> [snip] 
> >>> "While much of the subsequent reworking of the model has led to a 
> >>> reduction in these historical influences, some parts of the model 
> >>> still hark back to the days of punch cards, FORTRAN 66 and line 
> >>> printer output. A charitable interpretation would be that while 
> >>> embracing the new (FORTRAN 90/95, multi-processing, netcdf, etc.), we 
> >>> endeavour to maintain some of the more harmless GISS traditions 
> >>> (which some might call eccentricities) in a spirit of continuity with 
> >>> those who have previously worked on the model. On the other hand, 
> >>> some of those early decisions (for instance regarding diagnostics, or 
> >>> conservation properties) turned out to be very far-sighted and are a 
> >>> principle reason why the GISS series of models continue to play a 
> >>> useful and important role in the world of GCM simulations." 
> >> 
> >> A quick look at a few randomly selected files from the 
> >> code at https://simplex.giss.nasa.gov/snapshots/ 
> >> did not show very old code - lots of 90 and some 
> >> 77 upgraded to 90. 
> > 
> > Hmm, I'm not sure about that: 
> > 
> > : chandra; pwd 
> > /Users/cross/Downloads/modelE2_dev/model 
> > : chandra; cloc . 
> > 613 text files. 
> > 568 unique files. 
> > 26 files ignored. 
> > 
> > github.com/AlDanial/cloc v 1.92 T=1.67 s (340.1 files/s, 279550.2 lines/s) 
> > ------------------------------------------------------------------------------- 
> > Language files blank comment code 
> > ------------------------------------------------------------------------------- 
> > Fortran 77 361 30746 86473 272461 
> > Fortran 90 175 9720 14530 50033 
> > C/C++ Header 11 264 0 1148 
> > make 13 130 36 418 
> > Korn Shell 1 31 35 128 
> > m4 3 56 312 127 
> > Pascal 2 1 0 120 
> > C 2 33 27 78 
> > ------------------------------------------------------------------------------- 
> > SUM: 568 40981 101413 324513 
> > ------------------------------------------------------------------------------- 
> > : chandra; 
> > 
> > I took a peak at a few files; it seems pretty archaic to me.
> If you look at the .f files that are supposedly 77 then 
> it really just are old fixed format - the code are full of 
> 90 features. 
> 
> Example advc1d.f - code starts in column 7, comments are 
> a c in column 1 - but the code would not build with 77. 
> 
> Declarations like: 
> 
> integer, intent(IN) :: kk 
> 
> Loops like: 
> 
> do k=1,kk 
> ... 
> end do 
> 
> Arne

As they said, they kept the "spirit" of some of the older code while embracing newer FORTRAN. :)

If they've been using some sort of source control software then it makes sense..

Rewriting bits to take advantage of F90 features while maintaining old-style formatting gives you meaningful diffs.  If you go in to fix a bug or to improve the physics in a chunk of the code might as well take advantage of newer constructs.  That chunk is going to show up in a diff whether or not you do so.

But taking advantage of the freedom to not start statements in column 7, etc, and reformatting whole files will yield diffs that essentially say  "yep, the entire files are different".  Not very useful for tracking the history of changes, it would for all practical purposes reset the baseline to the moment at which the file was reformatted.

Mixing styles within a single source file would just be confusing, there's something to be said for consistency.




More information about the Info-vax mailing list