|
|
@ -82,7 +82,7 @@ static inline void affine_to_cpu(int id, int cpu) |
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
enum workio_commands { |
|
|
|
enum workio_commands { |
|
|
|
WC_GET_WORK, |
|
|
|
WC_GET_WORK, |
|
|
|
WC_SUBMIT_WORK, |
|
|
|
WC_SUBMIT_WORK, |
|
|
@ -675,7 +675,7 @@ static double bench_algo_stage2( |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Create and init a chunked of shared memory
|
|
|
|
// Create and init a chunked of shared memory
|
|
|
|
HANDLE map_handle = CreateFileMapping( |
|
|
|
HANDLE map_handle = CreateFileMapping( |
|
|
|
INVALID_HANDLE_VALUE, // use paging file
|
|
|
|
INVALID_HANDLE_VALUE, // use paging file
|
|
|
|
NULL, // default security attributes
|
|
|
|
NULL, // default security attributes
|
|
|
|
PAGE_READWRITE, // read/write access
|
|
|
|
PAGE_READWRITE, // read/write access
|
|
|
@ -688,7 +688,7 @@ static double bench_algo_stage2( |
|
|
|
exit(1); |
|
|
|
exit(1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void *shared_mem = MapViewOfFile( |
|
|
|
void *shared_mem = MapViewOfFile( |
|
|
|
map_handle, // object to map view of
|
|
|
|
map_handle, // object to map view of
|
|
|
|
FILE_MAP_WRITE, // read/write access
|
|
|
|
FILE_MAP_WRITE, // read/write access
|
|
|
|
0, // high offset: map from
|
|
|
|
0, // high offset: map from
|
|
|
@ -731,7 +731,7 @@ static double bench_algo_stage2( |
|
|
|
FALSE, // Set handle inheritance to FALSE
|
|
|
|
FALSE, // Set handle inheritance to FALSE
|
|
|
|
DEBUG_ONLY_THIS_PROCESS,// We're going to debug the child
|
|
|
|
DEBUG_ONLY_THIS_PROCESS,// We're going to debug the child
|
|
|
|
NULL, // Use parent's environment block
|
|
|
|
NULL, // Use parent's environment block
|
|
|
|
NULL, // Use parent's starting directory
|
|
|
|
NULL, // Use parent's starting directory
|
|
|
|
&startup_info, // Pointer to STARTUPINFO structure
|
|
|
|
&startup_info, // Pointer to STARTUPINFO structure
|
|
|
|
&process_info // Pointer to PROCESS_INFORMATION structure
|
|
|
|
&process_info // Pointer to PROCESS_INFORMATION structure
|
|
|
|
); |
|
|
|
); |
|
|
@ -787,8 +787,8 @@ static double bench_algo_stage2( |
|
|
|
|
|
|
|
|
|
|
|
// Reap return value and cleanup
|
|
|
|
// Reap return value and cleanup
|
|
|
|
CopyMemory(&rate, shared_mem, sizeof(rate)); |
|
|
|
CopyMemory(&rate, shared_mem, sizeof(rate)); |
|
|
|
(void)UnmapViewOfFile(shared_mem); |
|
|
|
(void)UnmapViewOfFile(shared_mem); |
|
|
|
(void)CloseHandle(map_handle); |
|
|
|
(void)CloseHandle(map_handle); |
|
|
|
|
|
|
|
|
|
|
|
#else |
|
|
|
#else |
|
|
|
|
|
|
|
|
|
|
@ -2367,7 +2367,7 @@ static void disable_curses(void) |
|
|
|
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE); |
|
|
|
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE); |
|
|
|
CONSOLE_SCREEN_BUFFER_INFO csbi; |
|
|
|
CONSOLE_SCREEN_BUFFER_INFO csbi; |
|
|
|
COORD coord; |
|
|
|
COORD coord; |
|
|
|
|
|
|
|
|
|
|
|
if (GetConsoleScreenBufferInfo(hout, &csbi)) { |
|
|
|
if (GetConsoleScreenBufferInfo(hout, &csbi)) { |
|
|
|
coord.X = 0; |
|
|
|
coord.X = 0; |
|
|
|
coord.Y = csbi.dwSize.Y - 1; |
|
|
|
coord.Y = csbi.dwSize.Y - 1; |
|
|
@ -3487,7 +3487,6 @@ static void hashmeter(int thr_id, struct timeval *diff, |
|
|
|
static double local_mhashes_done = 0; |
|
|
|
static double local_mhashes_done = 0; |
|
|
|
static double rolling = 0; |
|
|
|
static double rolling = 0; |
|
|
|
double local_mhashes = (double)hashes_done / 1000000.0; |
|
|
|
double local_mhashes = (double)hashes_done / 1000000.0; |
|
|
|
struct cgpu_info *cgpu = thr_info[thr_id].cgpu; |
|
|
|
|
|
|
|
bool showlog = false; |
|
|
|
bool showlog = false; |
|
|
|
|
|
|
|
|
|
|
|
/* Update the last time this thread reported in */ |
|
|
|
/* Update the last time this thread reported in */ |
|
|
@ -3497,12 +3496,13 @@ static void hashmeter(int thr_id, struct timeval *diff, |
|
|
|
/* Don't bother calculating anything if we're not displaying it */ |
|
|
|
/* Don't bother calculating anything if we're not displaying it */ |
|
|
|
if (opt_realquiet || !opt_log_interval) |
|
|
|
if (opt_realquiet || !opt_log_interval) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
secs = (double)diff->tv_sec + ((double)diff->tv_usec / 1000000.0); |
|
|
|
secs = (double)diff->tv_sec + ((double)diff->tv_usec / 1000000.0); |
|
|
|
|
|
|
|
|
|
|
|
/* So we can call hashmeter from a non worker thread */ |
|
|
|
/* So we can call hashmeter from a non worker thread */ |
|
|
|
if (thr_id >= 0) { |
|
|
|
if (thr_id >= 0) { |
|
|
|
struct thr_info *thr = &thr_info[thr_id]; |
|
|
|
struct thr_info *thr = &thr_info[thr_id]; |
|
|
|
|
|
|
|
struct cgpu_info *cgpu = thr_info[thr_id].cgpu; |
|
|
|
double thread_rolling = 0.0; |
|
|
|
double thread_rolling = 0.0; |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
@ -4218,7 +4218,7 @@ static cl_int queue_phatk_kernel(_clState *clState, dev_blk_ctx *blk) |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_f); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_f); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_g); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_g); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_h); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_h); |
|
|
|
|
|
|
|
|
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_b); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_b); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_c); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_c); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_d); |
|
|
|
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_d); |
|
|
@ -4536,7 +4536,7 @@ static void *longpoll_thread(void *userdata) |
|
|
|
lp_url = hdr_path; |
|
|
|
lp_url = hdr_path; |
|
|
|
hdr_path = NULL; |
|
|
|
hdr_path = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* absolute path, on current server */ |
|
|
|
/* absolute path, on current server */ |
|
|
|
else { |
|
|
|
else { |
|
|
|
copy_start = (*hdr_path == '/') ? (hdr_path + 1) : hdr_path; |
|
|
|
copy_start = (*hdr_path == '/') ? (hdr_path + 1) : hdr_path; |
|
|
@ -5259,6 +5259,8 @@ int main (int argc, char *argv[]) |
|
|
|
init_max_name_len(); |
|
|
|
init_max_name_len(); |
|
|
|
|
|
|
|
|
|
|
|
handler.sa_handler = &sighandler; |
|
|
|
handler.sa_handler = &sighandler; |
|
|
|
|
|
|
|
handler.sa_flags = 0; |
|
|
|
|
|
|
|
sigemptyset(&handler.sa_mask); |
|
|
|
sigaction(SIGTERM, &handler, &termhandler); |
|
|
|
sigaction(SIGTERM, &handler, &termhandler); |
|
|
|
sigaction(SIGINT, &handler, &inthandler); |
|
|
|
sigaction(SIGINT, &handler, &inthandler); |
|
|
|
|
|
|
|
|
|
|
@ -5359,7 +5361,7 @@ int main (int argc, char *argv[]) |
|
|
|
#if defined(WIN32) |
|
|
|
#if defined(WIN32) |
|
|
|
char unique_name[64]; |
|
|
|
char unique_name[64]; |
|
|
|
if (GetEnvironmentVariable("CGMINER_SHARED_MEM", unique_name, 32)) { |
|
|
|
if (GetEnvironmentVariable("CGMINER_SHARED_MEM", unique_name, 32)) { |
|
|
|
HANDLE map_handle = CreateFileMapping( |
|
|
|
HANDLE map_handle = CreateFileMapping( |
|
|
|
INVALID_HANDLE_VALUE, // use paging file
|
|
|
|
INVALID_HANDLE_VALUE, // use paging file
|
|
|
|
NULL, // default security attributes
|
|
|
|
NULL, // default security attributes
|
|
|
|
PAGE_READWRITE, // read/write access
|
|
|
|
PAGE_READWRITE, // read/write access
|
|
|
@ -5368,18 +5370,18 @@ int main (int argc, char *argv[]) |
|
|
|
unique_name // name of map object
|
|
|
|
unique_name // name of map object
|
|
|
|
); |
|
|
|
); |
|
|
|
if (NULL!=map_handle) { |
|
|
|
if (NULL!=map_handle) { |
|
|
|
void *shared_mem = MapViewOfFile( |
|
|
|
void *shared_mem = MapViewOfFile( |
|
|
|
map_handle, // object to map view of
|
|
|
|
map_handle, // object to map view of
|
|
|
|
FILE_MAP_WRITE, // read/write access
|
|
|
|
FILE_MAP_WRITE, // read/write access
|
|
|
|
0, // high offset: map from
|
|
|
|
0, // high offset: map from
|
|
|
|
0, // low offset: beginning
|
|
|
|
0, // low offset: beginning
|
|
|
|
0 // default: map entire file
|
|
|
|
0 // default: map entire file
|
|
|
|
); |
|
|
|
); |
|
|
|
if (NULL!=shared_mem) |
|
|
|
if (NULL!=shared_mem) |
|
|
|
CopyMemory(shared_mem, &rate, sizeof(rate)); |
|
|
|
CopyMemory(shared_mem, &rate, sizeof(rate)); |
|
|
|
(void)UnmapViewOfFile(shared_mem); |
|
|
|
(void)UnmapViewOfFile(shared_mem); |
|
|
|
} |
|
|
|
} |
|
|
|
(void)CloseHandle(map_handle); |
|
|
|
(void)CloseHandle(map_handle); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
@ -5396,6 +5398,7 @@ int main (int argc, char *argv[]) |
|
|
|
} else |
|
|
|
} else |
|
|
|
chosen_kernel = KL_NONE; |
|
|
|
chosen_kernel = KL_NONE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_OPENCL |
|
|
|
gpu_threads = nDevs * opt_g_threads; |
|
|
|
gpu_threads = nDevs * opt_g_threads; |
|
|
|
if (total_devices) { |
|
|
|
if (total_devices) { |
|
|
|
if (total_devices > nDevs) |
|
|
|
if (total_devices > nDevs) |
|
|
@ -5418,6 +5421,9 @@ int main (int argc, char *argv[]) |
|
|
|
gpu_devices[i] = true; |
|
|
|
gpu_devices[i] = true; |
|
|
|
total_devices = nDevs; |
|
|
|
total_devices = nDevs; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
gpu_threads = 0; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
if (!gpu_threads && !forced_n_threads) { |
|
|
|
if (!gpu_threads && !forced_n_threads) { |
|
|
|
/* Maybe they turned GPU off; restore default CPU threads. */ |
|
|
|
/* Maybe they turned GPU off; restore default CPU threads. */ |
|
|
@ -5456,7 +5462,7 @@ int main (int argc, char *argv[]) |
|
|
|
quit(1, "Failed to malloc userpass"); |
|
|
|
quit(1, "Failed to malloc userpass"); |
|
|
|
sprintf(pool->rpc_userpass, "%s:%s", pool->rpc_user, pool->rpc_pass); |
|
|
|
sprintf(pool->rpc_userpass, "%s:%s", pool->rpc_user, pool->rpc_pass); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
pool->rpc_user = malloc(strlen(pool->rpc_userpass)); |
|
|
|
pool->rpc_user = malloc(strlen(pool->rpc_userpass) + 1); |
|
|
|
if (!pool->rpc_user) |
|
|
|
if (!pool->rpc_user) |
|
|
|
quit(1, "Failed to malloc user"); |
|
|
|
quit(1, "Failed to malloc user"); |
|
|
|
strcpy(pool->rpc_user, pool->rpc_userpass); |
|
|
|
strcpy(pool->rpc_user, pool->rpc_userpass); |
|
|
@ -5498,7 +5504,7 @@ int main (int argc, char *argv[]) |
|
|
|
quit(1, "Failed to tq_new"); |
|
|
|
quit(1, "Failed to tq_new"); |
|
|
|
|
|
|
|
|
|
|
|
/* start work I/O thread */ |
|
|
|
/* start work I/O thread */ |
|
|
|
if (thr_info_create(thr, NULL, workio_thread, thr)) |
|
|
|
if (thr_info_create(thr, NULL, workio_thread, thr)) |
|
|
|
quit(1, "workio thread create failed"); |
|
|
|
quit(1, "workio thread create failed"); |
|
|
|
|
|
|
|
|
|
|
|
/* init longpoll thread info */ |
|
|
|
/* init longpoll thread info */ |
|
|
|