mirror of
https://github.com/hashcat/hashcat.git
synced 2025-05-09 10:28:48 +00:00
Improve checking for successfully load of the NVML API
This commit is contained in:
parent
6efe557cdc
commit
7ae025efce
66
src/hwmon.c
66
src/hwmon.c
@ -2610,6 +2610,8 @@ int hm_get_threshold_slowdown_with_device_id (hashcat_ctx_t *hashcat_ctx, const
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (hwmon_ctx->hm_nvml)
|
||||
{
|
||||
int target = 0;
|
||||
|
||||
@ -2617,6 +2619,7 @@ int hm_get_threshold_slowdown_with_device_id (hashcat_ctx_t *hashcat_ctx, const
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2646,6 +2649,8 @@ int hm_get_threshold_shutdown_with_device_id (hashcat_ctx_t *hashcat_ctx, const
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (hwmon_ctx->hm_nvml)
|
||||
{
|
||||
int target = 0;
|
||||
|
||||
@ -2653,6 +2658,7 @@ int hm_get_threshold_shutdown_with_device_id (hashcat_ctx_t *hashcat_ctx, const
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2701,6 +2707,8 @@ int hm_get_temperature_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 dev
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (hwmon_ctx->hm_nvml)
|
||||
{
|
||||
int temperature = 0;
|
||||
|
||||
@ -2708,6 +2716,7 @@ int hm_get_temperature_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 dev
|
||||
|
||||
return temperature;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2721,8 +2730,8 @@ int hm_get_fanpolicy_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 devic
|
||||
|
||||
if ((opencl_ctx->devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_device[device_id].fan_get_supported == true)
|
||||
{
|
||||
if (hwmon_ctx->hm_device[device_id].fan_get_supported == false) return -1;
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -2756,7 +2765,6 @@ int hm_get_fanpolicy_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 devic
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2770,8 +2778,8 @@ int hm_get_fanspeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device
|
||||
|
||||
if ((opencl_ctx->devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_device[device_id].fan_get_supported == true)
|
||||
{
|
||||
if (hwmon_ctx->hm_device[device_id].fan_get_supported == false) return -1;
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -2813,6 +2821,8 @@ int hm_get_fanspeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (hwmon_ctx->hm_nvml)
|
||||
{
|
||||
int speed = 0;
|
||||
|
||||
@ -2858,6 +2868,8 @@ int hm_get_buslanes_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (hwmon_ctx->hm_nvml)
|
||||
{
|
||||
unsigned int currLinkWidth;
|
||||
|
||||
@ -2865,6 +2877,7 @@ int hm_get_buslanes_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device
|
||||
|
||||
return currLinkWidth;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2893,6 +2906,8 @@ int hm_get_utilization_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 dev
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (hwmon_ctx->hm_nvml)
|
||||
{
|
||||
nvmlUtilization_t utilization;
|
||||
|
||||
@ -2900,6 +2915,7 @@ int hm_get_utilization_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 dev
|
||||
|
||||
return utilization.gpu;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2937,6 +2953,8 @@ int hm_get_memoryspeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 dev
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (hwmon_ctx->hm_nvml)
|
||||
{
|
||||
unsigned int clock;
|
||||
|
||||
@ -2944,6 +2962,7 @@ int hm_get_memoryspeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 dev
|
||||
|
||||
return clock;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2981,6 +3000,8 @@ int hm_get_corespeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 devic
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (hwmon_ctx->hm_nvml)
|
||||
{
|
||||
unsigned int clock;
|
||||
|
||||
@ -2988,6 +3009,7 @@ int hm_get_corespeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 devic
|
||||
|
||||
return clock;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -3003,10 +3025,11 @@ int hm_get_throttle_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (hwmon_ctx->hm_nvml)
|
||||
{
|
||||
/* this is triggered by mask generator, too. therefore useless
|
||||
unsigned long long clocksThrottleReasons = 0;
|
||||
@ -3027,6 +3050,7 @@ int hm_get_throttle_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device
|
||||
|
||||
return (clocksThrottleReasons != nvmlClocksThrottleReasonNone);
|
||||
*/
|
||||
}
|
||||
|
||||
if (hwmon_ctx->hm_nvapi)
|
||||
{
|
||||
@ -3058,8 +3082,8 @@ int hm_set_fanspeed_with_device_id_adl (hashcat_ctx_t *hashcat_ctx, const u32 de
|
||||
|
||||
if (hwmon_ctx->enabled == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == true)
|
||||
{
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_adl)
|
||||
{
|
||||
if (fanpolicy == 1)
|
||||
@ -3109,7 +3133,6 @@ int hm_set_fanspeed_with_device_id_adl (hashcat_ctx_t *hashcat_ctx, const u32 de
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -3120,8 +3143,8 @@ int hm_set_fanspeed_with_device_id_nvapi (hashcat_ctx_t *hashcat_ctx, const u32
|
||||
|
||||
if (hwmon_ctx->enabled == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == true)
|
||||
{
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_nvapi)
|
||||
{
|
||||
if (fanpolicy == 1)
|
||||
@ -3155,7 +3178,6 @@ int hm_set_fanspeed_with_device_id_nvapi (hashcat_ctx_t *hashcat_ctx, const u32
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -3166,15 +3188,14 @@ int hm_set_fanspeed_with_device_id_xnvctrl (hashcat_ctx_t *hashcat_ctx, const u3
|
||||
|
||||
if (hwmon_ctx->enabled == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == true)
|
||||
{
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_xnvctrl)
|
||||
{
|
||||
if (hm_XNVCTRL_set_fan_speed_target (hashcat_ctx, hwmon_ctx->hm_device[device_id].xnvctrl, fanspeed) == -1) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -3185,15 +3206,14 @@ int hm_set_fanspeed_with_device_id_sysfs (hashcat_ctx_t *hashcat_ctx, const u32
|
||||
|
||||
if (hwmon_ctx->enabled == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == true)
|
||||
{
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_sysfs)
|
||||
{
|
||||
if (hm_SYSFS_set_fan_speed_target (hashcat_ctx, device_id, fanspeed) == -1) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -3204,15 +3224,14 @@ static int hm_set_fanctrl_with_device_id_xnvctrl (hashcat_ctx_t *hashcat_ctx, co
|
||||
|
||||
if (hwmon_ctx->enabled == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == true)
|
||||
{
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_xnvctrl)
|
||||
{
|
||||
if (hm_XNVCTRL_set_fan_control (hashcat_ctx, hwmon_ctx->hm_device[device_id].xnvctrl, val) == -1) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -3223,15 +3242,14 @@ static int hm_set_fanctrl_with_device_id_sysfs (hashcat_ctx_t *hashcat_ctx, cons
|
||||
|
||||
if (hwmon_ctx->enabled == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == true)
|
||||
{
|
||||
if (hwmon_ctx->hm_device[device_id].fan_set_supported == false) return -1;
|
||||
|
||||
if (hwmon_ctx->hm_sysfs)
|
||||
{
|
||||
if (hm_SYSFS_set_fan_control (hashcat_ctx, device_id, val) == -1) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user