1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-29 19:38:18 +00:00

Reorder device mapping

This commit is contained in:
jsteube 2016-01-15 17:23:07 +01:00
parent 63e06f582b
commit 5ae5a4bc25
4 changed files with 507 additions and 453 deletions

View File

@ -1630,8 +1630,8 @@ void handle_left_request (pot_t *pot, uint pot_cnt, char *input_buf, int input_l
void handle_show_request_lm (pot_t *pot, uint pot_cnt, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *), FILE *out_fp); void handle_show_request_lm (pot_t *pot, uint pot_cnt, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *), FILE *out_fp);
void handle_left_request_lm (pot_t *pot, uint pot_cnt, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *), FILE *out_fp); void handle_left_request_lm (pot_t *pot, uint pot_cnt, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *), FILE *out_fp);
uint setup_opencl_platforms_filter (char *opencl_platforms); u32 setup_opencl_platforms_filter (char *opencl_platforms);
uint devices_to_devicemask (char *opencl_devices); u32 setup_devices_filter (char *opencl_devices);
cl_device_type setup_device_types_filter (char *opencl_device_types); cl_device_type setup_device_types_filter (char *opencl_device_types);
u32 get_random_num (const u32 min, const u32 max); u32 get_random_num (const u32 min, const u32 max);

View File

@ -818,7 +818,13 @@ typedef struct
struct __hc_device_param struct __hc_device_param
{ {
cl_device_id device;
cl_device_type device_type;
uint device_id; uint device_id;
uint platform_devices_id; // for mapping with hms devices
uint skipped;
uint sm_major; uint sm_major;
uint sm_minor; uint sm_minor;
@ -827,6 +833,8 @@ struct __hc_device_param
uint device_processors; uint device_processors;
uint device_processor_cores; uint device_processor_cores;
u64 device_maxmem_alloc; u64 device_maxmem_alloc;
u64 device_global_mem;
u32 device_maxclock_frequency;
uint kernel_threads; uint kernel_threads;
uint kernel_accel; uint kernel_accel;
@ -888,9 +896,6 @@ struct __hc_device_param
cl_uint vendor_id; cl_uint vendor_id;
cl_device_id device;
cl_device_type device_type;
cl_kernel kernel1; cl_kernel kernel1;
cl_kernel kernel12; cl_kernel kernel12;
cl_kernel kernel2; cl_kernel kernel2;
@ -997,6 +1002,7 @@ typedef struct
uint devices_status; uint devices_status;
uint devices_cnt; uint devices_cnt;
uint devices_active;
hc_device_param_t *devices_param; hc_device_param_t *devices_param;
uint kernel_blocks_all; uint kernel_blocks_all;

File diff suppressed because it is too large Load Diff

View File

@ -5116,7 +5116,7 @@ uint setup_opencl_platforms_filter (char *opencl_platforms)
{ {
int platform = atoi (next); int platform = atoi (next);
if (platform < 1 || platform > 31) if (platform < 1 || platform > 32)
{ {
log_error ("ERROR: invalid OpenCL platform %u specified", platform); log_error ("ERROR: invalid OpenCL platform %u specified", platform);
@ -5137,6 +5137,41 @@ uint setup_opencl_platforms_filter (char *opencl_platforms)
return opencl_platforms_filter; return opencl_platforms_filter;
} }
u32 setup_devices_filter (char *opencl_devices)
{
u32 devices_filter = 0;
if (opencl_devices)
{
char *devices = strdup (opencl_devices);
char *next = strtok (devices, ",");
do
{
int device_id = atoi (next);
if (device_id < 1 || device_id > 32)
{
log_error ("ERROR: invalid device_id %u specified", device_id);
exit (-1);
}
devices_filter |= 1 << (device_id - 1);
} while ((next = strtok (NULL, ",")) != NULL);
free (devices);
}
else
{
devices_filter = -1;
}
return devices_filter;
}
cl_device_type setup_device_types_filter (char *opencl_device_types) cl_device_type setup_device_types_filter (char *opencl_device_types)
{ {
cl_device_type device_types_filter = 0; cl_device_type device_types_filter = 0;
@ -5175,37 +5210,6 @@ cl_device_type setup_device_types_filter (char *opencl_device_types)
return device_types_filter; return device_types_filter;
} }
uint devices_to_devicemask (char *opencl_devices)
{
uint opencl_devicemask = 0;
if (opencl_devices)
{
char *devices = strdup (opencl_devices);
char *next = strtok (devices, ",");
do
{
uint device_id = atoi (next);
if (device_id < 1 || device_id > 8)
{
log_error ("ERROR: invalid device_id %u specified", device_id);
exit (-1);
}
opencl_devicemask |= 1 << (device_id - 1);
} while ((next = strtok (NULL, ",")) != NULL);
free (devices);
}
return opencl_devicemask;
}
u32 get_random_num (const u32 min, const u32 max) u32 get_random_num (const u32 min, const u32 max)
{ {
if (min == max) return (min); if (min == max) return (min);
@ -8859,6 +8863,8 @@ u64 get_lowest_words_done ()
{ {
hc_device_param_t *device_param = &data.devices_param[device_id]; hc_device_param_t *device_param = &data.devices_param[device_id];
if (device_param->skipped) continue;
const u64 words_done = device_param->words_done; const u64 words_done = device_param->words_done;
if (words_done < words_cur) words_cur = words_done; if (words_done < words_cur) words_cur = words_done;