Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

update #1

Open
wants to merge 150 commits into
base: master
Choose a base branch
from
Open

update #1

wants to merge 150 commits into from

Conversation

guangminglion
Copy link

update

jcvernaleo and others added 30 commits April 29, 2016 13:57
Config changed to match dcrctl since that is closer to what the miner
does.  This removed some totally unneeded options and changed some
others.

gominer now uses its own directory for config rather than reusing the
dcrd one.

Add back btc/dcr copyright in config.go (since the whole file came
from there).

Add sample config file.
The Miner.Stop() function now decrements the waitgroup
each time a device is stopped so it doesn't hang
waiting on things that have already stopped.
This makes intensity a tuneable parameter.

Leave the default at the initial 2^26 value.
This is still a work in progress.

This allows gominer to connect to a stratum enabled pool using the
options:
gominer -o=stratum+tcp://pool:port -n userid -n password

GetWork style data is generated from the stratum data.

A very minimal test server (notify.go) is included to provide
fixed data to send to miners for debug purposes.  This can be extended
for additional testing later.

Pools are ignored in benchmark mode.

Misc other changes:

Add devicename to output.

Slow down hashmeter printing.

Check hash vs target using dcrd code and big.Int rather
than the code that was in gominer.

Contains work by jcv and jolan.
Minor modifications of the return format was needed to work with
gominer.

Keep old blake256 kernel as it performs better on intel hardware but
not others.

The improvement is mainly for nvidia cards.  AMD cards seem to have
little difference.  For testing with Nvidia 750 ti it went from
~440Mh/s to ~520Mh/s.
This includes improvements to the testserver and some test code with
data taken from sgminer.

Code by jcv, jolan, and cj
Stratum mining has been made operational. Intensity was a float64;
it has been changed to a uint32 and alternatively the user may elect
to instead directly set the work size, which must be a multiple of
32.
The miner previously would only take flat kernel work sizes (worksize
argument) or exponential kernel work sizes. Instead of uses explicitly
declared work sizes by default, gominer now calibrates work size
automatically on start up to target some preset amount of time in
milliseconds for kernel execution. This is also able to be tweaked
by the end user by setting the --autocalibrate=n flat manually.
Errors are now thrown if the passed pool difficulty is not a whole number.
Switch from alpha to beta while we are at it.
If a target that we cannot use (<1 for example) is set
do not attempt to do work without the target (which would panic).

Instead, reconnect to pool which gets back the pool's default target.

Closes #41.
This commit moves the stratum code to one package,the work type to
another package, and several general use functions to the util
package.

Closes #11
This prevents a panic when comparing against the non-existant
target in benchmark mode.

Also supress output related to shares in benchmark mode.

Fixes #45
While there, break up Stratum.Listen function into a few smaller
functions.  Makes it easier to follow and easier to user defer for the
sync.Unlock() calls.

Closes #33
The check for userSetWorkSize in miner.go was broken, causing the check for number if input intensities and worksizes to fail to detect a mismatch.
jholdstock and others added 30 commits September 11, 2023 11:08
The func ithOrFirstInt is declared in config.go but only used in
cudevice.go. Moving it means the nolint directive can be removed.
Remove leading caps and trailing punctuation.
Always use %v to print errors and %w to wrap errors.
This switches the method for generating compiled versions of the
CUDA-enabled Blake3 kernel from the existing GNUMakefile to use a go
generate based generator.

This is necessary to properly support Windows builds, removes the direct
need for an external dependency (make) and makes gominer follow a more
idiomatic Go method for building its releases.
This addresses some grammar nits in the README, adds a Windows
preliminaries section to provide a little bit more guidance on choosing
between OpenCL and CUDA, and reorders the Windows sections so they are
consistent with the ordering throughout.
Code is not currently building because of a missing import and a misused
channel in cudevice.go.
This adds creation of the obj/ dir, which is needed to generate the
version of the Blake3 kernel used in CUDA builds.

The Windows version no longer needs the obj/ dir, therefore that is not
necessary on that platform.
This commit adds a conditional macro to the Blake3 CUDA kernel so that
on older CUDA Toolkit versions a shift-based rotation is used instead of
the intrinsic.

