Advertisement
Guest User

MIC offload nocopy failure

a guest
Jun 10th, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     int NE = 8;
  2.     int i, j;
  3.    
  4.     int num_devices = _Offload_number_of_devices();
  5.  
  6.     // array to be offloaded to the mics
  7.     __declspec(target (mic)) float *offarray = (float*) memalign( 4096, NE * sizeof(float) );
  8.     for ( j = 0; j < NE; j++ ) offarray[j] = sqrt(j);
  9.  
  10.  
  11.     // offloat to all (both) mics and retain memory
  12.     for ( i = 0; i < num_devices; i++ )
  13.     {
  14.         #pragma offload_transfer target(mic:i) in ( offarray : length ( NE ) alloc_if(1) free_if(0) )
  15.     }
  16.  
  17.     // access array on mics in reverse order
  18.     for ( i = num_devices - 1; i >= 0; i-- )
  19.     {
  20.         #pragma offload target(mic:i) nocopy ( offarray )
  21.         {
  22.             int j;
  23.             for ( j = 0; j < NE; j++ ) printf ( "%d(%d) %f\n", j, i, offarray[j] );
  24.         }
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement