0% found this document useful (0 votes)
5 views

Assignment_2-Multiprocessing

The assignment focuses on evaluating speedup from multiprocessing in Python using either a Jupyter notebook or a Python script. Students will connect a prime-checking function to a multiprocessing Pool and assess the speedup achieved with multiple CPU cores, along with an alternative task or performance assessment using a VM. Deliverables include runnable code and a PDF report summarizing the results, with individual submissions required from each group member.

Uploaded by

1457981717
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Assignment_2-Multiprocessing

The assignment focuses on evaluating speedup from multiprocessing in Python using either a Jupyter notebook or a Python script. Students will connect a prime-checking function to a multiprocessing Pool and assess the speedup achieved with multiple CPU cores, along with an alternative task or performance assessment using a VM. Deliverables include runnable code and a PDF report summarizing the results, with individual submissions required from each group member.

Uploaded by

1457981717
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COMP30660 - Computer Arch & Org (Conv) -2024/25

Assignment 2: Multiprocessing
[15 Points]
Objective
The objective of this exercise is to evaluate speedup derived using multiple CPU cores through
the multiprocessing facility in Python.
Submission: This project can be done individually or in groups of two.

What is provided?

Two options are available on the Brightspace page that provide a basic multiprocessing
framework. Each option will be described in more details below.

• Option 1: Jupyter notebook file (MultiprocessingCore.ipynb)


• Option 2: Python script file (MultiprocessingCore.py)

You can use any option for the assignment.

Option 1: Running using notebook file:

Two helper python script files have been provided to calculate square root (sqrt_fn.py) and
check prime numbers (prime_fn.py). You have to keep these three files in the same location
when you are running the notebook.

Option 2: Running using python script:

This script contains all the required helper functions and main codes together. You can directly
run this script.

Both notebook file and python script file contain the code to set up a multiprocessing Pool and
use it to process tasks. If multiple cores are available, the Pool can use them to speed up the
processing. An example has been provided in both running options to calculate the square
root of a particular number. As this square-root function is very simple, the impact of using
multiple cores will not be significant in this case. A naive function for checking primes is also
provided (in prime_fn.py script and in main python script). Using this function to check large
numbers (8 digits) will consume significant time and the speedup achieved using multiple
cores will be evident.

There are plenty of primes to be found here: https://primes.utm.edu/lists/small/millions/

Tasks
1. Connect the check_prime function to the Pool processing function. Generate sets of
work (numbers to be checked) to be processed by the pool. Quantify the speedup
achieved with multiple cores (at least 2). What lessons can be learned from these
results? (70%)
2. Complete only one of the following.
a. Identify an alternative processing task that will also test the CPU and repeat
the assessment. What lessons can be learned from these results? (30%)
b. Repeat the exercise in 1 running on a VM through VirtualBox and assess the
impact (performance hit) of using the VM. (30%)
*Note: Generally on a Mac, the Python multiprocessing package seems to work better under Python 3.

Deliverables
Your submission should have two components:
● Your code : This can be a jupyter notebook file or a python script (make sure to attach
all the used helper files if any). The codes should be runnable.
● A PDF document (not more than 2 pages) presenting the results of your evaluations
with a font size no smaller than 10pt Arial.

Each individual should make a submission on BrightSpace. i.e. pairs should submit two
copies of the same submission where the names and student numbers of both
contributors should be stated clearly in each copy.

You might also like