- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
#ELSE
class(Mesh_Type) ,intent(inout) :: This
#ENDIF
[/fortran]
Is there a better way to do it?
Thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, no.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it is indeed much cleaner !!!
Thanks Jim

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page