Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

pragma offload target(gfx) error

$
0
0

Hi,

I installed Intel(R) Parallel Studio XE 2017 for Linux (Ubuntu 14.04) and I'm trying to write a simple C code to test Cilk Plus and specifically the pragma offload. I have a Intel(R) Iris Pro Graphics 6200 BroadWell GPU.

Here's my program :

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <cilk/cilk.h>

void sgemm(const float * A, const float * B, float * C, int N) {
   int i, j, k;
   #pragma offload target(gfx) in(A, B : length(N*N)) out(C : length(N*N))
   _Cilk_for (i = 0; i < N; i++) {
      _Cilk_for (j = 0; j < N; j++) {
         for (k = 0; k < N; k++) {
            C[i*N+j] += A[i*N+k] + y[k*N+j];
         }
      }
   }
}

void main() {
   int N = 1024;
   float * A = malloc(sizeof(float) * N*N);
   float * B = malloc(sizeof(float) * N*N);
   float * C = malloc(sizeof(float) * N*N);

   int i;
   for (i = 0; i < N; i++){
      A[i] = 1.0;
      B[i] = 2.0;
      C[i] = 0.0;
   }

   sgemm(A,B,C,N);

   for (i = 0; i < N; i++){
      assert(C[i] == 2048.0);
   }
}

It compiles using :

$ icc -qoffload=mandatory sgemm.c

but the execution gives the following error :

$ ./a.out
GFX(18:00:39): FATAL ERROR: cannot offload gfx program

So I'm just asking : do you see mistakes in my code or in my compilation line, and if not do you have any clue where should I need to search first ?

Thread Topic: 

Help Me

Viewing all articles
Browse latest Browse all 1175


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>