bittensor.utils.registration.register_cuda#
This module provides functions for solving Proof of Work (PoW) problems using CUDA.
Functions#
|
Creates a seal hash from the block and hotkey hash and nonce. |
|
Convert a sequence of bytes in hexadecimal format to a list of |
|
Checks if the seal meets the given difficulty. |
Logs any CUDA errors. |
|
Resets the CUDA environment. |
|
|
Solves the PoW problem using CUDA. |
Module Contents#
- bittensor.utils.registration.register_cuda._create_seal_hash(block_and_hotkey_hash_hex_, nonce)#
Creates a seal hash from the block and hotkey hash and nonce.
- bittensor.utils.registration.register_cuda._hex_bytes_to_u8_list(hex_bytes)#
Convert a sequence of bytes in hexadecimal format to a list of unsigned 8-bit integers.
- bittensor.utils.registration.register_cuda._seal_meets_difficulty(seal_, difficulty, limit)#
Checks if the seal meets the given difficulty.
- bittensor.utils.registration.register_cuda.log_cuda_errors()#
Logs any CUDA errors.
- Return type:
- bittensor.utils.registration.register_cuda.reset_cuda()#
Resets the CUDA environment.
- bittensor.utils.registration.register_cuda.solve_cuda(nonce_start, update_interval, tpb, block_and_hotkey_hash_bytes, difficulty, limit, dev_id=0)#
Solves the PoW problem using CUDA.
- Parameters:
nonce_start (numpy.int64) – Starting nonce.
update_interval (numpy.int64) – Number of nonces to solve before updating block information.
tpb (int) – Threads per block.
block_and_hotkey_hash_bytes (bytes) – Keccak(Bytes of the block hash + bytes of the hotkey) 64 bytes.
difficulty (int) – Difficulty of the PoW problem.
limit (int) – Upper limit of the nonce.
dev_id (int) – The CUDA device ID. Defaults to
0
.
- Returns:
Tuple of the nonce and the seal corresponding to the solution. Returns -1 for nonce if no solution is found.
- Return type:
(Union[tuple[Any, bytes], tuple[int, bytes], tuple[Any, None]])