Skip to content

Conversation

@DaMatrix
Copy link
Contributor

@DaMatrix DaMatrix commented Jul 4, 2024

Description

This implements the miner with support for both variants of block difficulty function on the GPU.

It also substantially refactors the miner infrastructure, using an abstract interface for multiple miner implementations for generating proof-of-work for both blocks and addresses.

Additionally, it modifies the existing miner interfaces to indicate that no valid nonce could be found, and to eventually allow cancelling an ongoing mining task once the network has already decided on a result (although there is not yet any code to make use of this functionality).

There are a total of three miner implementations:

  • A CPU implementation (which is roughly 30x faster than the existing CPU-based miner)
  • A GPU implementation leveraging OpenGL compute shaders
  • A GPU implementation leveraging Vulkan compute shaders

This requires a number of additional development libraries to be installed in order to be built. On Debian-based systems, the following command should suffice:
sudo apt install libglfw3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev

Changelog

  • List the changes to the codebase that this PR introduces

Type of Change

Please mark the appropriate option by putting an "x" inside the brackets:

  • Bug fix
  • New feature
  • Enhancement or optimization
  • Documentation update
  • Other (please specify)

Checklist

Put an "x" in the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help!

  • I have tested the changes locally and they work as expected.
  • I have added necessary documentation or updated existing documentation.
  • My code follows the project's coding standards and style guidelines.
  • I have added/updated relevant tests to ensure the changes are properly covered.
  • I have checked for and resolved any merge conflicts.
  • My commits have clear and descriptive messages.

Screenshots (if applicable)

If the changes affect the UI or have visual effects, please provide screenshots or GIFs showcasing the changes.

Additional Context (if applicable)

Add any additional context or information about the changes that may be helpful in understanding the pull request.

Related Issues (if applicable)

If this pull request is related to any existing issues, please list them here.

Requested Reviewers

@BHouwens

BHouwens and others added 30 commits June 26, 2024 10:45
much of the miner code is not specific to the OpenGL miner, it shouldn't be in opengl_miner.rs
…function_vulkan

# Conflicts:
#	src/miner_pow/mod.rs
@DaMatrix DaMatrix requested a review from a team as a code owner July 4, 2024 10:12
@BHouwens BHouwens merged commit 3c1bc9c into AIBlockOfficial:difficulty_function_gpu Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants