Weird performance issue caused by heavy workload on host

Discussion created by rick.weber on Feb 25, 2009

So, I have a kernel running in CAL which runs via the following code:




    clock_gettime(CLOCK_REALTIME, &time2);







    //Run kernels, reassigning x,y,z,basis symbols

    for(i = 0; i < kNumSets; i+=8)


      CALdomain expDomain = {0, 0, kNbas/4, kBlockSize};

      CALevent computeRadiiDone;


      CALbuffer* radiiParameters[] = {coordGPU[i/8], r2GPU[0]};

      const char* radiiSymbols[] = {"i0", "o0"};

      CALdomain radiiDomain = {0, 0, kBlockSize, 8};











      //while(calCtxIsEventDone(device.getContext(),computeRadiiDone) ==



      //Assign symbol names and run kernel

      CALbuffer* expParameters[] = {












      const char* expSymbols[] = {
    for(i = 0; i < kNumSets/8; i++)
      //printf("%d %d\n",event,i);
      if(calCtxIsEventDone(device.getContext(), event)
        goto RETRY_WAIT;
    clock_gettime(CLOCK_REALTIME, &time3);
I compute the execution time as the difference between time 3 and time2. assignSymbolAndRun is a high level wrapper that I wrote to make my life easier. The issue is this: when sleep(1) is commented out, the execution takes ~16ms to complete. When sleep(1) is not commented out, the execution takes over 40ms. Sleep(1) can be substituted with any heavy computation load running on the host and the same result occurs. What could cause this? The sleep occurs before I take my time measurement.