barronh / DSMACC

Dynamically Simple Model of Atmospheric Chemical Complexity
https://github.com/barronh/DSMACC/wiki
GNU General Public License v3.0
19 stars 7 forks source link

MCM v3.3.1 compilation issues #3

Open barronh opened 5 years ago

barronh commented 5 years ago

SH brought it to my attention that DSMACC was failing to compile with the latest version of MCM (v3.3.1). It turns out that the problem has to do with line continuations in the dsmacc_LinearAlgebra.f90 generated code. There may or maynot have been a warning that these lines were getting split and possibly violating expression syntax being broken into chunks.

Simplistic example:

I'll pretend that the maximum line length is 13 and the maximum number of line continuations is 0.

X(1) = (A + B + C) / D

KPP would try to split the assignment into two pieces.

X(1) = (A + B
X(1) = X(1) + C) / D

This is generally far more complex because DSMACC used 500 as the maximum line continuations. The 2008 Fortran standard allows for 255, but compilers vary on how many they support (intel: 511, gfortran: really large?).

To support MCM v3.3.1 without manual code modification we would need to increase the line continuations to 2000ish. This would not be compatible with certain compilers.

I believe that more users will want automatically generated code, which might fail to compile. If it fails to compile, the user could manually split the lines.

My recommendation is to increase the max line continuations to 2000.