Home CPSC 425

Lab 5: OpenMP

Objective

To get experience parallelizing programs with OpenMP.


Task

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.


Analysis

After completing the parallelized version, test your program with the following parameters:

ThreadsValueTime
12311260 
82311260 
16569152 
86569152 

Submitting

When your program works, email the source code and analysis to ifinlay@umw.edu.

Copyright © 2018 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.