0% found this document useful (0 votes)
27 views2 pages

HPC - Assignment 1

Uploaded by

omargamalelziky
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)
27 views2 pages

HPC - Assignment 1

Uploaded by

omargamalelziky
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

Assignment 1: Parallel Matrix Addition Using OpenMP

Objective

The objective of this assignment is to implement a parallel program for matrix addition
using OpenMP. This exercise will enhance your understanding of parallel computing
and the use of OpenMP for performance optimization.

Instructions

1. Setup: Ensure you have a C/C++ compiler with OpenMP support (e.g., GCC).

2. Task:

o Write a program that adds two N×N matrices and stores the result in a
third matrix. The size N should be defined by the user.

3. Requirements:

o Initialize two matrices, A and B, with random integers.

o Implement a function to add the matrices and store the result in a third
matrix C.

o Use OpenMP to parallelize the matrix addition operation.

Steps to Complete the Assignment

1. Matrix Initialization:

o Create two N×N matrices, A and B.

o Fill matrices A and B with random integers.

2. Matrix Addition:

o Write a function to perform the addition of matrices A and B, storing the


result in matrix C.

3. Parallelize the Addition:

o Use OpenMP directives to parallelize the loop responsible for matrix


addition.

4. Output:
o Print the resulting matrix C (optional: print only a portion for large
matrices).

o Experiment with different matrix sizes by modifying N to observe


performance improvements.

o Modify the code to utilize various OpenMP constructs

Submission Requirements

• Submit your source code with appropriate comments explaining your


implementation.

• Include a short report (1-2 pages) discussing:

o Your approach to parallelization.

o Any challenges you faced during implementation.

o Performance comparison between the sequential and parallel version


with different N values, (use omp_get_wtime() to measure execution
time).

Deadline

• [Saturday, November 2 ]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy