What I want to do is this:
- Feed n, the number to factor, into parafac(), the parallel factoring function
- That function executes pollardRho(n), ecm(n), and mpqs(n) in parallel and waits for one of them to return a factor. Let's say that mpqs finishes first and returns f.
- parafac kills pollardRho and ecm and returns f.
Code: Select all
# Run pollardRho(n), ecm(n), and mpqs(n) in parallel.
# Return the return value of the first function to finish; kill the other processes.
raise NotImplementedError # TODO
What I'm getting hung up on is how to do that parallelization. Multithreading? Multiprocessing? Concurrent.futures? How do I obtain the return values, which these parallelizing libraries appear to discard?
If it helps, here's my sysinfo:
- Linux Mint 16
- Python 2.7
- Processor: Intel Core i7 X990 — 12 cores, and I'm not afraid to use 'em
- 24 GB RAM, and I'm not afraid to use it either.