English 中文(简体)
Pre-processing !DEC$ directives in gfortran
原标题:

I ve got a large Fortran codebase that originally targeted Intel s compiler. I m now gearing up to compile with gfortran. Unfortunately, the code is littered with Intel-style pre-processing directives like:

!DEC$ IF DEFINED (MYDIRECTIVE)
   REAL, DIMENSION(:,:,:), ALLOCATABLE :: my_real_var
!DEC$ ENDIF

From what I can tell via googling and the gfortran docs, there is no internal gfortran support for anything besides C-style pre-processing, like:

#if defined MYDIRECTIVE
   REAL, DIMENSION(:,:,:), ALLOCATABLE :: my_real_var
#endif

Has anyone else encountered this problem and come up with an elegant solution? Obviously, I could write a shell script which calls an external pre-processor before passing code to gfortran for compile, but this just doesn t seem like a terrific solution to me.

Any thoughts? Thanks SO gurus!

问题回答

Intel ifort understands the C-style preprocessor directives, so it might be easiest to convert your files to that style. Then you would have a single code base that would work with both compilers. There would be some work regression testing the converted code with ifort.





相关问题
How do I fix this Fortran text parser for Lapack within Gem5

After about an hour, I need to ask for some help. I ve downloaded the math benchmark Lapack to run within a few CPU configurations for the simulation tool Gem5, which lets you build X86 computers and ...

gfortran, DLL, underscore

I want to access some subroutines from a third party DLL. The functions use STDCALL as the calling convention. Running dumpbin /export foo.dll gives me something like: ... 7 6 ...

Getting started with a new code in an unfamiliar language

I m starting a new project in a language I m less familiar with (FORTRAN) and am in the discovery phase. Normally reading through and figuring out code is a fairly simple task, however, this code ...

assigning values to an integer array within a Fortran module

I have a module in Fortran called QFoo. It defines a type QFooType. I want to initialize all the elements of integer array is_n to 0 and want to do it within the module. Could someone help? Thank ...

WinDbg and Intel Visual Fortran

Has anyone used WinDbg to debug an Intel Visual Fortran routine? If I have the Fortran source file that crashes with an AccViol, how can I use WinDbg to determine the line that is crashing?

converting MATLAB code to Fortran [closed]

I a medical researcher with code written in MATLAB 2009b that runs very slowly because of a self-referential loop (not sure of the programming lingo here), i.e., the results of the first iteration is ...

热门标签