4
votes

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;
}
2

2 Answers

2
votes

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
1
votes

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"