if (hm_NVML_nvmlDeviceGetCurrentClocksThrottleReasons (data.hm_nvml, 1, data.hm_device[device_id].nvml, &clocksThrottleReasons) != NVML_SUCCESS) return -1;
if (hm_NVML_nvmlDeviceGetSupportedClocksThrottleReasons (data.hm_nvml, 1, data.hm_device[device_id].nvml, &supportedThrottleReasons) != NVML_SUCCESS) return -1;
- clocksThrottleReasons &= supportedThrottleReasons;
-
+ clocksThrottleReasons &= supportedThrottleReasons;
+ clocksThrottleReasons &= ~nvmlClocksThrottleReasonGpuIdle;
+ clocksThrottleReasons &= ~nvmlClocksThrottleReasonApplicationsClocksSetting;
clocksThrottleReasons &= ~nvmlClocksThrottleReasonUnknown;
- return (clocksThrottleReasons > 0);
+ if (data.kernel_power_final)
+ {
+ clocksThrottleReasons &= ~nvmlClocksThrottleReasonHwSlowdown;
+ }
+
+ return (clocksThrottleReasons != nvmlClocksThrottleReasonNone);
}
return -1;
void myabort ()
{
- if (data.devices_status == STATUS_INIT) return;
- if (data.devices_status == STATUS_STARTING) return;
+ //if (data.devices_status == STATUS_INIT) return;
+ //if (data.devices_status == STATUS_STARTING) return;
data.devices_status = STATUS_ABORTED;
}
void myquit ()
{
- if (data.devices_status == STATUS_INIT) return;
- if (data.devices_status == STATUS_STARTING) return;
+ //if (data.devices_status == STATUS_INIT) return;
+ //if (data.devices_status == STATUS_STARTING) return;
data.devices_status = STATUS_QUIT;
}
+void naive_replace (char *s, const u8 key_char, const u8 replace_char)
+{
+ const size_t len = strlen (s);
+
+ for (size_t in = 0; in < len; in++)
+ {
+ const u8 c = s[in];
+
+ if (c == key_char)
+ {
+ s[in] = replace_char;
+ }
+ }
+}
+
+void naive_escape (char *s, size_t s_max, const u8 key_char, const u8 escape_char)
+{
+ char s_escaped[1024] = { 0 };
+
+ size_t s_escaped_max = sizeof (s_escaped);
+
+ const size_t len = strlen (s);
+
+ for (size_t in = 0, out = 0; in < len; in++, out++)
+ {
+ const u8 c = s[in];
+
+ if (c == key_char)
+ {
+ s_escaped[out] = escape_char;
+
+ out++;
+ }
+
+ if (out == s_escaped_max - 2) break;
+
+ s_escaped[out] = c;
+ }
+
+ strncpy (s, s_escaped, s_max - 1);
+}
+
void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources)
{
FILE *fp = fopen (kernel_file, "rb");
void *thread_keypress (void *p)
{
- int benchmark = *((int *) p);
-
uint quiet = data.quiet;
tty_break();
log_info ("");
- if (benchmark == 1) break;
-
stop_at_checkpoint ();
log_info ("");
log_info ("");
- if (benchmark == 1)
- {
- myquit ();
- }
- else
- {
- myabort ();
- }
+ myabort ();
break;
}