Software Archive
Read-only legacy content
17061 Discussions

Fortran vs. C offload directives: push/pop

james_B_8
Beginner
384 Views

I've noticed in the article:

http://software.intel.com/en-us/articles/fortran-vs-c-offload-directives-and-functions

That there is a convenient way to mark entire files for offload using the 'offload_attribute push/pop' pragma in c and c++. However there apparently doesn't appear to be an equivalent for fortran. This seems like an very useful feature...

Is there an equivalent way of doing this with the Fortran directives that I'm missing? If not, why is this functionality not available?

0 Kudos
2 Replies
Leonardo_B_Intel
Employee
384 Views

Hello,

Have you looked at the OPTIONS directive?
The Fortran !dir$ options directive accepts the command-line option "/offload-attribute-target=<target> ".
This option enables assigning a <target> attribute to a section of a program declarations appearing between a !dir$ options /offload-attribute-target=<target> and !dir$ end options directive. The declarations can contain interface definitions and variable declarations.
The syntax is:

!dir$ options /offload-attribute-target=mic
<declarations...>
!dir$ end options

A couple of examples can be found within /opt/intel/composerxe/Samples/en_US/Fortran/mic_samples/LEO_Fortran_intro/leoF09_subprograms.F90

Best,
Leo.

0 Kudos
Frances_R_Intel
Employee
384 Views

Unlike C/C++, the !dir$ directives cannot be used independently of individual program units. Or at least, as far as I know, there are no directives that can be used like that. So, you cannot bracket a group of functions, subroutines, modules, etc. with a !dir$ / !dir$ end pair. This kind of mirrors one of the underlying differences between C and Fortran. C has a file scope; in Fortran there really isn't a file scope.

There is also the compiler directive -offload-attribute-target=mic, but that doesn't give you the level of control you were asking for. I'll see that the !dir$ options /offload-attribute-target=mic gets added to the that web page.

0 Kudos
Reply