mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-28 16:40:59 +00:00
Improved management of systems with multiple OpenCL platforms and show empty OpenCL platforms only in backend information mode
This commit is contained in:
parent
cab0bd423c
commit
f890cd8134
@ -50,6 +50,7 @@
|
||||
- Backend Info: Added generic system info to output (must be completed on Windows side)
|
||||
- Backend Info: Added local memory size to output
|
||||
- Backend: with kernel build options, switch from -I to -D INCLUDE_PATH, in order to support Apple Metal runtime
|
||||
- Backend: improved management of systems with multiple OpenCL platforms
|
||||
- CUDA Backend: moved functions to ext_cuda.c/ext_nvrtc.c and includes to ext_cuda.h/ext_nvrtc.h
|
||||
- Hardware Monitor: Add support for GPU device utilization readings using iokit on Apple Silicon (OpenCL and Metal)
|
||||
- Hash Info: show more information (Updated Hash-Format. Added Autodetect, Self-Test, Potfile and Plaintext encoding)
|
||||
@ -68,6 +69,7 @@
|
||||
- OpenCL Runtime: Set default device-type to GPU with Apple Silicon compute devices
|
||||
- Status code: updated negative status code (added kernel create failure and resync)
|
||||
- Status code: updated negative status code, usefull in Unit tests engine (test.sh)
|
||||
- Terminal: show empty OpenCL platforms only in backend information mode
|
||||
- Tuning Database: Added a warning if a module implements module_extra_tuningdb_block but the installed computing device is not found
|
||||
- Unit tests: added -r (--runtime) option
|
||||
- Unit tests: handle negative status code, skip deprecated hash-types, skip hash-types with known perl modules issues, updated output
|
||||
|
@ -4559,17 +4559,24 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
ocl_close (hashcat_ctx);
|
||||
}
|
||||
|
||||
if (opencl_platforms_cnt)
|
||||
if (opencl_platforms_cnt > 0)
|
||||
{
|
||||
for (u32 opencl_platforms_idx = 0; opencl_platforms_idx < opencl_platforms_cnt; opencl_platforms_idx++)
|
||||
{
|
||||
opencl_platforms_name[opencl_platforms_idx] = "N/A";
|
||||
opencl_platforms_vendor[opencl_platforms_idx] = "N/A";
|
||||
opencl_platforms_version[opencl_platforms_idx] = "N/A";
|
||||
opencl_platforms_devices[opencl_platforms_idx] = NULL;
|
||||
opencl_platforms_vendor_id[opencl_platforms_idx] = 0;
|
||||
opencl_platforms_devices_cnt[opencl_platforms_idx] = 0;
|
||||
|
||||
cl_platform_id opencl_platform = opencl_platforms[opencl_platforms_idx];
|
||||
|
||||
size_t param_value_size = 0;
|
||||
|
||||
// platform vendor
|
||||
|
||||
if (hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VENDOR, 0, NULL, ¶m_value_size) == -1) return -1;
|
||||
if (hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VENDOR, 0, NULL, ¶m_value_size) == -1) continue;
|
||||
|
||||
char *opencl_platform_vendor = (char *) hcmalloc (param_value_size);
|
||||
|
||||
@ -4577,14 +4584,14 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
hcfree (opencl_platform_vendor);
|
||||
|
||||
return -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
opencl_platforms_vendor[opencl_platforms_idx] = opencl_platform_vendor;
|
||||
|
||||
// platform name
|
||||
|
||||
if (hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_NAME, 0, NULL, ¶m_value_size) == -1) return -1;
|
||||
if (hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_NAME, 0, NULL, ¶m_value_size) == -1) continue;
|
||||
|
||||
char *opencl_platform_name = (char *) hcmalloc (param_value_size);
|
||||
|
||||
@ -4592,14 +4599,14 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
hcfree (opencl_platform_name);
|
||||
|
||||
return -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
opencl_platforms_name[opencl_platforms_idx] = opencl_platform_name;
|
||||
|
||||
// platform version
|
||||
|
||||
if (hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VERSION, 0, NULL, ¶m_value_size) == -1) return -1;
|
||||
if (hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VERSION, 0, NULL, ¶m_value_size) == -1) continue;
|
||||
|
||||
char *opencl_platform_version = (char *) hcmalloc (param_value_size);
|
||||
|
||||
@ -4607,7 +4614,7 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
hcfree (opencl_platform_version);
|
||||
|
||||
return -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
opencl_platforms_version[opencl_platforms_idx] = opencl_platform_version;
|
||||
@ -4669,8 +4676,6 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (CL_rc == -1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "clGetDeviceIDs(): %s", val2cstr_cl (CL_rc));
|
||||
|
||||
// Special handling for CL_DEVICE_NOT_FOUND, see: https://github.com/hashcat/hashcat/issues/2455
|
||||
|
||||
#define IGNORE_DEVICE_NOT_FOUND 1
|
||||
@ -4683,23 +4688,26 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
const cl_int CL_err = ocl->clGetDeviceIDs (opencl_platform, CL_DEVICE_TYPE_ALL, DEVICES_MAX, opencl_platform_devices, &opencl_platform_devices_cnt);
|
||||
|
||||
if (CL_err == CL_DEVICE_NOT_FOUND)
|
||||
if (CL_err == CL_DEVICE_NOT_FOUND && opencl_platform_devices_cnt > 0)
|
||||
{
|
||||
// we ignore this error
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
hcfree (opencl_platform_devices);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
hcfree (opencl_platform_devices);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
opencl_platforms_devices[opencl_platforms_idx] = opencl_platform_devices;
|
||||
|
||||
opencl_platforms_devices[opencl_platforms_idx] = opencl_platform_devices;
|
||||
opencl_platforms_devices_cnt[opencl_platforms_idx] = opencl_platform_devices_cnt;
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,12 @@ int hc_clGetDeviceIDs (void *hashcat_ctx, cl_platform_id platform, cl_device_typ
|
||||
|
||||
if (CL_err != CL_SUCCESS)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "clGetDeviceIDs(): %s", val2cstr_cl (CL_err));
|
||||
#ifndef DEBUG
|
||||
if (CL_err != CL_DEVICE_NOT_FOUND)
|
||||
#endif
|
||||
{
|
||||
event_log_error (hashcat_ctx, "clGetDeviceIDs(): %s", val2cstr_cl (CL_err));
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -1382,6 +1382,9 @@ void backend_info_compact (hashcat_ctx_t *hashcat_ctx)
|
||||
char *opencl_platform_version = opencl_platforms_version[opencl_platforms_idx];
|
||||
cl_uint opencl_platform_devices_cnt = opencl_platforms_devices_cnt[opencl_platforms_idx];
|
||||
|
||||
// hide empty OpenCL platforms
|
||||
if (opencl_platform_devices_cnt == 0) continue;
|
||||
|
||||
const size_t len = event_log_info (hashcat_ctx, "OpenCL API (%s) - Platform #%u [%s]", opencl_platform_version, opencl_platforms_idx + 1, opencl_platform_vendor);
|
||||
|
||||
char line[HCBUFSIZ_TINY] = { 0 };
|
||||
|
Loading…
Reference in New Issue
Block a user