According to the CUDA Toolkit documentation[1], the __funnelshift_rc
integer intrinsic was introduced on CUDA version 10. Prior to this
commit, the CUDA kernel of gominer could not be built when using
Toolkit versions older than 10.

Note that although this makes it possible to build the kenel on older
Toolkit versions, performance is significantly degraded when compared to
the modern, intrinsic-based versions.

[1]: https://docs.nvidia.com/cuda/archive/10.0/cuda-math-api/group__CUDA__MATH__INTRINSIC__INT.html
Previously, autocalibration could cause the device to still be in use
when the main runDevice() call is issued.

This commit fixes the bug by ensuring the CUDA device is reset
before/after autocalibration as well as on the main runDevice() call.
Newer CUDA Toolkit versions can still target older GPU architectures for
kernel compilation. Therefore, the target architecture also needs to be
taken into account when determining whether to use the intrinsic or not
for the ROTR macro of the kernel.

This adds a check to only use the intrinsic for architectures greater
than compute_30.
When compiling the CUDA kernel, it is important to specify the GPU
architecture to use in order to use the best possible GPU features,
namely the intrinsic used for the ROTR macro.

Different CUDA Toolkit versions support different architecture
selectors, therefore this commit adds automatic GPU architecture
determination based on the installed Toolkit version. Versions greater
than 11.5 use the 'all' selector for architecture, which is the broadest
available. Older versions default to using the 'compute_50'
architecture, which provides support for the required features.

The automatic selection can be overridden by specifying an environment
variable GOMINER_CUDA_GPU_ARCH when generating the kernel with go
generate which allows testing different configurations.
Currently, both the first and second extra nonces are updated on new
work and iterations of the mining loop and the first extra nonce uses a
per-device byte to ensure unique work is being performed on each device.

However, proper stratum support requires using an extra nonce assigned
by the pool for the first nonce as well as respecting a provided length
for the second extra nonce.

This paves the way to be able to properly support those semantics by
reworking the nonce handling to avoid modifying the first extra nonce
during the mining loop, moving the per-device byte to the second extra
nonce, and rolling the second extra nonce during mining loop instead.
This updates the code to properly support pooled mining via stratum.

In particular:

- The extra nonce provided by the pool is now correctly set and used
- The length for the second extra nonce provided by the pool is now
  validated
- The second extra nonce length now respects the provided length
- The mining code now uses the correct offset within the serialized work
  data for the second extra nonce to ensure the pool properly
  reconstructs the header
- The provided timestamp is now updated locally as the mining process is
  underway and the final timestamp is submitted along with the share as
  expected
- The correct network parameters for the active network are now passed
  into the stratum code so the right difficulties are used
- The stratum fields that represent numbers are now consistently in
  little endian per the stratum "spec" (such that it is)
- The "second generation tx" field is now ignored because it does not
  apply to Decred

Finally, various loggging messages have been cleaned up and the job id
is no longer incorrectly expected to be numeric when logging it.
This ensure work is immediately available when solo mining by making an
initial call to getwork during the initial setup of the miner.

It entails refactoring the work preparation logic from the OnWork
handler into a separate function that is called with the result of the
initial getwork call as well as all future OnWork notifications.
This reworks the way versions are handled internally to match other
Decred software.

In particular, it reverses the semantics such that the individual semver
components (major, minor, patch, prerelease, and buildmetadata) are
parsed from a full string and exported at init time.

Also, since the version is now parsed and verified to be accurate, it
updates the pre-release parsing to properly support dots as required by
the spec.

It adds the git commit hash to the version string as buildmetadata when
no buildmetadata is otherwise specified.

This provides a few main benefits:

- Allows a single linker override to fully specify the version string
  instead of having separate ones that can only override the prerelease
  and build metadata portions
- Provides run-time checks to ensure the full version string is valid
  per the semver spec regardless of whether it was specified directly in
  the source or provided via the linker
- The exact commit used to build non-release versions will be in the
  version string by default

Finally, while here, add some comments regarding the release process to
help maintainers.
This updates the README to call out support for pool mining and adds
explicit instructions for dcrpool as well as a general pool mining
section.
This makes it possible to run gominer in benchmark mode (-B) without
having setup a dcrd instance.  This is particularly useful when
comissioning new machines or testing the software, so that users do not
have to setup an entire simnet environment or wait for a full mainnet
dcrd and dcrwallet sync.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.