Reorder device mapping

pull/132/head
jsteube 8 years ago
parent 63e06f582b
commit 5ae5a4bc25

@ -1630,9 +1630,9 @@ 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_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);
uint devices_to_devicemask (char *opencl_devices);
cl_device_type setup_device_types_filter (char *opencl_device_types);
u32 setup_opencl_platforms_filter (char *opencl_platforms);
u32 setup_devices_filter (char *opencl_devices);
cl_device_type setup_device_types_filter (char *opencl_device_types);
u32 get_random_num (const u32 min, const u32 max);

@ -818,7 +818,13 @@ typedef struct
struct __hc_device_param
{
cl_device_id device;
cl_device_type device_type;
uint device_id;
uint platform_devices_id; // for mapping with hms devices
uint skipped;
uint sm_major;
uint sm_minor;
@ -826,7 +832,9 @@ struct __hc_device_param
uint device_processors;
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_accel;
@ -859,10 +867,10 @@ struct __hc_device_param
pw_t *pws_buf;
uint pws_cnt;
u64 pw_cnt;
u64 pw_cnt;
u64 words_off;
u64 words_done;
u64 words_off;
u64 words_done;
uint *result;
@ -873,7 +881,7 @@ struct __hc_device_param
uint innerloop_left;
uint speed_pos;
u64 speed_cnt[SPEED_CACHE];
u64 speed_cnt[SPEED_CACHE];
float speed_ms[SPEED_CACHE];
hc_timer_t speed_rec[SPEED_CACHE];
@ -888,9 +896,6 @@ struct __hc_device_param
cl_uint vendor_id;
cl_device_id device;
cl_device_type device_type;
cl_kernel kernel1;
cl_kernel kernel12;
cl_kernel kernel2;
@ -997,6 +1002,7 @@ typedef struct
uint devices_status;
uint devices_cnt;
uint devices_active;
hc_device_param_t *devices_param;
uint kernel_blocks_all;

File diff suppressed because it is too large Load Diff

@ -5116,7 +5116,7 @@ uint setup_opencl_platforms_filter (char *opencl_platforms)
{
int platform = atoi (next);
if (platform < 1 || platform > 31)
if (platform < 1 || platform > 32)
{
log_error ("ERROR: invalid OpenCL platform %u specified", platform);
@ -5137,73 +5137,77 @@ uint setup_opencl_platforms_filter (char *opencl_platforms)
return opencl_platforms_filter;
}
cl_device_type setup_device_types_filter (char *opencl_device_types)
u32 setup_devices_filter (char *opencl_devices)
{
cl_device_type device_types_filter = 0;
u32 devices_filter = 0;
if (opencl_device_types)
if (opencl_devices)
{
char *device_types = strdup (opencl_device_types);
char *devices = strdup (opencl_devices);
char *next = strtok (device_types, ",");
char *next = strtok (devices, ",");
do
{
int device_type = atoi (next);
int device_id = atoi (next);
if (device_type < 1 || device_type > 3)
if (device_id < 1 || device_id > 32)
{
log_error ("ERROR: invalid device_type %u specified", device_type);
log_error ("ERROR: invalid device_id %u specified", device_id);
exit (-1);
}
device_types_filter |= 1 << device_type;
devices_filter |= 1 << (device_id - 1);
} while ((next = strtok (NULL, ",")) != NULL);
free (device_types);
free (devices);
}
else
{
// Do not use CPU by default, this often reduces GPU performance because
// the CPU is to busy to handle GPU synchronization
device_types_filter = CL_DEVICE_TYPE_ALL & ~CL_DEVICE_TYPE_CPU;
devices_filter = -1;
}
return device_types_filter;
return devices_filter;
}
uint devices_to_devicemask (char *opencl_devices)
cl_device_type setup_device_types_filter (char *opencl_device_types)
{
uint opencl_devicemask = 0;
cl_device_type device_types_filter = 0;
if (opencl_devices)
if (opencl_device_types)
{
char *devices = strdup (opencl_devices);
char *device_types = strdup (opencl_device_types);
char *next = strtok (devices, ",");
char *next = strtok (device_types, ",");
do
{
uint device_id = atoi (next);
int device_type = atoi (next);
if (device_id < 1 || device_id > 8)
if (device_type < 1 || device_type > 3)
{
log_error ("ERROR: invalid device_id %u specified", device_id);
log_error ("ERROR: invalid device_type %u specified", device_type);
exit (-1);
}
opencl_devicemask |= 1 << (device_id - 1);
device_types_filter |= 1 << device_type;
} while ((next = strtok (NULL, ",")) != NULL);
free (devices);
free (device_types);
}
else
{
// Do not use CPU by default, this often reduces GPU performance because
// the CPU is to busy to handle GPU synchronization
return opencl_devicemask;
device_types_filter = CL_DEVICE_TYPE_ALL & ~CL_DEVICE_TYPE_CPU;
}
return device_types_filter;
}
u32 get_random_num (const u32 min, const u32 max)
@ -8859,6 +8863,8 @@ u64 get_lowest_words_done ()
{
hc_device_param_t *device_param = &data.devices_param[device_id];
if (device_param->skipped) continue;
const u64 words_done = device_param->words_done;
if (words_done < words_cur) words_cur = words_done;

Loading…
Cancel
Save