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

OpenMP Static Linking - Intel Compiler 15 Update 4 and xCode 5.02

Royi
Novice
1,961 Views

Hello,

We have a project which we use OpenMP.

The code is built successfully yet it won't run on the target (Same System, OS X 10.9), it would say file is missing.
We couldn't find a way to link it statically.
We looked at the documentation here:

https://software.intel.com/en-us/node/522690

Which links here:

https://software.intel.com/en-us/node/522962#1218123C-FC73-4ED4-BAC2-E643E09C200D

We added the flag "-qopenmp-library=static" at 

AAA.png

Yet it didn't work.
We also put it in the linker at "Other Linker Flags" with the same result.

The code woks on Windows (Though we didn't try "Static Linking" there) so we know everything works.

How can we make a Static Linking project in xCode 5.02 with Intel Compiler 15.0?

Thank You.

0 Kudos
32 Replies
jimdempseyatthecove
Honored Contributor III
1,624 Views

Statically linked OpenMP programs (by default) require some *.so files to run. You might find this link helpful: http://stackoverflow.com/questions/23869981/linking-openmp-statically-with-gcc

In producing a statically linked application (by extracting components from libraries).

You may need to perform  Google search for "linux static openmp so" to get this and additional helpful links.

Jim Dempsey

0 Kudos
Royi
Novice
1,624 Views

Hi,

Thank you for your response.

We are working with XCode on OS X (We are not so experienced) so I'm not sure about how to address the Linux data.
Moreover, why some "Tricks" are needed? What's the point in this flag?
We're also after Intel's OpenMP implementation, hence I'm not sure about the links about GCC.

Is there a way to compile the program and make sure it runs on any other OS X based computer?

Thank You.

0 Kudos
chinhster
Beginner
1,624 Views

Try:

-qopenmp -static-intel

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,624 Views

The link was not intended to provide a specific solution to your problem, rather, it was to guide you as to what you may need to do. Principally, for your O/S and tool chain: extract the pertinent .o files from the archive (.a) or .so file(s), and link statically with your application. This is not necessarily easy to do, and may be error prone when you later decide to update your tool chain or O/S.

Before trying to link statically check out the documentation relating to "redistributing libraries" and "redistributable package". In the first reference you will find this link: http://software.intel.com/en-us/articles/redistribution-of-application-binaries-built-for-mac-os-x/

Jim Dempsey

0 Kudos
Royi
Novice
1,624 Views

Hi,

I'm building a Plug In to an host program.

I tried putting the OpenMP files (*.dylib) from Intel Compiler Library in the same folder as the DLL, it didn't work.

I still don't see the solution to use OpenMP on any OS X computer using Intel Compiler 15.

I don't want tp have installers in the process, I want the user to copy, at max, the Plug In file I created + *.dylib file into a folder and have it all work.

It works for me so easily with Intel IPP, how come it is so hard with OpenMP.
Is it easier with Intel TBB?

Thank You.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,624 Views

I am not an OS/X user, but a simple Google search for "os x dynlib path" yields http://superuser.com/questions/282450/where-do-i-set-dyld-library-path-on-mac-os-x-and-is-it-a-good-idea

This indicates that you need to set DYLD_LIBRARY_PATH  to have (include) the path to your library.

Something like

export DYLD_LIBRARY_PATH=,:$DYLD_LIBRARY_PATH

to add your path (current directory) to the environment variable.

You might want to consult the additional hits on the Google search. This one looks promising: http://www.chilkatforum.com/questions/4235/how-to-distribute-a-dylib-with-a-mac-os-x-application

Jim Dempsey

0 Kudos
Royi
Novice
1,624 Views

Hi,

I'm trying to understand, in Windows, on Run Time the folder which the DLL (Plug In are basically DLL's) is inside is automatically part of the path.
Hence if the Intel OpenMP DLL is in the same folder as the Plug In, it works.

Is it different for OS X?

