...
// Offload/Native mode
#define NATIVE /* OFFLOAD */
// Number of MIC-threads
#define MIC_NUM_THREADS 240
...
#ifdef OFFLOAD
#pragma offload_attribute (push,target(mic))
#endif
double foo(double *a, double x, int index)
{
 return a[index] * x ;
} 
#ifdef OFFLOAD
#pragma offload_attribute (pop)
#endif
...
#ifdef OFFLOAD
#pragma offload target (mic) in (a:length(N)) \ 
        out(c:length(N))
#endif
{
 #pragma omp parallel for default(none) shared(a,x,c) \ 
         num_threads(MIC_NUM_THREADS)
 for(i=0;i<N;i++)
  c[i] = foo(a,x,i);
}
...