1

This question is related to compiling OpenMP capable Fotran77 (combined with some C libraries) fixed form code with gfortran -fopenmp.

This answer discusses that while continuing to the next line in case the required column exceeds 72, the correct directive to use in the next line for an OpenMP capable code is the c$omp& sentinel. For example,

code A

C$OMP PARALLEL SHARED(Lm,Mm, pm,pn, f,f_q, fnd_rmask,rmask, dm_u,dn_v,
& iA_q)

is an incorrect fixed form Fotran77 code portion.

Whereas, this webpage and this answer says that the correct form is

code B

C$OMP PARALLEL SHARED(Lm,Mm, pm,pn, f,f_q, fnd_rmask,rmask, dm_u,dn_v,
C$OMP& iA_q)

However, there is a need where I will have to live with code A (don't ask me now, I can explain if someone is interested) which gives me an error with the gfortran compiler (screenshot attached). This answer also says that ifort does not give any error even if we do not start the next line with the c$omp& sentinel similar to code A. (I do not have ifort and have not tried it myself.)

Error compiling with gfortran

My question: is there a way (or any compiler flag) by which I can make gfortran compile happily with code A? If ifort can live with it, can't gfortran too? I can't believe that there is no compiler directive to override all of this. (This does not mean I am questioning the abilities and principles of gfortran developers)

RTh
  • 107
  • 1
  • 1
  • 4
  • 2
    Because ifort has an extension to the relevant standards that gfortran doesn't. You've run into why use of extensions often make life more harder in the long run. My advice? Fix it. Make it what the standard says it should be. Then you need never worry about it again. A quick bit of scripting can probably do it. – Ian Bush Oct 05 '20 at 10:03
  • 1
    It's probably unreasonable to expect a compiler directive/option for each possible incorrect code fragment. Looking to fix the code, or using the compiler that was targeted by the broken code, would be a better investment in the long run – francescalus Oct 05 '20 at 10:06

1 Answers1

0

Without changes to your source code, the answer to your first question is NO.

The answer to your second question is maybe. At the moment, gfortran does not support an Intel extension. gfortran is part of GCC, which is open-source software. You can download the software. Add an new option, say, -fIntel-openmp-syntax. Once you have this working, your submitted patch may be committed to the source code repository.

evets
  • 996
  • 1
  • 5
  • 6