1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-08 14:51:10 +00:00

Simple, but effective workaround to solve the 100% CPU burning loop bug in Nvidias OpenCL runtime, works Linux and Windows, 0% cpu (alsmost), 100% performance in comparison to CPU burning loop variant. Replaces old previous try with overwritten clock_gettime() function

This commit is contained in:
jsteube 2016-06-13 23:50:49 +02:00
parent 217f9e6004
commit 8abc42e346
2 changed files with 8 additions and 17 deletions

View File

@ -988,6 +988,7 @@ struct __hc_device_param
uint exec_pos;
double exec_ms[EXEC_CACHE];
double exec_prev;
// this is "current" speed

View File

@ -2468,6 +2468,11 @@ static void run_kernel (const uint kern_run, hc_device_param_t *device_param, co
hc_clFlush (data.ocl, device_param->command_queue);
if (data.devices_status == STATUS_RUNNING)
{
usleep (device_param->exec_prev * 1000);
}
hc_clWaitForEvents (data.ocl, 1, &event);
if (event_update)
@ -2484,6 +2489,8 @@ static void run_kernel (const uint kern_run, hc_device_param_t *device_param, co
device_param->exec_ms[exec_pos] = exec_time;
device_param->exec_prev = exec_time;
exec_pos++;
if (exec_pos == EXEC_CACHE)
@ -5425,19 +5432,6 @@ static uint generate_bitmaps (const uint digests_cnt, const uint dgst_size, cons
* main
*/
#ifdef LINUX
int (*clock_gettime_orig) (clockid_t clk_id, struct timespec *tp);
int clock_gettime (clockid_t clk_id, struct timespec *tp)
{
int r = clock_gettime_orig (clk_id, tp);
usleep (NVIDIA_100PERCENTCPU_WORKAROUND);
return r;
}
#endif
#ifdef WIN
void SetConsoleWindowSize (const int x)
{
@ -5466,10 +5460,6 @@ void SetConsoleWindowSize (const int x)
int main (int argc, char **argv)
{
#ifdef LINUX
clock_gettime_orig = dlsym (RTLD_NEXT, "clock_gettime");
#endif
#ifdef WIN
SetConsoleWindowSize (132);
#endif