Quantcast
Channel: Intel® Many Integrated Core Architecture
Viewing all articles
Browse latest Browse all 1347

How to hybrid MIC and CPU without copy-and-paste

$
0
0

Hello,

I know I can hybrid MIC and CPU by using synchronized offload directive.

But I have one question. How to do that without copying and paste codes

For example, there is a vector addition

#pragma omp prallel for
for(i=0;i<N;i++) C[i] = A[i] + B[i];

I can hybrid it like:

#pragma offload inout(C[0:N/2]: alloc(C[0:N/2])) signal(&sig)
{
#pragma omp parallel for
for(i=0;i<N/2;i++) C[i] = A[i] + B[i];
}

#pragma omp parallel for
for(i=N/2;i<N;i++) C[i] = A[i] + B[i];

#pragma offload wait(&sig)

 

But,  is there a way that I don't need to copy-and-paste the code ?

 

 

 

 


Viewing all articles
Browse latest Browse all 1347

Trending Articles



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