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

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

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:

#IFDEF PARALLEL
  class(Mesh_Type) ,codimension[*] ,intent(inout)  ::      This
#ELSE
  class(Mesh_Type)                 ,intent(inout)  ::      This
#ENDIF

Is there a better way to do it?

Thanks

4 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de Steve Lionel (Intel)

Sorry, no.

Steve
imagem de jimdempseyatthecove

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

www.quickthreadprogramming.com

Yes, it is indeed much cleaner !!!

Thanks Jim

Faça login para deixar um comentário.