jamesorr / mocsy

Routines to model ocean carbonate system thermodynamics
MIT License
18 stars 15 forks source link

GSW compilation errors with Intel Fortran Compiler #6

Open jkrasting opened 7 years ago

jkrasting commented 7 years ago

The file gsw_mod_saar_data.f90 fails on compilation using the Intel Fortran Compiler v16.

catastrophic error: Statement too long

I suspect that the lines containing the data values are too long.

pearseb commented 6 years ago

I have found the same issue. I had a quick look online and apparently the maximum length of lines in the ifort compiler is hard coded.

jamesorr commented 6 years ago

@pearseb @jkrasting This issue has been resolved. ifort has a hard limit on the number of continuation lines, and that was the problem for data statements for the three largest variables in gsw_mod_saar_data.f90. That routine has now been corrected by concatenating, for each variable, all those continuation lines into one. The ifort compiler has no limit on the length of an individual line. The latest version of mocsy (v2.3.5) includes these corrections.

jamesorr commented 4 years ago

@pearseb @jkrasting @hylandg As opposed to what is said in my commt on Oct 21, 2017, the issue was not resolved. Unlike what is said, ifort does have a limit of 7200 characters for the length of an individual line. There is no general work-around for that, even though other compilers do offer solutions. Recently though, another mocsy user pointed to the same problem. After investigating and looking at more recent developments with the GSW package, I found a solution that was already implemented in the FV3 Bundle at http://academy.jcsda.org/doxygen-example/namespacegsw__mod__saar__data.html For that solution, a revised version of https://github.com/jamesorr/mocsy/blob/master/src/GSW/gsw_mod_saar_data.f90 was built from the original GSW netCDF file that contains that data, using a python script https://github.com/jamesorr/mocsy/blob/master/src/GSW/make_saar_data.py.
Thus, in the just released version 2.4.1 of mocsy, I have now included the updated https://github.com/jamesorr/mocsy/blob/master/src/GSW/gsw_mod_saar_data.f90 routine as well as the corresponding python script. Furthermore, I shortened many lines in the data statements of the fortran routine by replacing duplicate values of the mask with the more concise multiplicative notation (e.g., writing 8*9e90_r8 instead of writing out that number 8 times separated by commas. The overall size of that very large routine is now down by about 30%. Minor changes were also necessary in another GSW routine https://github.com/jamesorr/mocsy/blob/master/src/GSW/gsw_saar.f90 As a result, mocsy can now be compiled with ifort.