From ac40fac0385a8ae1490ad0c85ed13f92ad9451f2 Mon Sep 17 00:00:00 2001 From: Christian Buchner Date: Mon, 19 May 2014 23:34:41 +0200 Subject: [PATCH] The ccminer console output looks a bit more like cudaMiner now. 64 bit Windows compilation should no longer take "forever" but only "annoyingly long" --- ccminer.vcxproj | 1 + cpu-miner.c | 14 ++++++++++++-- heavy/heavy.cu | 24 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/ccminer.vcxproj b/ccminer.vcxproj index 32ebd8d..ddca98a 100644 --- a/ccminer.vcxproj +++ b/ccminer.vcxproj @@ -465,6 +465,7 @@ copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -Xptxas "-abi=no -v" %(AdditionalOptions) -Xptxas "-abi=no -v" %(AdditionalOptions) 128 + 128 -Xptxas "-abi=no -v" %(AdditionalOptions) diff --git a/cpu-miner.c b/cpu-miner.c index 9c4dec7..5eb2d7d 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -55,6 +55,7 @@ extern "C" { #endif int cuda_num_devices(); +void cuda_devicenames(); int cuda_finddevice(char *name); #ifdef __cplusplus } @@ -170,6 +171,7 @@ bool opt_trust_pool = false; uint16_t opt_vote = 9999; static int num_processors; int device_map[8] = {0,1,2,3,4,5,6,7}; // CB +char *device_name[8]; // CB static char *rpc_url; static char *rpc_userpass; static char *rpc_user, *rpc_pass; @@ -780,6 +782,7 @@ static void *miner_thread(void *userdata) unsigned char *scratchbuf = NULL; char s[16]; int i; + static int rounds = 0; memset(&work, 0, sizeof(work)); // prevent work from being used uninitialized @@ -914,6 +917,9 @@ static void *miner_thread(void *userdata) goto out; } + if (opt_benchmark) + if (++rounds == 1) exit(0); + /* record scanhash elapsed time */ gettimeofday(&tv_end, NULL); timeval_subtract(&diff, &tv_end, &tv_start); @@ -926,8 +932,10 @@ static void *miner_thread(void *userdata) if (!opt_quiet) { sprintf(s, thr_hashrates[thr_id] >= 1e6 ? "%.0f" : "%.2f", 1e-3 * thr_hashrates[thr_id]); - applog(LOG_INFO, "thread %d: %lu hashes, %s khash/s", - thr_id, hashes_done, s); + applog(LOG_INFO, "GPU #%d: %s, %s khash/s", + device_map[thr_id], device_name[thr_id], s); +// applog(LOG_INFO, "thread %d: %lu hashes, %s khash/s", +// thr_id, hashes_done, s); } if (opt_benchmark && thr_id == opt_n_threads - 1) { double hashrate = 0.; @@ -1491,6 +1499,8 @@ int main(int argc, char *argv[]) /* parse command line */ parse_cmdline(argc, argv); + cuda_devicenames(); + if (!opt_benchmark && !rpc_url) { fprintf(stderr, "%s: no URL supplied\n", argv[0]); show_usage_and_exit(1); diff --git a/heavy/heavy.cu b/heavy/heavy.cu index c07d876..98728dc 100644 --- a/heavy/heavy.cu +++ b/heavy/heavy.cu @@ -164,6 +164,30 @@ extern "C" int cuda_num_devices() return GPU_N; } +// Gerätenamen holen +extern char *device_name[8]; +extern int device_map[8]; + +extern "C" void cuda_devicenames() +{ + cudaError_t err; + int GPU_N; + err = cudaGetDeviceCount(&GPU_N); + if (err != cudaSuccess) + { + applog(LOG_ERR, "Unable to query number of CUDA devices! Is an nVidia driver installed?"); + exit(1); + } + + for (int i=0; i < GPU_N; i++) + { + cudaDeviceProp props; + cudaGetDeviceProperties(&props, device_map[i]); + + device_name[i] = strdup(props.name); + } +} + static bool substringsearch(const char *haystack, const char *needle, int &match) { int hlen = strlen(haystack);