Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

Why Intel C++ compiler can not be parallelized when calling a library

shiquanhe1984gmail_c
318 Views

Hi, All,

When I develop a parallelized CEM code compiled with the Intel C++/Fortran compiler, I encounter two problems (my code is compiled and running on Linux Platform):

1. I need use some functions in Linpack library. So I make it as a static lib, and then call it in my main program. However, if the static lib is generated with gfortran compiler, while the main code is compiled with icpc, a segment error occurs when main program calls this library. So, the question is: Can a main program compiled with Intel compiler call a library generated with gcc or gfortran, or vice verse?

2. When both the main program and library are compiled with gcc/gfortran, in a for loop, the calling of library can be parallelized with OpenMP. However if both of them are compiled with Intel complier, the for loop can not be parallelized. Only one thread is permitted to call the library.

Any one knows how to solve these problems? Thanks so much!

Best Regards,
Shiquan He

0 Kudos
1 Reply
aazue
New Contributor I
318 Views
Hi
Sometime I merge lib different origin compiler without problem
Probably when you call lib you must inform (path file header of lib origin precise of the other compiler)
you call 2 compiler by step in an Makefile or your static lib is an build command separate before.
(ar ranlib resulting .a) ?

also test -fPIC (Position Independent Code) when you compile the lib.a , -fPIC must first flag not
other added to other sub lib if existing.

I can not help you more precise , I am an badger in Fortran side.

For OpenMp (ICC),I think the runtime is required and problem could be more complex require used also
service libtool for patching correct)
Personally I merge lib if I have have no choice or is imposed to me..
not the better way I think..
Regards
0 Kudos
Reply