On Mon, Jul 07, 2014 at 05:03:07PM +0200, Bernd Schmidt wrote:
> On 07/07/2014 04:50 PM, Ilya Verbin wrote:
> >2) Or should I build accel compiler as a cross from
> >x86_64-pc-linux-gnu to x86_64-intelmic-linux-gnu?
> 
> Yes, that's the general idea.
> 
> >Will it help to distinguish the libs?
> 
> Is libgomp the only problematic one? (Does the accel compiler even need
> one?) It seems to be installed in /usr/lib rather than in a gcc-specific
> directory, which is a little surprising to me. It may be necessary to give
> the accel compiler a different sysroot to avoid library clashes.

We need a libgomp for the offload targets to be different from the host
libgomp even on targets like mic, because there are various omp_* functions
that should behave differently.  Or the host libgomp needs to have a way how
to query whether it is invoked as offloading target library.
At least omp_is_default_device should return 0 when invoked inside of the
offloaded program (but, note that e.g. sshing into Intel MIC and running
there a program linked against -lgomp should return 1, because in that
case the MIC is the host device).
Other than that single function, I think on MIC/HSAIL that is the only thing
that needs to change, for PTX where you supposedly want to support more than
one team it is also the omp_get_num_teams and omp_get_team_num functions.

And yes, you need libgomp for the offloading targets, because at least in
OpenMP you can call lots of omp_* functions in the target regions, and can
use most of the #pragma omp * directives that actually need to have runtime
support too.  For offloading targets where you right now can't link stuff
I'm afraid you'll need to inline the parts of libgomp compiled for the PTX
(or HSAIL) targets manually during compilation (but what do you do for math
library functions, C functions etc.)?

        Jakub

Reply via email to