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

Parallel random number generation #32

Open
fjarri opened this issue Sep 11, 2023 · 0 comments
Open

Parallel random number generation #32

fjarri opened this issue Sep 11, 2023 · 0 comments
Labels
enhancement New feature or request performance Speeding things up

Comments

@fjarri
Copy link
Member

fjarri commented Sep 11, 2023

Generation of random primes can be sped up by parallelizing. On the implementation side, there are two possibilities:

  • Generate several random seeds and run searches based on them in parallel. This will mean that we will have to build the small residues table for each of them, but it is not a big overhead for "production-size" primes (>=1024 bit).
  • Start with the same random seed and a single residue table, and start parallel searches from different points within the range covered by the generated table.

A more complicated part is the API. How do we expose that in the most async-runtime-agnostic way? The parallel tasks will need to take some kind of a signal object as an argument, so that they could be terminated when one task finds a prime. The stop points could even be checked on every internal Miller-Rabin iteration (that is, in-between every modular exponentiation there).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Speeding things up
Projects
None yet
Development

No branches or pull requests

1 participant