Add CUDA device attributes to -I

This commit is contained in:
Jens Steube
2019-04-30 13:38:44 +02:00
parent c80e516c3c
commit e3500ff4aa
73 changed files with 1404 additions and 1280 deletions

View File

@@ -11,16 +11,16 @@
#ifndef _HWMON_H
#define _HWMON_H
int hm_get_threshold_slowdown_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_threshold_shutdown_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_temperature_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_fanpolicy_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_fanspeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_buslanes_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_utilization_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_memoryspeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_corespeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_throttle_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int hm_get_threshold_slowdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_threshold_shutdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_fanpolicy_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_fanspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_buslanes_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_utilization_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_memoryspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_corespeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_throttle_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx);
void hwmon_ctx_destroy (hashcat_ctx_t *hashcat_ctx);

View File

@@ -19,8 +19,8 @@ void format_speed_display_1k (double val, char *buf, size_t len);
int status_get_device_info_cnt (const hashcat_ctx_t *hashcat_ctx);
int status_get_device_info_active (const hashcat_ctx_t *hashcat_ctx);
bool status_get_skipped_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
bool status_get_skipped_warning_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
bool status_get_skipped_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
bool status_get_skipped_warning_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
char *status_get_session (const hashcat_ctx_t *hashcat_ctx);
const char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx);
int status_get_status_number (const hashcat_ctx_t *hashcat_ctx);
@@ -35,7 +35,7 @@ int status_get_guess_mod_count (const hashcat_ctx_t *hash
double status_get_guess_mod_percent (const hashcat_ctx_t *hashcat_ctx);
char *status_get_guess_charset (const hashcat_ctx_t *hashcat_ctx);
int status_get_guess_mask_length (const hashcat_ctx_t *hashcat_ctx);
char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
char *status_get_hash_name (const hashcat_ctx_t *hashcat_ctx);
char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx);
int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx);
@@ -68,12 +68,12 @@ u64 status_get_progress_skip (const hashcat_ctx_t *hash
u64 status_get_progress_cur_relative_skip (const hashcat_ctx_t *hashcat_ctx);
u64 status_get_progress_end_relative_skip (const hashcat_ctx_t *hashcat_ctx);
double status_get_hashes_msec_all (const hashcat_ctx_t *hashcat_ctx);
double status_get_hashes_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
double status_get_hashes_msec_dev_benchmark (const hashcat_ctx_t *hashcat_ctx, const int device_id);
double status_get_hashes_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
double status_get_hashes_msec_dev_benchmark (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
double status_get_exec_msec_all (const hashcat_ctx_t *hashcat_ctx);
double status_get_exec_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
double status_get_exec_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
char *status_get_speed_sec_all (const hashcat_ctx_t *hashcat_ctx);
char *status_get_speed_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_speed_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_cpt_cur_min (const hashcat_ctx_t *hashcat_ctx);
int status_get_cpt_cur_hour (const hashcat_ctx_t *hashcat_ctx);
int status_get_cpt_cur_day (const hashcat_ctx_t *hashcat_ctx);
@@ -81,30 +81,30 @@ int status_get_cpt_avg_min (const hashcat_ctx_t *hash
int status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx);
int status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx);
char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx);
int status_get_salt_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_innerloop_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_innerloop_left_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_iteration_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_iteration_left_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_salt_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_innerloop_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_innerloop_left_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_iteration_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_iteration_left_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
#ifdef WITH_BRAIN
int status_get_brain_session (const hashcat_ctx_t *hashcat_ctx);
int status_get_brain_attack (const hashcat_ctx_t *hashcat_ctx);
int status_get_brain_link_client_id_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_brain_link_status_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_brain_link_recv_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_brain_link_send_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_brain_link_recv_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_brain_link_send_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_brain_link_client_id_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_brain_link_status_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
char *status_get_brain_link_recv_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
char *status_get_brain_link_send_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
char *status_get_brain_link_recv_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
char *status_get_brain_link_send_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
#endif
char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
u64 status_get_progress_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
double status_get_runtime_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_kernel_accel_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_kernel_loops_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_kernel_threads_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_vector_width_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
u64 status_get_progress_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
double status_get_runtime_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_kernel_accel_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_kernel_loops_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_kernel_threads_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_vector_width_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_progress_init (hashcat_ctx_t *hashcat_ctx);
void status_progress_destroy (hashcat_ctx_t *hashcat_ctx);

View File

