My main aim was to insert 1ms delay in xeon phi coprocessor but I was getting ~9ms difference in my results. So, I tried experimenting with xeon host machine and phi coprocessor to find the timer resolution. I executed the following code:
struct timespec tim, tim2;
tim.tv_sec = 0;
tim.tv_nsec = 100000;
struct timeval tv;
int i =0;
for ( i=0;i<1000;i++)
nanosleep(&tim , NULL);
printf("Nano sleep successfull %lf\n",temp_2/1000);
Running the following program in host:
./a.out Nano sleep successfull 0.000155
Running in xeon phi coprocessor:
./nsleep_mic Nano sleep successfull 0.009998
soo I get almost 90% errored wait in xeon phi.
- why does such erroneous wait happens?
- How to solve it if I want a sleep time of 1ms?