Suggestion to stop long operations
Pierre Chatelier
pierre at chachatelier.fr
Fri Nov 18 22:19:19 UTC 2016
Hello,
While playing with mpz_probab_prime_p(), I noticed that comptation times could be very long for serious numbers (like 6917!-1, which is a "small" prime in some sense, regarding https://primes.utm.edu/largest.html)
I think it could be valuable to be able to stop such computations if it takes too long.
By just adding a volatile member to the mpz_t struct, it could be possible to signal a stop request from another thread. That field could be inspected and taken in account by the expensive algorithms, in some loop iterations.
This approach would not break existing code and API, and would only require the expensive functions to monitor that field. Other functions could just ignore it.
What do you think ? would it be a problem to change the size of mpz_t ?
Regards
Pierre Chatelier
More information about the gmp-discuss
mailing list