Browse Source

Add the -n (--ndevs) option like cgminer

master 1.6.0-tpruvot
Tanguy Pruvot 10 years ago
parent
commit
4426700e31
  1. 10
      ccminer.cpp
  2. 12
      cuda.cpp

10
ccminer.cpp

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
/*
* Copyright 2010 Jeff Garzik
* Copyright 2012-2014 pooler
* Copyright 2014-2015 tpruvot
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@ -59,6 +60,7 @@ int cuda_num_devices(); @@ -59,6 +60,7 @@ int cuda_num_devices();
void cuda_devicenames();
void cuda_devicereset();
int cuda_finddevice(char *name);
void cuda_print_devices();
#include "nvml.h"
#ifdef USE_WRAPNVML
@ -283,6 +285,7 @@ Options:\n\ @@ -283,6 +285,7 @@ Options:\n\
-T, --timeout=N network timeout, in seconds (default: 270)\n\
-s, --scantime=N upper bound on time spent scanning current work when\n\
long polling is unavailable, in seconds (default: 10)\n\
-n, --ndevs list cuda devices\n\
-N, --statsavg number of samples used to display hashrate (default: 30)\n\
--no-gbt disable getblocktemplate support (height check in solo)\n\
--no-longpoll disable X-Long-Polling support\n\
@ -320,7 +323,7 @@ static char const short_options[] = @@ -320,7 +323,7 @@ static char const short_options[] =
#ifdef HAVE_SYSLOG_H
"S"
#endif
"a:c:i:Dhp:Px:qr:R:s:t:T:o:u:O:Vd:f:mv:N:b:";
"a:c:i:Dhp:Px:mnqr:R:s:t:T:o:u:O:Vd:f:v:N:b:";
static struct option const options[] = {
{ "algo", 1, NULL, 'a' },
@ -338,6 +341,7 @@ static struct option const options[] = { @@ -338,6 +341,7 @@ static struct option const options[] = {
{ "debug", 0, NULL, 'D' },
{ "help", 0, NULL, 'h' },
{ "intensity", 1, NULL, 'i' },
{ "ndevs", 0, NULL, 'n' },
{ "no-color", 0, NULL, 1002 },
{ "no-gbt", 0, NULL, 1011 },
{ "no-longpoll", 0, NULL, 1003 },
@ -2028,6 +2032,10 @@ void parse_arg(int key, char *arg) @@ -2028,6 +2032,10 @@ void parse_arg(int key, char *arg)
opt_statsavg = INT_MAX;
opt_statsavg = v;
break;
case 'n': /* --ndevs */
cuda_print_devices();
proper_exit(0);
break;
case 'q':
opt_quiet = true;
break;

12
cuda.cpp

@ -70,6 +70,18 @@ void cuda_devicenames() @@ -70,6 +70,18 @@ void cuda_devicenames()
}
}
void cuda_print_devices()
{
int ngpus = cuda_num_devices();
for (int n=0; n < ngpus; n++) {
int m = device_map[n];
cudaDeviceProp props;
cudaGetDeviceProperties(&props, m);
if (!opt_n_threads || n < opt_n_threads)
fprintf(stderr, "GPU #%d: SM %d.%d %s\n", m, props.major, props.minor, props.name);
}
}
// Can't be called directly in cpu-miner.c
void cuda_devicereset()
{

Loading…
Cancel
Save