Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Intel Fortran Static Library with OpenMP enabled

Antonio_R_1
Beginner
901 Views

Hello,

In our group, we work with different versions of Intel Visual Fortran. Recently, we have included some parallelization directives in some subroutines. It seems that when we create a static library with an older version of Intel Fortran that includes OpenMP parallelization, this library cannot run properly in a new version of Intel Visual Fortran, producing a run-time error. Is this normal? Would it be any way around it? When we do not include processing for OpenMP directives, the functioning of the library is proper. Thank you very much.

0 Kudos
6 Replies
Steven_L_Intel1
Employee
901 Views

What is the complete and exact text of the run-time error? I know that in older versions of the compiler we supplied a static library version of the OpenMP support but now we supply only DLL libraries for OpenMP/ If multiple libraries were active I could see a problem but I'm having difficulty seeing how you'd get there with a static library, unless you did something truly silly such as tell the librarian to include all the dependent libraries. 

It would be helpful to understand the problem if you'd tell us WHICH versions of the compiler are used (to compile the library and to build the application), the full error message and a copy of the .vfproj file for your static library and an application where it gets a failure.

0 Kudos
jimdempseyatthecove
Honored Contributor III
901 Views

If (for some reason) your older Fortran compiled program is relying on an older Intel Fortran OpenMP .DLL which is experiencing compatibility issues with the newer Intel Fortran OpenMP .DLL, then you may need to obtain the appropriate OpenMP .DLL from the Intel Redistributables for that version of Intel Fortran, and then insert a copy of that into the folder along side of the executable.

Also note that, older versions of Windows XP did not support the Windows GetLogicalProcessorInformation system function call. This function was provided in the newer versions of KERNEL32.dll. If the newer version of the OpenMP library is expecting (requiring) this function, the KERNEL32.dll will load successfully, but the address for GetLogicalProcessorInformation will resolve to address 0. And then the call will fail with the program counter at or near location 0. A corrected version of the library making the GetLogicalProcessorInformation system function call should query the system for the entry point and test for NULL pointer. If NULL pointer then take an alternate path (or avoid using KMP_AFFINITY settings).

Jim Dempsey

0 Kudos
Antonio_R_1
Beginner
901 Views

Hello Steve and Jim,

Thanks for your comments. We have three versions of Intel Visual Fortran: 2011, 2013, and 2015. I could create an OpenMP, multithreaded static library in the 2013 version and compile it in the 2015 version. However, we face problems when creating the static library in the 2011 and compile it in the 2015 version (I did nor try this with the 2013). The reason why I suspect is a problem with the "Generate parallel code" option is because if we disable this option when generating the static library in the 2011 version, the library will run without any problem in the other versions. What is more, when we select "Generate parallelized code" when creating the static library in the 2011 version, and we do not call parallelized subroutines (we have a logic to avoid parallelized subroutines), the library still does not work. We are using Windows 7 and 8. Is this related to not having a dll in IVF 2011? Any other ideas?  Thank you!

0 Kudos
Steven_L_Intel1
Employee
901 Views

Antonio, you still have not said what "does not work" means.

My guess is that you are dealing with the removal of the static library version of the OpenMP libraries in the Fortran product. If you compile the static library in the old version and do not set the project property Fortran > Libraries > Disable OBJCOMMENT Library Names in Object to Yes. If this is No, then the object files in the libraries will have references to libiomp5mt.lib. Applications built with later versions will reference the OpenMP DLL libraries and this will mean two copies of the OpenMP libraries in the program address space. (But to do this would mean that you're also supplying the old libiomp5mt.lib to link against.

Typically for static libraries I recommend disabling OBJCOMMENT directives and letting the executable project determine which libraries to link to.

0 Kudos
Antonio_R_1
Beginner
901 Views

Hello Steve,

The library generated enabling OpenMP directives and multithreaded runtime library on IVF 2011 causes the run time error: "Access violation reading location 0x00000000". That's what I meant by "does not work". As you mentioned, we had not disabled "OBJCOMMENT library names". But even when the static library is created enabling the option "Fortran > Libraries > Disable OBJCOMMENT Library Names", the outcome is the same.

I think I kind of understand what you said, but, can you elaborate on "but to do this would mean that you are also supplying the old libiomp5mt.lib to link against"? I also found another post which may be related to this issue (https://software.intel.com/en-us/forums/topic/277937) .

If, by any chance, you have any other recommendation, that would be very much appreciated. Otherwise, I guess we would need to use newer versions of IVF.  Thank you.

Antonio

0 Kudos
Steven_L_Intel1
Employee
901 Views

I was wondering if the executable gets multiple copies of the OpenMP library (libiomp5) due to linking against both static and DLL forms. Your disabling OBJCOMMENT and the problem not changing tells me that is not the issue, so ignore what I said about libiomp5mt (unless you are telling the end user to explicitly link to that library.)

I don't think we can do much more for you based on just the problem description. It could be that there's some issue with compiled code from the old compiler interacting with newer OpenMP support, but that's supposed to work. If you can provide a test case to Intel Premier Support we can look at it.

I don't see that you say what happens if you compile everything with the newer compiler.

0 Kudos
Reply