Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

How to retrieve compilation options the code has benn compiled with at run-time

FlyingHermes
New Contributor I
703 Views

Hi,

Is there a way to retrieve the compilation options a given fortran code has been compiled with.

In particular, I'm  interested in knowing if the code is being run in parallel using the "-coarray" option.

If so, some variables need to have the "codimension" attribute in their declaration.

For the time being, I added these lines in my Make.inc file which is included in my Makefile:


PARALLEL=on
ifeq ($(PARALLEL),on)
      PARALLEL_FLAG= -coarray -coarray-num-images=2 -DPARALLEL
else
      PARALLEL_FLAG=
endif
FFLAGS= ... (OTHER COMPILATION OPTIONS) ... $(PARALLEL_FLAG) -fpp

The source code is being preprocessed (option "-fpp") and the "PARALLEL" keyword is defined (option "-DPARALLEL")

Then, in my source code, I'm using the following preprocessing conditional structure:

[fortran]
#IFDEF PARALLEL
  class(Mesh_Type) ,codimension

  • ,intent(inout)  ::      This
    #ELSE
      class(Mesh_Type)                 ,intent(inout)  ::      This
    #ENDIF
    [/fortran]
  • Is there a better way to do it?

    Thanks

    0 Kudos
    3 Replies
    Steven_L_Intel1
    Employee
    703 Views

    Sorry, no.

    0 Kudos
    jimdempseyatthecove
    Honored Contributor III
    703 Views

    If you are using FPP you could

    #ifdef PARALLEL
    #define _CODIMENSION_   ,codimension


  • #else
    #define _CODIMENSION_
    #endif
  • ...

    class(Mesh_Type) _CODIMENSION_ ,intent(inout)  ::      This

    A lot cleaner than using #if... and/or !DEC$ IF...

    Jim Dempsey

    0 Kudos
    FlyingHermes
    New Contributor I
    703 Views

    Yes, it is indeed much cleaner !!!

    Thanks Jim

    0 Kudos
    Reply