mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
fix opt_kernel_path writing over the allocated memory! also some small changes for more robust hard restart
This commit is contained in:
parent
77c996858b
commit
954c0e6fbc
@ -1226,8 +1226,6 @@ static bool opencl_thread_prepare(struct thr_info *thr)
|
|||||||
|
|
||||||
strcpy(name, "");
|
strcpy(name, "");
|
||||||
applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu);
|
applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu);
|
||||||
if (thrdata)
|
|
||||||
thrdata->queue_kernel_parameters = cgpu->algorithm.queue_kernel;
|
|
||||||
|
|
||||||
clStates[i] = initCl(virtual_gpu, name, sizeof(name), &cgpu->algorithm);
|
clStates[i] = initCl(virtual_gpu, name, sizeof(name), &cgpu->algorithm);
|
||||||
if (!clStates[i]) {
|
if (!clStates[i]) {
|
||||||
@ -1440,6 +1438,9 @@ static void opencl_thread_shutdown(struct thr_info *thr)
|
|||||||
free(clState->extra_kernels);
|
free(clState->extra_kernels);
|
||||||
free(clState);
|
free(clState);
|
||||||
}
|
}
|
||||||
|
free(((struct opencl_thread_data *)thr->cgpu_data)->res);
|
||||||
|
free(thr->cgpu_data);
|
||||||
|
thr->cgpu_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct device_drv opencl_drv = {
|
struct device_drv opencl_drv = {
|
||||||
|
13
sgminer.c
13
sgminer.c
@ -6231,8 +6231,10 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work)
|
|||||||
for (i = 0; i < mining_threads; i++) {
|
for (i = 0; i < mining_threads; i++) {
|
||||||
struct thr_info *thr = mining_thr[i];
|
struct thr_info *thr = mining_thr[i];
|
||||||
thr->cgpu->algorithm = work->pool->algorithm;
|
thr->cgpu->algorithm = work->pool->algorithm;
|
||||||
if (soft_restart)
|
if (soft_restart) {
|
||||||
thr->cgpu->drv->thread_prepare(thr);
|
thr->cgpu->drv->thread_prepare(thr);
|
||||||
|
thr->cgpu->drv->thread_init(thr);
|
||||||
|
}
|
||||||
|
|
||||||
// Necessary because algorithms can have dramatically different diffs
|
// Necessary because algorithms can have dramatically different diffs
|
||||||
thr->cgpu->drv->working_diff = 1;
|
thr->cgpu->drv->working_diff = 1;
|
||||||
@ -7815,6 +7817,8 @@ static void restart_mining_threads(unsigned int new_n_threads)
|
|||||||
|
|
||||||
static void *restart_mining_threads_thread(void *userdata)
|
static void *restart_mining_threads_thread(void *userdata)
|
||||||
{
|
{
|
||||||
|
pthread_detach(pthread_self());
|
||||||
|
|
||||||
restart_mining_threads((unsigned int) (intptr_t) userdata);
|
restart_mining_threads((unsigned int) (intptr_t) userdata);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -7993,11 +7997,18 @@ int main(int argc, char *argv[])
|
|||||||
free(cnfbuf);
|
free(cnfbuf);
|
||||||
cnfbuf = NULL;
|
cnfbuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opt_kernel_path) {
|
||||||
|
char *old_path = opt_kernel_path;
|
||||||
|
opt_kernel_path = (char *)alloca(PATH_MAX);
|
||||||
|
strcpy(opt_kernel_path, old_path);
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
strcat(opt_kernel_path, "\\");
|
strcat(opt_kernel_path, "\\");
|
||||||
#else
|
#else
|
||||||
strcat(opt_kernel_path, "/");
|
strcat(opt_kernel_path, "/");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (want_per_device_stats)
|
if (want_per_device_stats)
|
||||||
opt_log_output = true;
|
opt_log_output = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user