Factoring N
with MPI and GMP - The Steps
- Check that 2 is not a factor of N .
- Create a "shared memory" buffer of one integer, initialized to
-1.
- Split the odd numbers between 3 and
N1/2 into Chunks, sending each to a separate
Task. Each Task tries to find a factor of N. Checking that
the contents of the shared buffer is still -1.
- The Task that finds a factor sets the value of the
shared buffer to its rank.
- The Tasks with ranks other than 0 and
rank terminate.
- Task rank sends the factor to Task
0 and terminates.
- Task 0 outputs the factor and
elapsed time and terminates.