- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
for fortran there is an option of setting the functions/subroutines in an offload region as follows:
!dir$ offload attributes: mic:: func_or_sub_name
I have two questions about this option:
1) does it have to be changed somehow for fortran 77?
2) is there any recursive of this so that for example if I specify it to the uppermost function or subroutine it will automatically apply it to all the functions or subroutines called inside that function or subroutine?
Thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re 1), I think your asking about fixed-form vs. free-form Fortran source, but, if not could you clarify?
With the Intel compiler, fixed-form source can use either the ! or C forms as in:
! This form works in fixed-form source cdir$ attributes offload : mic:: func_or_sub_name subroutine sub call func_or_sub_name end ! And so does this form !dir$ attributes offload : mic:: func_or_sub_name2 subroutine sub2 call func_or_sub_name2 end
Re 2), the directive applies to the scope in which it appears or scope immediately following the directive. It is not recursive and you must explicitly list each subprogram to which it applies in the associated scope.
You can apply such an attribute to all subprograms in a single source file via the command-line option: qoffload-attribute-target, Qoffload-attribute-target
Note: The option syntax above applies to the IPS XE 2015 release (with 15.0 compiler). For earlier releases you need to use the deprecated form: offload-attribute-target, Qoffload-attribute-target
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're welcome.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i used the "-offload-attribute-target=mic", and it worked. but i also got the following type of warnings:
prog1.f (112): warning #8553: A procedure called by a procedure with the OFFLOAD:TARGET
attribute must have the OFFLOAD:TARGET attribute. [dcalc]
EXTERNAL dcalc
is there a way to address this? thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It "works" to declare routines within the source file (at their point of definition) as callable from within an offload region but you still must add the !dir$ attributes offload : mic :: dcalc within the scope where that routine is called, and that is true for any other routine too or you will receive this warning.
In the example from my previous post, if I compile using the -qoffload-attribute-target=mic option, sub and sub2 become callable from within an offload region, but I still must use the !dir$ attributes offload within each of their scopes for func_or_sub_name and func_or_sub_name2 to silence the warning #8553. The added directive just assures the compiler func_or_sub_name and func_or_sub_name2 have been properly declared with the attributes offload at their point of definition. It is just a warning and thus if I was certain the source file containing their definitions was compiled with the -qoffload-attribute-target=mic option, then I could ignore the warning.
If you are certain the source file containing dcalc's definition was compiled with the -qoffload-attribute-target=mic option, then you could choose to ignore the warning.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, thanks a lot!
Sorry, but I have a last question regarding this. If i have specified "!dir$ atrributes offload : mic ::" only for a single function or subroutine inside a source file, then there is no need to put the "-offload-attribute-target=mic" while compiling. Am i right? Thanks!

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