Software Archive
Read-only legacy content
17060 Discussions

Phtrhead + offload

Chen__Xin
Beginner
455 Views

Hi I create a new thread and lanch offload code in this thread but I get this error code

offload error: cannot get function handles on the device 8117264 (error code 14)
The code likes as followings:

host code

  if (pthread_create(&d_thread, NULL, RunDevice, d_data))
     {
       printf("\nCannot create device thread!\n");
       return;
     }

thread code

void *RunDevice(void *ptr)
{

   //Allocate memory in Phi
 #pragma offload_transfer target(mic:0) in(udata:length(2*height*width) ALLOC)
 #pragma offload_transfer target(mic:0) in(fdata:length(DATASEGMENT*height*width) ALLOC)
  printf("here4\n");
   double t0 = WhenCPU();
  #pragma offload target(mic:0) nocopy(udata:length(2*width*height) REUSE) nocopy(fdata:length(DATASEGMENT*width*height) REUSE)
    {
      tvdenoise_d(udata,fdata,width, height, mu, lambda, outerIter);
    }
  double t00 = WhenCPU();
  printf("First running time = %f\n", t00 - t0);

}

what happens?

0 Kudos
1 Reply
jimdempseyatthecove
Honored Contributor III
455 Views

This looks like a pthread issue on the host.

Insert #if 0...#endif in the body of your RunDevice (and anywhere else you have offloads).

Essentially conditionalize out all the MIC code.

Then compile the program, and see if you get the same error. If you do then you are likely linking in the wrong library.

Jim Dempsey

0 Kudos
Reply