aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/main.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-10-16 21:25:33 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-10-16 21:25:33 +0800
commitd5327ddc5fdc2a8b967699ea06ef5b5503657123 (patch)
tree9872db19a62cb21fc68e7c3e27a8bf8b9fcc63bd /cmd/geth/main.go
parentb74775400906cc582bdbb98bf5067c5258ee491f (diff)
parentec6a548ee3555813d83f86f82bd25694bfd9c303 (diff)
downloaddexon-d5327ddc5fdc2a8b967699ea06ef5b5503657123.tar
dexon-d5327ddc5fdc2a8b967699ea06ef5b5503657123.tar.gz
dexon-d5327ddc5fdc2a8b967699ea06ef5b5503657123.tar.bz2
dexon-d5327ddc5fdc2a8b967699ea06ef5b5503657123.tar.lz
dexon-d5327ddc5fdc2a8b967699ea06ef5b5503657123.tar.xz
dexon-d5327ddc5fdc2a8b967699ea06ef5b5503657123.tar.zst
dexon-d5327ddc5fdc2a8b967699ea06ef5b5503657123.zip
Merge pull request #1869 from Gustav-Simonsson/gpu_miner
all: Add GPU mining, disabled by default
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r--cmd/geth/main.go45
1 files changed, 44 insertions, 1 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 1eb078201..3422d9500 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -107,6 +107,22 @@ Regular users do not need to execute it.
`,
},
{
+ Action: gpuinfo,
+ Name: "gpuinfo",
+ Usage: "gpuinfo",
+ Description: `
+Prints OpenCL device info for all found GPUs.
+`,
+ },
+ {
+ Action: gpubench,
+ Name: "gpubench",
+ Usage: "benchmark GPU",
+ Description: `
+Runs quick benchmark on first GPU found.
+`,
+ },
+ {
Action: version,
Name: "version",
Usage: "print ethereum version numbers",
@@ -298,6 +314,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.GasPriceFlag,
utils.MinerThreadsFlag,
utils.MiningEnabledFlag,
+ utils.MiningGPUFlag,
utils.AutoDAGFlag,
utils.NATFlag,
utils.NatspecEnabledFlag,
@@ -586,7 +603,10 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
}
}
if ctx.GlobalBool(utils.MiningEnabledFlag.Name) {
- if err := eth.StartMining(ctx.GlobalInt(utils.MinerThreadsFlag.Name)); err != nil {
+ err := eth.StartMining(
+ ctx.GlobalInt(utils.MinerThreadsFlag.Name),
+ ctx.GlobalString(utils.MiningGPUFlag.Name))
+ if err != nil {
utils.Fatalf("%v", err)
}
}
@@ -740,6 +760,29 @@ func makedag(ctx *cli.Context) {
}
}
+func gpuinfo(ctx *cli.Context) {
+ eth.PrintOpenCLDevices()
+}
+
+func gpubench(ctx *cli.Context) {
+ args := ctx.Args()
+ wrongArgs := func() {
+ utils.Fatalf(`Usage: geth gpubench <gpu number>`)
+ }
+ switch {
+ case len(args) == 1:
+ n, err := strconv.ParseUint(args[0], 0, 64)
+ if err != nil {
+ wrongArgs()
+ }
+ eth.GPUBench(n)
+ case len(args) == 0:
+ eth.GPUBench(0)
+ default:
+ wrongArgs()
+ }
+}
+
func version(c *cli.Context) {
fmt.Println(ClientIdentifier)
fmt.Println("Version:", Version)