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

Send and Sync for the core structures #58

Open
poszu opened this issue Jun 13, 2023 · 0 comments
Open

Send and Sync for the core structures #58

poszu opened this issue Jun 13, 2023 · 0 comments

Comments

@poszu
Copy link
Contributor

poszu commented Jun 13, 2023

Currently, neither RandomXCache, RandomXDataset nor RandomXVM implement Send and Sync.

I think cache and dataset could implement both Send and Sync. For example, these structures are shared by VMs working in different threads in RandomX benchmarks: https://github.com/tevador/RandomX/blob/040f4500a6e79d54d84a668013a94507045e786f/src/tests/benchmark.cpp#L340-L365. It is essential to reuse cache and dataset to achieve high hashing rate using multiple threads.

I'm not 100% sure, but I think RandomXVM could also implement the Send trait. There doesn't seem anything that would make dropping a VM in a different thread unsound. It would allow putting it in a ThreadLocal to avoid recreating VMs every time a proof of work needs to be calculated. It would be useful for scenarios where many pows need to be verified in a short time.

Note: these traits are implemented by the archived moneromint/randomx4r:

What do you think?

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

No branches or pull requests

1 participant