Assignment 3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ECIE4314

Operating Systems

Assignment 3
Parallel Matrix Multiplication in Rust
Important notes: This assignment is designed to assess your ability to apply modern tools in solving complex
engineering problems, focusing on PO5 (Modern Tool Usage). It encompasses WP1 (Depth of Knowledge
Required), WP2 (Range of Conflicting Requirements), WP4 (Familiarity with Issues), WP7 (Interdependence)
for complex engineering problems, and EA1 (Range of Resources) and EA5 (Familiarity) for complex
engineering activities.

Assignment Context: As an engineer, leveraging modern programming tools and techniques


is essential for efficient problem-solving. In this assignment, you will apply parallel
processing in Rust to perform matrix multiplication, a computation-intensive task.

PO5 (Modern Tool Usage): Parallel Matrix Multiplication in Rust

Parallel matrix multiplication is a pivotal operation across diverse fields, underpinning the
efficiency of large-scale computations. In computational science, it's crucial for simulating
weather patterns through extensive matrices that represent atmospheric variables, and in
computational biology for protein folding simulations, which are vital for understanding
biological mechanisms and pharmaceutical development. It also plays a significant role in
quantitative finance for market trend simulations and risk assessments. In engineering
design, matrix multiplication is integral to aerospace engineering for optimizing aircraft
structures, in civil engineering for analyzing stress and strain in bridges, and in electrical
engineering for circuit design, particularly in signal processing. Furthermore, in the realm of
machine learning, it is essential for training deep learning models in tasks like image
recognition and natural language processing, where it's heavily used in algorithms like
backpropagation, and for preprocessing large datasets through transformations for
normalization and principal component analysis.
Matrix multiplication is a fundamental operation in many scientific and engineering
computations, as explained earlier. Mathematically, the multiplication of two matrices 𝐀 and
𝐁 to produce a matrix 𝐂 is defined as follows:
1 of 4
Given:
• 𝐀 is an 𝑚 × 𝑛 matrix.
• 𝐁 is an 𝑛 × 𝑝 matrix.
The product 𝐂, an 𝑚 × 𝑝 matrix, is defined by:
𝑛

𝐶[𝑖][𝑗] = ∑ 𝐴[𝑖][𝑘] × 𝐵[𝑘][𝑗]


𝑘=1

for 𝑖 = 1,2, … , 𝑚 and 𝑗 = 1,2, … , 𝑝.


In a parallel computing context, this operation can be divided among multiple processors,
where each processor computes a part of the matrix 𝐂.

To successfully complete this assignment, carry out the following steps:

1. Step 1: System Configuration Analysis

• Identify your computer's specifications: maximum number of cores, thread


capabilities, and available RAM.

• Marking: 5%

2. Step 2: Implement Serial Matrix Multiplication

• Develop a Rust program to perform matrix multiplication. Use floating-point random


numbers for matrix elements.

• Marking: 15%

3. Step 3: Benchmark Serial Processing

• Record the processing time for varying matrix sizes (N) until a significant processing
time (over 1 second) is observed.

• Marking: 10%

4. Step 4: Implement Parallel Processing

• Modify your program to perform matrix multiplication using parallel processing. Utilize
Rust crates like Rayon or Crossbeam for ease of use and efficient parallelism.

• Justify your choice of Rust constructs and crates.

• Marking: 30%

5. Step 5: Verify Results Consistency

• Ensure consistent results across different thread counts (1, 2, 3, 4, etc.).

2 of 4
• Marking: 10%

6. Step 6: Benchmark Parallel Processing

• Record processing times with varying thread counts.

• Apply Amdahl's Law to predict the maximum achievable speedup.

• Marking: 20%

7. Step 7: Documentation and Analysis

• Document your methodology, results, and analysis.

• Discuss the impact of multithreading on the performance of matrix multiplication.

• Marking: 10%

Submission Guidelines:

• Your submission should include well-commented Rust code and a comprehensive


report.

• The report must detail your approach, findings, and insights on the impact of parallel
processing.

• Ensure clarity and thoroughness in both code and written analysis.

Evaluation Criteria:

• Correctness and efficiency of the implemented solution.

• Depth and clarity in the analysis of results.

• Quality of code, including readability and use of appropriate constructs.

• Adherence to submission guidelines and overall presentation.

REPORT: SUBMISSION DATE: Monday, 8 January 2024

COMMENCEMENT DATE: Monday, 18 December 2023

Submit a soft copy report which should be clear, comprehensive, and include the following:

• Use the cover page provided in the italeemc (late submission will result in a deduction of
the mark -25% per day).

3 of 4
• A discussion/comparative analysis showing a clear understanding of the assignment.

In addition, submit the softcopy of your report and Rust main code only to the italeemc
assignment box. Please name your file as OSA3-1901234.docx, where 1901234 is your
matric number.

Notes:

• There is no single correct solution. You need to justify the steps and the selection.

• Discussion is encouraged, but copying is discouraged and may incur a penalty (the mark
will be divided by the N copies found). Note that all the reports will be submitted to
Turnitin (the maximum allowable similarity score is 30%). Furthermore, Turnitin is now
able to detect AI-generated content.

• Full marks will be allocated towards the content demonstrating the student's
innovativeness and initiative towards the report.

*****************************

4 of 4

You might also like