Software Archive
Read-only legacy content
17061 Discussions

static compilation question

Dragos_Constantin
399 Views

Hi,

I have a code written in c++ which uses pthreads. I have managed to generate a program version which uses shared libs and which has succesfully ran on XEON Phi (I have seen 100 threads running on the MIC). I am in the process of convincing icc/icpc to compile without errors a static version of the same program to reduce the overhead generated by the shared lib function calls.

I wonder what happens with the libs which were not compiled with icc and definitely not for MIC architecture. I mean what happens when pthreads functions are called from a program which runs on MIC? Do I have to recompile pthreads for the MIC architecture?

Thanks,

Dragos

0 Kudos
5 Replies
Frances_R_Intel
Employee
399 Views

You used icc to compiler your shared libs version of pThreads?

0 Kudos
Frances_R_Intel
Employee
399 Views

And I should have actually answered the question the first time. You might want to try compiling your libraries with /usr/linux-k1om-4.7/bin/x86_64-k1om-linux-g++ on the host which will produce code for the coprocessor. Code compiled for the host will not work.

0 Kudos
Dragos_Constantin
399 Views

No. All, I did was to compile the program for the MIC arhitecture and I tested it.

Now that I am writing back I started to ask myself if 'icc -mmic' used the libs present on the MIC OS.

Thanks,

Dragos

Frances Roth (Intel) wrote:

You used icc to compiler your shared libs version of pThreads?

0 Kudos
Frances_R_Intel
Employee
399 Views

And the quick answer to that is - yes. When you compile using -mmic, it links against the versions of the libraries that were compiled for the coprocessor. It is reading the copies of the libraries it finds on the host but they are specifically compiled for the coprocessor. When it runs, if those were shared libraries, it links against those same libraries, but using the copies it finds on the coprocessor.

0 Kudos
Dragos_Constantin
399 Views

Yes, I can confirm that all my libs and the application use the MIC libs. I applogize for generating confussion.

Thanks,

Dragos

Frances Roth (Intel) wrote:

And I should have actually answered the question the first time. You might want to try compiling your libraries with /usr/linux-k1om-4.7/bin/x86_64-k1om-linux-g++ on the host which will produce code for the coprocessor. Code compiled for the host will not work.

0 Kudos
Reply