To get experience parallelizing programs with OpenMP.
For this lab, you will parallelize a sequential program for finding the prime factorization of a number, 05-factor.c
This program will need to be compiled with the "-lm" option because it uses the math functions ceil and sqrt.
You should insert OpenMP directives such that the behavior of the program is the same, but performance is improved.
If the prime factors are printed in a different order, that is OK. The set of prime factors must be the same, however!
Below is an example run of the serial program:
$ ./factor 2311260 The factors are: 2 2 3 5 7 5503 $ ./factor 6569152 The factors are: 2 2 2 2 2 2 102643
Note that there are much more optimal serial algorithms for this task, but you only need to parallelize the existing solution.
After completing the parallelized version, test your program with the following parameters:
Threads | Value | Time |
1 | 2311260 | |
8 | 2311260 | |
1 | 6569152 | |
8 | 6569152 |
When your program works, email the source code and analysis to ifinlay@umw.edu.
Copyright © 2022 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.