gpu

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 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)
	StopResultErrorNoComputeOptions = StopResult(C.SPACEMESH_API_ERROR_NO_COMPUTE_OPTIONS)
	StopResultErrorInvalidParameter = StopResult(C.SPACEMESH_API_ERROR_INVALID_PARAMETER)
	StopResultErrorInvalidProvider  = StopResult(C.SPACEMESH_API_ERROR_INVALID_PROVIDER_ID)
)

Variables

This section is empty.

Functions

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

type OptionFunc func(*option) error

func WithBitsPerLabel

func WithBitsPerLabel(bitsPerLabel uint32) OptionFunc

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

func WithCommitment

func WithCommitment(commitment []byte) OptionFunc

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

func WithComputeLeaves

func WithComputeLeaves(enabled bool) OptionFunc

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

func WithComputePow

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

func WithComputeProviderID(id uint) OptionFunc

WithComputeProviderID instructs scrypt to use the specified compute provider.

func WithSalt

func WithSalt(salt []byte) OptionFunc

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

func WithScryptParams

func WithScryptParams(n, r, p uint32) OptionFunc

func WithStartAndEndPosition

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