- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to compile a Fortran program that uses coarray features in such a way to be able to distribute it to users (who will not have oneAPI or Visual Studio installed) and expect to be able to just double click the executable file.
When using the `/libs:static` option, programs that don't use coarray features can be run by double clicking on the executable, even if compiled with the `/Qcoarray=single` option, whereas without `/libs:static` you get errors like "libifcoremd.dll was not found". However, as soon as you use any coarray feature, even something as simple as `this_image()`, it can't be executed that way even still compiling with `/Qcoarray=single`. I have to execute it from a command prompt in which I've run the `setvars.bat` script or else it says that it can't find `libicaf.dll`.
Is there a compiler flag to statically link in libicaf? I would think it should be possible, since there is a `libicaf.lib` file in the oneAPI installation directory. Or is that one of those "not actually a static library" static libraries?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The coarray support is supplied only as a DLL on Windows. The solution is to provide the Intel redistributables installer (also known as Standalone Component Runtime) to the end-user, or even install it as part of your own installation procedure. Intel® oneAPI standalone component installation files
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The existence of libicaf.lib is not a guarantee. On Windows there are two different types of libraries: regular static libraries that contain the actual object code and so-called import libraries that merely contain interfacing information. I am rather certain that the file(s) libicaf.lib in the distribution are import libraries - they are used by the compiler/linker to identify the bits and pieces in the corresponding DLLs it needs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The coarray support is supplied only as a DLL on Windows. The solution is to provide the Intel redistributables installer (also known as Standalone Component Runtime) to the end-user, or even install it as part of your own installation procedure. Intel® oneAPI standalone component installation files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Slightly disappointing, but understandable. Thanks for the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OpenMP support is the same - but the static library still exists on Linux. I never understood why there was a difference. If I recall correctly, coarray support was always DLL-only on Windows, but there used to be a static OpenMP library. I know that static libraries can cause problems with mixed library builds, and I generally recommend DLL linking, but sometimes a static library is the right solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use some coarray feature as DLL, simple as `this_image()`, but it's show the error in libicaf.Dll when I call from C#. How to slove it ? Thanks in advanced!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's an access violation, and it looks like the code jumped to an invalid address. My first guess would be something in your program is corrupting data used by the coarray support. There is no simple solution here and data corruption is one of the hardest problems to analyze. I usually recommend disabling parts of the program, piece by piece, and see if the symptom changes or goes away. You should also enable full run-time checking.
That the error names libicaf.dll does not necessarily mean that the error is in that DLL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply.
I use the simple coarry feature as dll:
module HelloMode
implicit none
contains
subroutine hello()
!DEC$ ATTRIBUTES DLLEXPORT::hello
!DEC$ ATTRIBUTES STDCALL,ALIAS:'hello'::hello
write (*,*) 'Hello from image ',this_image(), "NumImage: ",NUM_IMAGES()
end subroutine
end module
and call the dll from C#:
namespace WinFormsApp1
{
public class LoadDll
{
[DllImport("Dll1.dll", EntryPoint = "hello", CallingConvention = CallingConvention.StdCall)]
public static extern void hello();
}
}
The error:
My question: Is the coarry feature support as dll?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At the moment, coarray support requires that the main program be in Fortran. Perhaps you can write a jacket program in Fortran that calls into C# and then calls your DLL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately you can't (at least at present) call coarray Fortran code from another language if the main program isn't in Fortran. The different images (the Fortran term for threads or processes) must be launched at program startup and stopped at program end, but other languages won't know to do this, and there isn't a way to do it manually before and after calling specific procedures. I suspect that's why you're getting an error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortan does support an option, /Qcoarray:single, which omits the "launch" code, therefore requiring that you do your own mpirun (or whatever). But I think this still won't do what you want, as there is some setup code in the main program that still has to run, and I'm not aware Intel has published the specs for how to do this yourself.
At some point in the future, I expect compilers will evolve capability to put coarray code in libraries, enabled by the "teams" feature in Fortran 2018.

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