Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support purely single threaded execution #370

Merged
merged 5 commits into from
Aug 27, 2024
Merged

Conversation

ajsutton
Copy link
Contributor

Description

Modifies StateDB to execute all tasks on a single thread when there is a single CPU rather than spawning go routines to compute account storage roots in parallel. Also ensures the hasher only uses parallel mode when there are multiple CPUs available to accelerate the work.

This ensures compatibility with cannon where there is only a single CPU and thread creation is not supported.

@ajsutton ajsutton requested a review from a team as a code owner August 26, 2024 01:52
Copy link
Collaborator

@protolambda protolambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can you add an entry to fork.yaml, to track this change (workers.go and hasher.go in particular, statedb.go already has some description elsewhere), and a short description referencing the single-threaded program proving context?

@ajsutton
Copy link
Contributor Author

@protolambda Good call-out - updated fork.yaml.

@ajsutton ajsutton enabled auto-merge (squash) August 27, 2024 03:30
@ajsutton ajsutton merged commit bb15bcd into optimism Aug 27, 2024
9 of 10 checks passed
@ajsutton ajsutton deleted the aj/singlethreaded branch August 27, 2024 03:39
karlb pushed a commit to celo-org/op-geth that referenced this pull request Sep 10, 2024
When only a single CPU is available:
* Avoid creating threads in StateDB.IntermediateRoot
* Force single threaded hashing
karlb pushed a commit to celo-org/op-geth that referenced this pull request Sep 16, 2024
When only a single CPU is available:
* Avoid creating threads in StateDB.IntermediateRoot
* Force single threaded hashing
karlb pushed a commit to celo-org/op-geth that referenced this pull request Sep 16, 2024
When only a single CPU is available:
* Avoid creating threads in StateDB.IntermediateRoot
* Force single threaded hashing
sebastianst pushed a commit that referenced this pull request Sep 17, 2024
When only a single CPU is available:
* Avoid creating threads in StateDB.IntermediateRoot
* Force single threaded hashing
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