4

When I try to run my code on Intel MIC it is giving an error like "offload error: cannot offload to MIC - device is not available"

My sample code is

#include <stdio.h>
#include <omp.h>

int main()
{
    int N=10;
    int i, a[N];

#pragma offload target(mic)
#pragma omp parallel
#pragma omp for

    for(i = 0; i < N; i++)
    {
        a[i]=i;
        printf("a[%d] :: %d \n", i, a[i]); 
        printf(".....................:\n\n");
    }

    return 0;
}
Paul R
  • 208,748
  • 37
  • 389
  • 560

2 Answers2

2

One of 2 things is happening. Either the card is not booted, you can check this by:

sudo micctrl -s

Or the runtime cannot find dependent libraries. This is most likely due to not sourcing the compiler environment variables:

source /opt/intel/composerxe/bin/compilervars.sh intel64
sssylvester
  • 168
  • 6
1

I believe you have not set up the compiler's environment.

Compiler Environment:

source /opt/intel/composerxe/bin/compilervars.sh intel64

Also set the offload library as well.

#include "offload.h"
hafichuk
  • 10,351
  • 10
  • 38
  • 53
Kajan
  • 11
  • 1