Author

Topic: Workaround for Nvidia OpenCL 100% CPU usage on linux. (Read 1926 times)

newbie
Activity: 14
Merit: 0
Little workaround for nvidia eating 100% CPU when running OpenCL apps on linux.

Download link:

http://mk.junkyard.one.pl/libsleep.c

To compile run:
gcc -O2 -fPIC -shared -Wl,-soname,libsleep.so -o libsleep.so libsleep.c

To use:
LD_PRELOAD="./libsleep.so" ./cgminer

You can configure sleep time by setting
YIELD_SLEEP_TIME environment variable (in microseconds)
Default is 1000usec
Example:
YIELD_SLEEP_TIME="1500" LD_PRELOAD="./libsleep.so" ./cgminer

How does it work:
It overrides sched_yield function called during running OpenCL program with call to usleep.
Expect a little performance drop (less than 5%) - adjust YIELD_SLEEP_TIME for your needs.
The longer opencl program running time (ie. higher agression), the lower the performance drop is.

Does someone who is affected by similar problem with ATI cards would be willing to give me access to their system, so i could look up how to resolve this issue with ATI?
Jump to: