- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the way to write a Fortran source file that contains only one module and that only has interface declarations to routines that are callable as either host or offload.
I tried:
module foo interface subroutine foobar !dir$ attributes offload : mic ::foobar end subroutine foobar ... end interface end module foo
When I subsequently USE foo elsewhere, I found I must still add:
!dir$ attributes offload : mic :: foobar
In the routine that performs the call
If I move the !dir$ up a line in the module the compiler complains. I haven't tried adding an additional !dir$ addributes offload : mic :: for each of the routines outside the interface block. Is this the missing trick?
Jim Dempsey
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For Fortran, in general, the unit of scope is the subroutine or function, but in the case of interfaces, I believe the unit of scope is the interface block. So try putting the attribute directive immediately before the interface statement and see what happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Frances, I will give that a try when I clean up the code.
Do you know how to force the Intel static library "fat" routines into my "fat" DLL? I am having an issue with for_check_mult_overflow64 being unresolved when the offload loads in performing the dlopen(). It dies on that first, I imagine there will be a bunch of others later. This fails even with the/libs:static.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you mean you want to extract a fat object from a .lib file and move it to a .dll file? I don't think you can. If you mean you want to build a dll file from scratch that will contain fat binaries, have you tried adding -fPIC to "Additional Options for MIC Offload Compiler" if you are using the IDE or Qoffload-option,mic,compiler,"-fPIC" if you are compiling from the command line? If you mean you have a fat binary in a .lib file and the loader isn't finding it, I don't quite understand why it wouldn't, so I have no answer for that right now. But then I don't know much about library search paths on Windows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Frances,
Yes, I have added -fFIC. The problem I am having (I will try to put it in a nut shell), read the complete problem statement, not sentence by sentence:
When compiling a Fortran PROGRAM that uses the DLL in question, the loading of the "fat" portion of the binaries does something that resolves the dlopen() issue.
When compiling a non-Fortran PROGRAM that uses the DLL in question, the loading of the "fat" portion of the binaries does nothing that resolves the dlopen() issue.
Is there an additional option, perhaps -verbose, that will show the man behind the curtain. I'd look this up myself, but your guides have circular references in this regards, and/or incomplete information.
Example: https://software.intel.com/en-us/node/522801
Look under and to right of [Documentation Feedback]
The following shows a valid example for the Windows* link tool:
/Qoffload-option,mic,link,"--no-undefined \"C:\Program Files (x86)\Intel\Composer XE 2015\mkl\lib\mic\libmkl_intel_lp64.a\""
(replacing the lib....a with one I suspect I want, libifcoremt.a)
Just where do you place that into a VS solution:
If it is in the additional command line options for the compile, then the compiler tries to compile the .a file,
Placed on the additional options for MIC linker, then the /Qoffload.. is not a valid option, nor can the file be found.
Placed on the Linker options doesn't work either.
I suspect that even if I can resolve the link with xxx.a issue, I suspect I will still have the issue of the libifcoremt.a referencing something.so, and that this file will not be copied (possibly to the current directory of the offload process within the MIC, wherever that is.
Note, when building a Fortran PROGRAM, all of this is auto-magically done. When constructing a Fortran .DLL with offloads, but without a Fortran PROGRAM, the necessary steps are missing.
Please ask someone in the know at Intel, on Windows, how does the Fortran Program specify where to find and which xxx.so files are to be loaded into the "fat" portion of the program, such that upon start of the offload load (either beginning of program or at first offload), that the necessary .so files are available to dlopen().
Knowing this, then I might be able to apply this to a .DLL that will be run without a Fortran "main" PROGRAM.
Jim Dempsey

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