Browse Source

Merge branch 'master' into build-msvs2010-upd

Conflicts (resolved):
	sgminer.c
nfactor-troky
Noel Maersk 11 years ago
parent
commit
b97a641ed9
  1. 9
      AUTHORS.md
  2. 8
      README.md
  3. 21
      api.c
  4. 22
      compat.h
  5. 3
      doc/BUGS.md
  6. 4
      doc/KERNEL.md
  7. 1
      miner.h
  8. 13
      ocl.c
  9. 43
      sgminer.c

9
AUTHORS.md

@ -19,17 +19,18 @@ updated by many others. @@ -19,17 +19,18 @@ updated by many others.
* alexkarnew/alexkarold: Alexey Karimov LMqRcHdwnZtTMH6c2kWoxSoKM5KySfaP5C
## Testing and bug fixes
## Testing, bug fixes, improvements
* Gabriel Devenyi <gdevenyi>
* Benjamin Herrenschmidt <ozbenh>
* Joe4782
* gacheson
* Joe4782 <Joe4782>
* gacheson <gacheson>
* tonobitc <tonobitc>
* Perry Huang <perryh>
...and many others. See:
* [veox/sgminer](https://github.com/veox/sgminer/graphs/contributors)
* [ckolivas/cgminer](https://github.com/ckolivas/cgminer/graphs/contributors)
## Legacy

8
README.md

@ -8,7 +8,13 @@ This is a multi-threaded multi-pool GPU miner with ATI GPU monitoring, @@ -8,7 +8,13 @@ This is a multi-threaded multi-pool GPU miner with ATI GPU monitoring,
cgminer by Con Kolivas (ckolivas), which is in turn based on cpuminer by
Jeff Garzik (jgarzik).
GIT TREE: https://github.com/veox/sgminer
**releases**: https://github.com/veox/sgminer/releases
**git tree**: https://github.com/veox/sgminer
**issues**: https://github.com/veox/sgminer/issues
**irc**: `#sgminer` on freenode
License: GPLv3. See `COPYING` for details.

21
api.c

@ -756,6 +756,7 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu @@ -756,6 +756,7 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu
case API_DOUBLE:
case API_ELAPSED:
case API_MHS:
case API_KHS:
case API_MHTOTAL:
case API_UTILITY:
case API_FREQ:
@ -868,6 +869,11 @@ struct api_data *api_add_mhs(struct api_data *root, char *name, double *data, bo @@ -868,6 +869,11 @@ struct api_data *api_add_mhs(struct api_data *root, char *name, double *data, bo
return api_add_data_full(root, name, API_MHS, (void *)data, copy_data);
}
struct api_data *api_add_khs(struct api_data *root, char *name, double *data, bool copy_data)
{
return api_add_data_full(root, name, API_KHS, (void *)data, copy_data);
}
struct api_data *api_add_mhtotal(struct api_data *root, char *name, double *data, bool copy_data)
{
return api_add_data_full(root, name, API_MHTOTAL, (void *)data, copy_data);
@ -983,6 +989,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson @@ -983,6 +989,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
case API_MHS:
sprintf(buf, "%.4f", *((double *)(root->data)));
break;
case API_KHS:
sprintf(buf, "%.0f", *((double *)(root->data)));
break;
case API_VOLTS:
sprintf(buf, "%.3f", *((float *)(root->data)));
break;
@ -1672,6 +1681,12 @@ static void gpustatus(struct io_data *io_data, int gpu, bool isjson, bool precom @@ -1672,6 +1681,12 @@ static void gpustatus(struct io_data *io_data, int gpu, bool isjson, bool precom
char mhsname[27];
sprintf(mhsname, "MHS %ds", opt_log_interval);
root = api_add_mhs(root, mhsname, &(cgpu->rolling), false);
double khs_avg = mhs * 1000.0;
double khs_rolling = cgpu->rolling * 1000.0;
root = api_add_khs(root, "KHS av", &khs_avg, false);
char khsname[27];
sprintf(khsname, "KHS %ds", opt_log_interval);
root = api_add_khs(root, khsname, &khs_rolling, false);
root = api_add_int(root, "Accepted", &(cgpu->accepted), false);
root = api_add_int(root, "Rejected", &(cgpu->rejected), false);
root = api_add_int(root, "Hardware Errors", &(cgpu->hw_errors), false);
@ -1879,6 +1894,12 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb @@ -1879,6 +1894,12 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
char mhsname[27];
sprintf(mhsname, "MHS %ds", opt_log_interval);
root = api_add_mhs(root, mhsname, &(total_rolling), false);
double khs_avg = mhs * 1000.0;
double khs_rolling = total_rolling * 1000.0;
root = api_add_khs(root, "KHS av", &khs_avg, false);
char khsname[27];
sprintf(khsname, "KHS %ds", opt_log_interval);
root = api_add_khs(root, khsname, &khs_rolling, false);
root = api_add_uint(root, "Found Blocks", &(found_blocks), true);
root = api_add_int(root, "Getworks", &(total_getworks), true);
root = api_add_int(root, "Accepted", &(total_accepted), true);

22
compat.h

@ -47,16 +47,18 @@ static inline int nanosleep(const struct timespec *req, struct timespec *rem) @@ -47,16 +47,18 @@ static inline int nanosleep(const struct timespec *req, struct timespec *rem)
}
#endif
/* Reported unneded in https://github.com/veox/sgminer/issues/37 */
/* static inline int sleep(unsigned int secs) */
/* { */
/* struct timespec req, rem; */
/* req.tv_sec = secs; */
/* req.tv_nsec = 0; */
/* if (!nanosleep(&req, &rem)) */
/* return 0; */
/* return rem.tv_sec + (rem.tv_nsec ? 1 : 0); */
/* } */
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
// Reported unneded in https://github.com/veox/sgminer/issues/37 */
static inline int sleep(unsigned int secs)
{
struct timespec req, rem;
req.tv_sec = secs;
req.tv_nsec = 0;
if (!nanosleep(&req, &rem))
return 0;
return rem.tv_sec + (rem.tv_nsec ? 1 : 0);
}
#endif
enum {
PRIO_PROCESS = 0,

3
doc/BUGS.md

@ -16,7 +16,8 @@ Information that is most often relevant: @@ -16,7 +16,8 @@ Information that is most often relevant:
* AMD APP SDK version;
* AMD ADL version;
* GPUs used (`sgminer --ndevs`);
* `sgminer` version (`sgminer --version` or `git describe`);
* whether you're using a pre-compiled binary or bult from source;
* `sgminer` version (`sgminer --version` and/or `git describe`);
* contents of the configuration file;
* launch procedure (manual or via script);
* steps to repeat;

4
doc/KERNEL.md

@ -18,7 +18,7 @@ A description of how to do this is available in `doc/MINING`. @@ -18,7 +18,7 @@ A description of how to do this is available in `doc/MINING`.
### alexkarnew
Alaxey Karimov's optimised kernel, based on `ckolivas`. For Catalyst >=13.4.
Alexey Karimov's optimised kernel, based on `ckolivas`. For Catalyst >=13.4.
Only supports `vectors=1`.
@ -27,7 +27,7 @@ Only supports `vectors=1`. @@ -27,7 +27,7 @@ Only supports `vectors=1`.
### alexkarold
Alaxey Karimov's optimised kernel, based on `ckolivas`. For Catalyst <13.4.
Alexey Karimov's optimised kernel, based on `ckolivas`. For Catalyst <13.4.
Only supports `vectors=1`.

1
miner.h

@ -1439,6 +1439,7 @@ enum api_data_type { @@ -1439,6 +1439,7 @@ enum api_data_type {
API_TIMEVAL,
API_TIME,
API_MHS,
API_KHS,
API_MHTOTAL,
API_TEMP,
API_UTILITY,

13
ocl.c

@ -41,10 +41,9 @@ char *file_contents(const char *filename, int *length) @@ -41,10 +41,9 @@ char *file_contents(const char *filename, int *length)
void *buffer;
FILE *f;
/* Try in the optional kernel path first, defaults to PREFIX */
strcpy(fullpath, opt_kernel_path);
strcat(fullpath, filename);
/* Try in the optional kernel path or installed prefix first */
f = fopen(fullpath, "rb");
if (!f) {
/* Then try from the path sgminer was called */
@ -52,12 +51,20 @@ char *file_contents(const char *filename, int *length) @@ -52,12 +51,20 @@ char *file_contents(const char *filename, int *length)
strcat(fullpath, filename);
f = fopen(fullpath, "rb");
}
if (!f) {
/* Then from `pwd`/kernel/ */
strcpy(fullpath, sgminer_path);
strcat(fullpath, "kernel/");
strcat(fullpath, filename);
f = fopen(fullpath, "rb");
}
/* Finally try opening it directly */
if (!f)
f = fopen(filename, "rb");
if (!f) {
applog(LOG_ERR, "Unable to open %s or %s for reading", filename, fullpath);
applog(LOG_ERR, "Unable to open %s or %s for reading",
filename, fullpath);
return NULL;
}

43
sgminer.c

@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
#ifndef WIN32
#include <sys/resource.h>
#else
#include <winsock2.h>
#include <windows.h>
#endif
#include <ccan/opt/opt.h>
@ -211,7 +212,7 @@ static struct pool *currentpool = NULL; @@ -211,7 +212,7 @@ static struct pool *currentpool = NULL;
int total_pools, enabled_pools;
enum pool_strategy pool_strategy = POOL_FAILOVER;
int opt_rotate_period;
static int total_urls, total_users, total_passes, total_userpasses, total_poolnames;
static int total_urls, total_users, total_passes, total_userpasses;
static int json_array_index;
static
@ -509,15 +510,12 @@ struct pool *add_pool(void) @@ -509,15 +510,12 @@ struct pool *add_pool(void)
pool = (struct pool *)calloc(sizeof(struct pool), 1);
if (!pool)
quit(1, "Failed to malloc pool in add_pool");
quit(1, "Failed to calloc pool in add_pool");
pool->pool_no = pool->prio = total_pools;
/* Default pool name */
char buf[32];
sprintf(buf, "%s%s%s",
pool->sockaddr_url,
pool->has_stratum ? ":" : "",
pool->has_stratum ? pool->stratum_port : "");
sprintf(buf, "Pool %d", pool->pool_no);
pool->poolname = strdup(buf);
pools = realloc(pools, sizeof(struct pool *) * (total_pools + 2));
@ -741,11 +739,11 @@ static char *set_poolname(char *arg) @@ -741,11 +739,11 @@ static char *set_poolname(char *arg)
{
struct pool *pool;
total_poolnames++;
if (total_poolnames > total_pools)
while ((json_array_index + 1) > total_pools)
add_pool();
pool = pools[json_array_index];
pool = pools[total_poolnames - 1];
applog(LOG_DEBUG, "Setting pool %i name to %s", pool->pool_no, arg);
opt_set_charp(arg, &pool->poolname);
return NULL;
@ -807,7 +805,6 @@ static char *set_pool_state(char *arg) @@ -807,7 +805,6 @@ static char *set_pool_state(char *arg)
pool = pools[json_array_index];
applog(LOG_INFO, "Setting pool %s state to %s", pool->poolname, arg);
if (strcmp(arg, "disabled") == 0) {
pool->state = POOL_DISABLED;
} else if (strcmp(arg, "enabled") == 0) {
@ -3045,7 +3042,7 @@ static void kill_mining(void) @@ -3045,7 +3042,7 @@ static void kill_mining(void)
if (thr && PTH(thr) != 0L)
pth = &thr->pth;
thr_info_cancel(thr);
#ifndef WIN32
#if !defined(WIN32) || defined(__MINGW64_VERSION_MAJOR)
if (pth && *pth)
pthread_join(*pth, NULL);
#else
@ -4715,7 +4712,7 @@ retry: @@ -4715,7 +4712,7 @@ retry:
immedok(logwin, false);
opt_loginput = false;
}
#endif
#endif /* HAVE_CURSES */
void default_save_file(char *filename)
{
@ -4750,7 +4747,7 @@ static void set_options(void) @@ -4750,7 +4747,7 @@ static void set_options(void)
clear_logwin();
retry:
wlogprint("[Q]ueue: %d\n[S]cantime: %d\n[E]xpiry: %d\n"
"[W]rite config file\n[C]gminer restart\n",
"[W]rite config file\n[R]estart\n",
opt_queue, opt_scantime, opt_expiry);
wlogprint("Select an option or any other key to return\n");
logwin_update();
@ -4810,7 +4807,7 @@ retry: @@ -4810,7 +4807,7 @@ retry:
fclose(fcfg);
goto retry;
} else if (!strncasecmp(&input, "c", 1)) {
} else if (!strncasecmp(&input, "r", 1)) {
wlogprint("Are you sure?\n");
input = getch();
if (!strncasecmp(&input, "y", 1))
@ -4856,7 +4853,7 @@ static void *input_thread(void __maybe_unused *userdata) @@ -4856,7 +4853,7 @@ static void *input_thread(void __maybe_unused *userdata)
return NULL;
}
#endif
#endif /* HAVE_CURSES */
static void *api_thread(void *userdata)
{
@ -7705,19 +7702,22 @@ int main(int argc, char *argv[]) @@ -7705,19 +7702,22 @@ int main(int argc, char *argv[])
sigemptyset(&handler.sa_mask);
sigaction(SIGTERM, &handler, &termhandler);
sigaction(SIGINT, &handler, &inthandler);
#endif
/* opt_kernel_path defaults to SGMINER_PREFIX */
opt_kernel_path = (char *)alloca(PATH_MAX);
strcpy(opt_kernel_path, SGMINER_PREFIX);
/* sgminer_path is current dir */
sgminer_path = (char *)alloca(PATH_MAX);
#ifndef _MSC_VER
s = strdup(argv[0]);
strcpy(sgminer_path, dirname(s));
free(s);
strcat(sgminer_path, "/");
#else
opt_kernel_path = (char*)alloca(PATH_MAX);
strcpy(opt_kernel_path, SGMINER_PREFIX);
sgminer_path = (char*)alloca(PATH_MAX);
GetCurrentDirectory(PATH_MAX - 1, sgminer_path);
strcat(sgminer_path, "\\");
#endif
devcursor = 8;
@ -7738,7 +7738,7 @@ int main(int argc, char *argv[]) @@ -7738,7 +7738,7 @@ int main(int argc, char *argv[])
for (i = 0; i < MAX_GPUDEVICES; i++)
gpus[i].dynamic = true;
/* parse command line */
/* parse config and command line */
opt_register_table(opt_config_table,
"Options for both config file and command line");
opt_register_table(opt_cmdline_table,
@ -7860,12 +7860,10 @@ int main(int argc, char *argv[]) @@ -7860,12 +7860,10 @@ int main(int argc, char *argv[])
#endif
}
#ifdef USE_SCRYPT // I don't really know if this is relevant for other mining platforms
if (!getenv("GPU_MAX_ALLOC_PERCENT"))
applog(LOG_WARNING, "WARNING: GPU_MAX_ALLOC_PERCENT is not specified!");
if (!getenv("GPU_USE_SYNC_OBJECTS"))
applog(LOG_WARNING, "WARNING: GPU_USE_SYNC_OBJECTS is not specified!");
#endif
if (!total_pools) {
applog(LOG_WARNING, "Need to specify at least one pool server.");
@ -7960,6 +7958,7 @@ int main(int argc, char *argv[]) @@ -7960,6 +7958,7 @@ int main(int argc, char *argv[])
enable_pool(pool);
break;
case POOL_HIDDEN:
i--; /* Reiterate over this index. */
remove_pool(pool);
break;
case POOL_REJECTING:
@ -8176,7 +8175,7 @@ retry: @@ -8176,7 +8175,7 @@ retry:
applog(LOG_DEBUG, "Generated getwork work");
stage_work(work);
push_curl_entry(ce, pool);
#endif
#endif /* HAVE_LIBCURL */
}
return 0;

Loading…
Cancel
Save