Anyone OS X user here?
Is there anyone from the Intel Compiler Team here to assist?

Thank You.

0 Kudos
Vladimir_P_1234567890
1,624 Views

Hello,

You can try to run under debugger and see in output windows which library failed to load. After you understand which library failed to load it would be easier to understand what should be fixed.

To see library loads you need to modify the launch scheme and set a couple of check boxes:

LibraryLoads_0.png

--Vladimir

0 Kudos
Royi
Novice
1,624 Views

Hi Vladimir,

Where can we see the report about loading the libraries?

We're trying to create a Plug In (I guess basically a Dynamic Library by itself) for a host program which on the second we launch the Plug In says "File Not found".

For the same code, once we remove the OMP Pragma everything runs perfectly (The same code runs on Windows as well) but only on one quarter of the image (As it basically runs one thread of 4).

If you could point us where the point of seeing the loaded libraries it would be great.

Thank You.

0 Kudos
Royi
Novice
1,624 Views

Hi,

Here is the Dependency Walker of the Plug In:

Intel Libraries (IPP Included) are set to be used Statically.
Yet it seems once we add OpenMP (Dynamic Linking) something is wrong even with the IPP which is perfect once OpenMP is truned off.

Can someone from Intel assist with that?

We upgraded to Composer 2015 Update 6 and Xcode 6.3 and the result is the same.

Could it be that once 'qopenmp' is enabled all linking (Including IPP) becomes "Dynamic" (Overriding -intel-static)?

Thank You.

0 Kudos
Kittur_G_Intel
Employee
1,624 Views

@Royi:  
Yes, the default loading of the openmp lib is dynamic unless static linking is explicitly chosen. It's strange that after you added OpenMP there's an issue with IPP.  I've pinged the library team and someone from that team will take a look at your issue and respond soon. Appreciate your patience through this.
_Kittur  

0 Kudos
Royi
Novice
1,624 Views

@Kittur,

We tried it in Windows.
In Windows enabling /QopenMP doesn't add IPP to the Dependency Walker in Windows.
Yet in OS X, using -qopenmp yields the result above.

I'd be happy to hear from you guys, because now this issue preventing us from having a product ready.

Thank You.

0 Kudos
Kittur_G_Intel
Employee
1,624 Views

@Royi; That's strange as enabling openmp shouldn't cause the issue you note on IPP linking. Also,  I can't reproduce the issue internally. BTW, as a side note for any urgent issues you can also submit it in https://premier.intel.com  (Premier Support) as you'll are a registered product user as well. Reason, there will be a dedicated support engineer again assigned to the issue from IPP team to ensure issue resolution and will be communicating directly with you as well. Additionally, any data (secure content) can be attached to that issue as well in Premier Support. I've let the team know and you should get a response from them on this issue soon.

Also, as another side note. For any IPP issues, there's also the user forum at: https://software.intel.com/en-us/forums/intel-integrated-performance-primitives being monitored by IPP team.

_Kittur

0 Kudos
Chao_Y_Intel
Moderator
1,624 Views

Hi Royi,  

You mentioned Intel IPP Libraries (IPP Included) are set to be used Statically.   how do you set this now?

Here is article regarding the IPP library linkage:
https://software.intel.com/en-us/articles/intel-integrated-performance-primitives-for-mac-os-how-to-link-to-the-intel-ipp-for-mac-os-x-libraries-in-application

For X code IDE:
5. Select the Other Linker Flags field and type in the linker flags for the libraries you wish to link to.
.....
For static linking:
·         /opt/intel/ipp/lib/libippi.a  /opt/intel/ipp/lib/libipps.a /opt/intel/ipp/lib/libippvm.a /opt/intel/ipp/lib/libippcore.a
.....


Thanks,
Chao

0 Kudos
Kittur_G_Intel
Employee
1,624 Views