@@ -18,7 +18,7 @@
#if defined (_WIN)
#define hc_thread_create(t,f,a) t = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) &f, a, 0, NULL)
#define hc_thread_wait(n,a) for (u32 i = 0; i < n; i++) WaitForSingleObject ((a)[i], INFINITE)
#define hc_thread_wait(n,a) for (int i = 0; i < n; i++) WaitForSingleObject ((a)[i], INFINITE)
#define hc_thread_exit(t) ExitThread (t)
#define hc_thread_detach(t) CloseHandle (t)
@@ -42,7 +42,7 @@
#else
#define hc_thread_create(t,f,a) pthread_create (&t, NULL, f, a)
#define hc_thread_wait(n,a) for (u32 i = 0; i < n; i++) pthread_join ((a)[i], NULL)
#define hc_thread_wait(n,a) for (int i = 0; i < n; i++) pthread_join ((a)[i], NULL)
#define hc_thread_exit(t) pthread_exit (&t)
#define hc_thread_detach(t) pthread_detach (t)

View File

@@ -995,13 +995,13 @@ typedef struct link_speed
typedef struct hc_device_param
{
u32 device_id;
int device_id;
u8 pcie_bus;
u8 pcie_device;
u8 pcie_function;
u32 platform_devices_id; // for mapping with hms devices
u32 opencl_platform_devices_id; // for mapping with hms devices
bool skipped; // permanent
bool skipped_warning; // iteration
@@ -1014,6 +1014,7 @@ typedef struct hc_device_param
size_t device_maxworkgroup_size;
u64 device_local_mem_size;
int device_local_mem_type;
char *device_name;
int sm_major;
int sm_minor;
@@ -1198,14 +1199,6 @@ typedef struct hc_device_param
hc_timer_t timer_speed;
// device specific attributes starting
char *device_name;
char *device_vendor;
char *device_version;
char *driver_version;
char *device_opencl_version;
// AMD
bool has_vadd3;
bool has_vbfe;
@@ -1256,17 +1249,25 @@ typedef struct hc_device_param
// API: cuda
bool is_cuda;
CUdevice cuda_device;
// API: opencl
cl_device_id device;
bool is_opencl;
cl_device_id opencl_device;
char *opencl_driver_version;
char *opencl_device_vendor;
char *opencl_device_version;
char *opencl_device_c_version;
cl_platform_id opencl_platform;
cl_device_type opencl_device_type;
cl_platform_id platform;
cl_uint device_vendor_id;
cl_uint platform_vendor_id;
cl_uint opencl_device_vendor_id;
cl_uint opencl_platform_vendor_id;
cl_kernel kernel1;
cl_kernel kernel12;
@@ -1346,10 +1347,9 @@ typedef struct backend_ctx
void *cuda;
void *nvrtc;
int *backend_device_from_cuda; // from cuda device index to backend device index
int *backend_device_to_cuda; // from backend device index to cuda device index
int *backend_device_from_opencl; // from opencl device index to backend device index
int *backend_device_to_opencl; // from backend device index to opencl device index
int backend_device_from_cuda[DEVICES_MAX]; // from cuda device index to backend device index
int backend_device_from_opencl[DEVICES_MAX]; // from opencl device index to backend device index
int backend_device_from_opencl_platform[CL_PLATFORMS_MAX][DEVICES_MAX]; // from opencl device index to backend device index (by platform)
int backend_devices_cnt;
int backend_devices_active;
@@ -1358,9 +1358,6 @@ typedef struct backend_ctx
int opencl_devices_cnt;
int opencl_devices_active;
u32 devices_cnt;
u32 devices_active;
hc_device_param_t *devices_param;
u32 hardware_power_all;
@@ -1387,15 +1384,14 @@ typedef struct backend_ctx
// opencl
cl_uint platforms_cnt;
cl_platform_id *platforms;
char **platforms_vendor;
char **platforms_name;
char **platforms_version;
bool *platforms_skipped;
cl_uint platform_devices_cnt;
cl_device_id *platform_devices;
cl_platform_id *opencl_platforms;
cl_uint opencl_platforms_cnt;
cl_device_id **opencl_platforms_devices;
cl_uint *opencl_platforms_devices_cnt;
char **opencl_platforms_name;
bool *opencl_platforms_skipped;
char **opencl_platforms_vendor;
char **opencl_platforms_version;
u64 opencl_platforms_filter;
cl_device_type opencl_device_types_filter;