Callbacks must return promptly. The behavior ofcalling expensive system routines, OpenCL API calls to create contexts or command-queues, orblocking OpenCL operations from the following list below, in a callback is undefined.clFinish,clWaitForEvents,blocking calls to clEnqueueReadBuffer, clEnqueueReadBufferRect,clEnqueueWriteBuffer, clEnqueueWriteBufferRect,blocking calls to clEnqueueReadImage and clEnqueueWriteImage,blocking calls to clEnqueueMapBuffer and clEnqueueMapImage,blocking calls to clBuildProgram, clCompileProgram or clLinkProgramIf an application needs to wait for completion of a routine from the above list in a callback,please use the non-blocking form of the function, and assign a completion callback to it to do theremainder of your work.
http://www.tutorials.de/c-c/229782-c-sleep-kleiner-als-ms-2.html#post1197886
There's http://stackoverflow.com/questions/85122/sleep-less-than-one-millisecond/11456112#11456112 which has some attempts. I do not know if that works. Joe
Quote from: Urs Echternacht on 30 Oct 2013, 08:11:39 pmhttp://www.tutorials.de/c-c/229782-c-sleep-kleiner-als-ms-2.html#post1197886And a translated page for Raistmerhttp://translate.google.com/translate?sl=auto&tl=ru&js=n&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fwww.tutorials.de%2Fc-c%2F229782-c-sleep-kleiner-als-ms-2.html%23post1197886&act=urland Joehttp://translate.google.com/translate?hl=en&sl=de&tl=en&u=http%3A%2F%2Fwww.tutorials.de%2Fc-c%2F229782-c-sleep-kleiner-als-ms-2.html%23post1197886
Thanks Arkayn. (german does not translate very good into english when done by a machine! In this case "security" should read "computer"! )Here is some POSIX source : nanosleep.cHere is same for apple : nanosleep.cAdditionally there is a function "clock_nanosleep()" which allows to choose between different clocks on Linux. (real time, monotonic, other)
want = u64 = request->tv_sec * POW10_3 + request->tv_nsec / POW10_6; while (u64 > 0 && rc == 0) { if (u64 >= MAX_SLEEP_IN_MS) ms = MAX_SLEEP_IN_MS; else ms = (unsigned long) u64; u64 -= ms; rc = SleepEx(ms, TRUE); //R: Sleep, but in ms scale } if (rc != 0) { /* WAIT_IO_COMPLETION (192) */ if (remain != NULL) { GetSystemTimeAsFileTime(&_end.ft); real = (_end.ns100 - _start.ns100) / POW10_4; if (real >= want) u64 = 0; else u64 = want - real; remain->tv_sec = u64 / POW10_3; remain->tv_nsec = (long) (u64 % POW10_3) * POW10_6; //R: just report how many ns to sleep w/o real way to do such sleep }
1) export LD_PRELOAD=libsleep.soYou would not have to reserve any physical or logigal cores for AP. -- The 100% usage is only for yield() - an idle loop inside NVIDIA openCl driver. Libsleep.so replaces yield() with nanosleep. This gives lower proirity tasks (CPU tasks) an opportunity to run.