Thanks Chao for the response. @Royi: BTW, Chao is our IPP expert as well, fyi.  Could you please let us know after you go through the links on how you're linking IPP statically since openmp option should only load openmp lib dynamically (default) unless you explicitly link that statically as well and should not interfere with IPP linking per-se...

_Kittur

0 Kudos
Royi
Novice
1,624 Views

Hi Chao,

We have Intel Compiler hence all the things you wrote are note needed (There is a choice for static Intel Libraries).
But we also tried the "Manual" approach (Like Intel Compiler isn't integrated into Xcode) and it doesn't work.
We use Xcode 6.3 and Intel Composer 2015 Update 6.

As I wrote before, we can do Static Linking of IPP by our self.
It works and everything is great (We use Intel Compiler automatic flag -intel-static).

The problem is when we enable OpenMP (Intel OpenMP using qopenmp).

Then, no matter what we set for the IPP settings all Intel Libraries become Dynamically Linked.

For instance, when we used Intel Compiler Flag as in the following project:

As you can see above, all Intel libraries are linked statically and OpenMP is disabled.

The dependency walker of this project (It is a Plug In):

Namely all is indeed statically linked and this Plug In works.

Now, the same project, we just enabled the "Process OpenMP Directives" above as shown here:

Now, the dependency walker is like that:

Namely, suddenly the IPP became Dynamically Linked.

We even tried the manual method you suggested:

After compiling, the Dependency Walker still showing the Intel IPP isn't statically linked.

Namely the issues is when both OpenMP and IPP are used, IPP becones Dynamically Linked no matter what we tried.

Thank You.

0 Kudos
Chao_Y_Intel
Moderator
1,624 Views

Hi Royi,

It is strange that even you manually add the static libraries,  the dynamic IPP libraries are still linked.
When you manually add the static libraries,  did you disable the option that suggested the compiler to add Intel IPP libraries?
The option in the bellow picture needs to be disabled:

 test.jpg

After you disable the option, you need to manually use the following steps:

1.     Select the Header Search Paths field and type.
        /opt/intel/ipp/include
2.   
Select the Library Search Paths field and type
        /opt/intel/ipp/xxx/lib
3.  Select the Other Linker Flags field and type in the linker flags for the libraries you wish to link to.
For static linking:
·         /opt/intel/ipp/lib/libippi.a  /opt/intel/ipp/lib/libipps.a /opt/intel/ipp/lib/libippvm.a /opt/intel/ipp/lib/libippcore.a

Thanks,
Chao

0 Kudos
Royi
Novice
1,624 Views

Hi Chao,

We will give it a try and update.
But I don;t understand, how come it doesn't work "Out of the Box"?

Is it an issue with Intel C++ Compiler 15 Updated 6?

The use of Intel Compiler Libraries / IPP / MKL / OpenMP / TBB / Cilk Plus must be more streamlined :-).
Maybe something like Static / Dynamic Linking Flag for each by its own.

Thank You.

0 Kudos
Royi
Novice
1,624 Views

Kittur Ganesh (Intel) wrote:

Thanks Chao for the response. @Royi: BTW, Chao is our IPP expert as well, fyi.  Could you please let us know after you go through the links on how you're linking IPP statically since openmp option should only load openmp lib dynamically (default) unless you explicitly link that statically as well and should not interfere with IPP linking per-se...

_Kittur

Hi,

As you can see this is not the case.
Once you set OpenMP to be enabled IPP Link becomes Dynamic Link overriding the choice in the Compiler.

Something is buggy there and we can't make it work.

0 Kudos
Kittur_G_Intel
Employee
1,302 Views

Hi Royi,
Based on the update I have from the openmp developer the procedure outlined by Chao earlier on static linking needs to be followed. Can you please try that procedure? If you do so, IPP libs have to be linked in statically (also verified internally) and couldn't reproduce the issue you're seeing. 
Can you please try the steps shown in Chao's post earlier and let us know? Appreciate your patience through this.
Thanks,
Kittur 

 

0 Kudos
Reply