Azil
Azil

Reputation: 467

Can we offload OpenMp to any Intel GPU?

I'm using Ubuntu 14.04.

  1. Is there a way to use openMp and offload the parallel code into the Intel GPUs such as Intel HD graphics ?

If yes:

  1. which icc version do I need ? (can I do it with gcc ?)

  2. which Intel processors are supported ?

Upvotes: 1

Views: 1957

Answers (2)

Jeff Hammond
Jeff Hammond

Reputation: 5662

Some OpenMP 4 constructs work on Intel GPUs with the Intel C/C++ compiler.

I've tested the following code on Xeon E3, probably Haswell (v3) generation and with Intel compiler version 15 or 16 (probably the latter). I tested on Linux and find that it is not supported on Mac.

void vadd4(int n, float * RESTRICT a, float * RESTRICT b, float * RESTRICT c)
{
#if defined(_OPENMP) && (_OPENMP >= 201307)
    //#pragma omp target teams distribute map(to:n,a[0:n],b[0:n]) map(from:c[0:n])
    #pragma omp target map(to:n,a[0:n],b[0:n]) map(from:c[0:n])
    #pragma omp parallel for simd
#else
    #warning No OpenMP target/simd support!
    #pragma omp parallel for
#endif
    for(int i = 0; i < n; i++)
        c[i] = a[i] + b[i];
}

The full test code I used to evaluate Intel GPU compute software is https://github.com/jeffhammond/HPCInfo/blob/master/openmp/offload/test_vadd.c.

Unfortunately, the distribute and teams are not supported for the -qopenmp-offload=gfx target, so one needs some preprocessing to generate functionally portable code.

Additional documentation includes:

Disclaimer: I work for Intel, but in a research capacity. I am not responsible for implementing or supporting the Intel compiler or Intel GPU software.

Upvotes: 0

coincoin
coincoin

Reputation: 4685

As far as I know you can only offload OpenMP code on Intel MIC/Xeon Phi.
However in the (near ?) future OpenMP 4 should offer this kind of feature (see this post).

So GPGPU on Intel HD graphics can only be done with OpenCL and Intel CILK for the moment I think.

Upvotes: 2

Related Questions