modelon-community / Assimulo

Assimulo is a simulation package for solving ordinary differential equations.
https://jmodelica.org/assimulo/index.html
GNU Lesser General Public License v3.0
66 stars 16 forks source link

ftbfs gcc 10 rank mismatch #16

Closed jschueller closed 2 months ago

jschueller commented 3 years ago

build fails with gfortran 10 unless adding the -fallow-argument-mismatch flag

Mathadon commented 2 years ago

Bug fix in Assimulo/thirdparty/hairer/radau_decsol.f line 3140:

       IMPLICIT REAL*8 (A-H,O-Z)
       DIMENSION FJAC(LDJAC,N),FMAS(LDMAS,NM1),E1(LDE1,NM1),
      &          E2R(LDE1,NM1),E2I(LDE1,NM1),IP1(NM1),IP2(NM1),
-     &          IPHES(N),Z1(N),Z2(N),Z3(N),F1(N),F2(N),F3(N)
+     &          IPHES(N),Z1(N),Z2(N),Z3(N),F1(N),F2(N),F3(N),CONT(N)
       COMMON/LINAL/MLE,MUE,MBJAC,MBB,MDIAG,MDIFF,MBDIAG
 C
       GOTO (1,2,3,4,5,6,7,55,55,55,11,12,13,13,15), IJOB

Background info: https://gcc.gnu.org/gcc-10/porting_to.html

After this fix, new errors are generated though

assimulo/thirdparty/hairer/radar5.f90:1662:58:
               CALL BPDTCT(N,X,HP,Y,ARGLAG,RPAR,IPAR,UCONT,GRID,NLAGS,
                                                         1
Error: Dummy argument ‘grid’ with INTENT(IN) in variable definition context (actual argument to INTENT = OUT/INOUT) at (1)
assimulo/thirdparty/hairer/radar5.f90:2155:54:
  CALL BPDTCT(N,X,HP,Y,ARGLAG,RPAR,IPAR,UCONT,GRID,NLAGS,
                                                   1
Error: Dummy argument ‘grid’ with INTENT(IN) in variable definition context (actual argument to INTENT = OUT/INOUT) at (1)
Mathadon commented 2 years ago

And then some more:

Error: Type mismatch in argument ‘iwk’ at (1); passed REAL(8) to INTEGER(4)
assimulo/thirdparty/odepack/opkdmain.f:3222:3:
  80   LYH = LYHN
   1
Warning: Label 80 at (1) defined but not used [-Wunused-label]
assimulo/thirdparty/odepack/opkda1.f:9499:72:
      2   RES, JAC, ADDA)
                                                                       1
Error: Type mismatch in argument ‘iwk’ at (1); passed REAL(8) to INTEGER(4)
assimulo/thirdparty/odepack/opkdmain.f:16015:3:
 80   LYH = LYHN
  1
Warning: Label 80 at (1) defined but not used [-Wunused-label]

...

many more like this
jschueller commented 2 years ago

hi @Mathadon, could you come up with a patch and submit it ?

Mathadon commented 2 years ago

@jschueller the first errors were pretty simple but the last ones require more detailed analysis of the underlying algorithm to make sure that I don't break something. If there are unit tests that I can run then I could give it a shot but some feedback on that from someone who is more familiar with the project would be great. I see you have made some commits. Do you perhaps have more information about this?

jschueller commented 1 year ago

there are automated unit tests enabled on the repo now, do you want to give it another go ?

chria commented 1 year ago

I believe we will need to add a compiler flag for this work as I think it is substantial work to get this code working with later compilers. There is the gfortran flag std=legacy that can be used. If it is applied, compilation will work.

python setup.py install --extra-fortran-compile-flags="-std=legacy" ...

We should likely add this as standard in the setup script that this should always be applied.

PeterMeisrimelModelon commented 2 months ago

Resolved in https://github.com/modelon-community/Assimulo/pull/97; added --std=legacy as default compile flag.