gpu

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComputeAPIClassUnspecified = ComputeAPIClass((C.ComputeApiClass)(C.COMPUTE_API_CLASS_UNSPECIFIED))
	ComputeAPIClassCPU         = ComputeAPIClass((C.ComputeApiClass)(C.COMPUTE_API_CLASS_CPU))
	ComputeAPIClassCuda        = ComputeAPIClass((C.ComputeApiClass)(C.COMPUTE_API_CLASS_CUDA))
	ComputeAPIClassVulkan      = ComputeAPIClass((C.ComputeApiClass)(C.COMPUTE_API_CLASS_VULKAN))

	StopResultPowFound              = StopResult(C.SPACEMESH_API_POW_SOLUTION_FOUND)
	StopResultOk                    = StopResult(C.SPACEMESH_API_ERROR_NONE)
	StopResultError                 = StopResult(C.SPACEMESH_API_ERROR)
	StopResultErrorTimeout          = StopResult(C.SPACEMESH_API_ERROR_TIMEOUT)
	StopResultErrorAlready          = StopResult(C.SPACEMESH_API_ERROR_ALREADY)
	StopResultErrorCancelled        = StopResult(C.SPACEMESH_API_ERROR_CANCELED)
	StopResultErrorNoCompoteOptions = StopResult(C.SPACEMESH_API_ERROR_NO_COMPOTE_OPTIONS)
	StopResultErrorInvalidParameter = StopResult(C.SPACEMESH_API_ERROR_INVALID_PARAMETER)
	StopResultErrorInvalidProvider  = StopResult(C.SPACEMESH_API_ERROR_INVALID_PROVIDER_ID)
)
View Source
const CPUProviderName = "CPU"

Variables

This section is empty.

Functions

func Benchmark

func Benchmark(p ComputeProvider) (int, error)

Benchmark returns the hashes per second the selected compute provider achieves on the current machine.

func CPUProviderID

func CPUProviderID() uint

CPUProviderID returns the ID of the CPU provider.

Types

type ComputeAPIClass

type ComputeAPIClass uint

func (ComputeAPIClass) String

func (c ComputeAPIClass) String() string

type ComputeProvider

type ComputeProvider struct {
	ID         uint
	Model      string
	ComputeAPI ComputeAPIClass
}

func Providers

func Providers() []ComputeProvider

Providers returns a list of available compute providers.

type OptionFunc added in v0.2.2

type OptionFunc func(*option) error

func WithBitsPerLabel added in v0.2.2

func WithBitsPerLabel(bitsPerLabel uint32) OptionFunc

WithBitsPerLabel instructs scrypt to use the specified number of bits per label.

func WithCommitment added in v0.2.2

func WithCommitment(commitment []byte) OptionFunc

WithCommitment instructs scrypt to use the specified commitment (seed) to calculate the output.

func WithComputeLeaves added in v0.2.2

func WithComputeLeaves(enabled bool) OptionFunc

WithComputeLeafs instructs scrypt to compute leafs or not. By default computing leafs is enabled.

func WithComputePow added in v0.2.2

func WithComputePow(difficulty []byte) OptionFunc

WithComputePow instructs scrypt to compute a proof of work or not. If difficulty is nil, no PoW will be computed. Otherwise it specifies the difficulty of the PoW to be computed (higher values are more difficult). By default computing proof of work is disabled.

func WithComputeProviderID added in v0.2.2

func WithComputeProviderID(id uint) OptionFunc

WithComputeProviderID instructs scrypt to use the specified compute provider.

func WithSalt added in v0.2.2

func WithSalt(salt []byte) OptionFunc

WithSalt instructs scrypt to use the specified salt to calculate the output.

func WithStartAndEndPosition added in v0.2.2

func WithStartAndEndPosition(start, end uint64) OptionFunc

WithStartAndEndPosition instructs scrypt to compute the scrypt output for the specified range of positions.

type ScryptPositionsResult

type ScryptPositionsResult struct {
	Output       []byte  // The output of the scrypt computation.
	IdxSolution  *uint64 // The index of a solution to the proof of work (if checked for).
	HashesPerSec int     // The number of hashes computed per second.
	Stopped      bool    // Whether the computation was stopped.
}

ScryptPositionsResult is the result of a ScryptPositions call.

func ScryptPositions

func ScryptPositions(opts ...OptionFunc) (*ScryptPositionsResult, error)

ScryptPositions computes the scrypt output for the given options.

type StopResult

type StopResult int

func Stop

func Stop() StopResult

func (StopResult) String

func (s StopResult) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL