Skip to content

Port to flang and F90 compliance of madgraph fortran codebase #804

@valassi

Description

@valassi

Hi @oliviermattelaer , as part of PR #801 for porting to LUMI with AMD GPUs, I am experimenting with flang as a fortran compiler.

(I am using flang because I get several issues with gfortran... linking c++, fortran and hip code seems rather complex, see for instance #802).

I managed to use the /opt/rocm/llvm/bin/flang compiler for the standalone code, where there is very limited fortran. But the moment I try building madevent, it's just a catastrophe (see below*).

I guess that this flang does not support F77, or at least all the legacy f77 stuff in madevent. This is not a blocker per se, but something to keep in mind. I think flang looks like the future of fortran compilers. Maybe more features will be added, maybe not.

In my understanding (I may be wrong), the flang I am testing is the "new flang" aka f18, a rewrite from the grounds up of the flang compiler in c++. See https://github.com/llvm/llvm-project/blob/main/flang/README.md#getting-started. The features supported are here I think https://github.com/llvm/llvm-project/blob/main/flang/docs/Extensions.md. (For comparison, the "old flang" or "classic flang" is here https://github.com/flang-compiler/flang).

I am trying to check if I can do anything with it, but I guess on LUMI we need to go back to gfortran and massage all link issues. (@Jooorgen in case you read this, any suggestion on what combination to use? thanks)

Andrea

PS *One example, for myamp

ccache /opt/rocm-5.2.3/llvm/bin/flang -w -fPIC -O3 -ffast-math -fbounds-check -ffixed-line-length-132 -w -cpp -c myamp.f -I../../Source/ -I../../Source/PDF/g\
ammaUPC
F90-S-0023-Syntax error - unbalanced parentheses (../../Source/genps.inc: 9)
F90-S-0087-Non-constant expression where constant expression required (../../Source/genps.inc: 25)
F90-S-0087-Non-constant expression where constant expression required (../../Source/genps.inc: 27)
F90-S-0034-Syntax error at or near end of line (../../Source/run.inc: 10)
F90-S-0023-Syntax error - unbalanced parentheses (../../Source/run.inc: 55)
F90-S-0023-Syntax error - unbalanced parentheses (../../Source/run.inc: 56)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 83)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 117)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 132)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 152)
F90-S-0038-Symbol, mue_over_fixed_ren_scale, has not been explicitly declared (myamp.f)
F90-S-0038-Symbol, fixed_fac_scale2fixed_couplings, has not been explicitly declared (myamp.f)
F90-S-0038-Symbol, hmdynamical_scale_choice, has not been explicitly declared (myamp.f)
F90-S-0038-Symbol, ievo_eva, has not been explicitly declared (myamp.f)
F90-S-0038-Symbol, n_pdfrw, has not been explicitly declared (myamp.f)
F90-S-0038-Symbol, i_pdgpdf, has not been explicitly declared (myamp.f)
F90-S-0038-Symbol, s_xpdf, has not been explicitly declared (myamp.f)
F90-S-0038-Symbol, s_qpdf, has not been explicitly declared (myamp.f)
  0 inform,   0 warnings,  18 severes, 0 fatal for cut_bw
F90-S-0023-Syntax error - unbalanced parentheses (../../Source/genps.inc: 9)
F90-S-0087-Non-constant expression where constant expression required (../../Source/genps.inc: 25)
F90-S-0087-Non-constant expression where constant expression required (../../Source/genps.inc: 27)
F90-S-0034-Syntax error at or near end of line (../../Source/run.inc: 10)
F90-S-0023-Syntax error - unbalanced parentheses (../../Source/run.inc: 55)
F90-S-0023-Syntax error - unbalanced parentheses (../../Source/run.inc: 56)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 273)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 275)
F90-S-0050-Assumed size array, spole, is not a dummy argument (myamp.f: 283)
F90-S-0050-Assumed size array, swidth, is not a dummy argument (myamp.f: 283)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 298)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 323)
F90-S-0034-Syntax error at or near end of line (myamp.f: 370)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 396)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 399)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 410)
F90-S-0034-Syntax error at or near end of line (myamp.f: 422)
F90-S-0034-Syntax error at or near . (myamp.f: 429)
F90-S-0023-Syntax error - unbalanced parentheses (myamp.f: 436)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions