pp review

11
Matrix Operations review-1 section-G Submitted by Batch-13 A.Krishna Haasini(12003088) G.Prathyusha(12003241) K.G.Maharshi Reddy(12003055) B.Varun(12003307)

Upload: sunil-chowdary

Post on 20-Dec-2015

214 views

Category:

Documents


2 download

DESCRIPTION

pp

TRANSCRIPT

Page 1: pp review

Matrix Operationsreview-1section-G

Submitted byBatch-13

A.Krishna Haasini(12003088)G.Prathyusha(12003241)

K.G.Maharshi Reddy(12003055)B.Varun(12003307)

Page 2: pp review

Abstract

The main purpose of this project is to perform matrix operations like matrix multiplication, matrix addition, matrix subtraction and transpose of a matrix in c language. This project is implemented using parallel programming languages like pthreads and OpenMP which are implemented in shared memory systems and MPI which is implemented in distributed memory or message passing model to perform calculations simultaneously. The principle in parallel programming is that large problems can often be divided into smaller ones, which are then solved concurrently ("in parallel") for high performance computing.

Page 3: pp review

Modules

• Module1:Matrix addition • Module2:Matrix subtraction • Module3:Transpose of a matrix • Module4:Matrix multiplication

Page 4: pp review

Matrix Addition

In order to perform addition of two matrices the main thing to be checked was that the size of two matrices should be same. After that condition was satisfied we will divide the task in such a way that addition of elements of two rows of these matrices are performed simultaneously depending on the number of rows which will increase the performance of computing especially with matrices of huge size

Page 5: pp review

Matrix Subtraction

In order to perform subtraction of two matrices the main thing to be checked was that the size of two matrices should be same. After that condition was satisfied we will divide the task in such a way that subtraction of elements of two rows of these matrices are performed simultaneously depending on the number of rows which will increase the performance of computing especially with matrices of huge size

Page 6: pp review

Transpose of a matrix

Transpose of a matrix is nothing but changing rows of the one matrix to the columns of the other matrix i.e elements in the row of the first matrix become the columns of the second matrix. This is implemented using parallel programming by dividing the task into simple tasks which are executed simultaneously which will increase the performance of computing especially with matrices of huge size

Page 7: pp review

Matrix multiplication

In order to perform matrix multiplication the main thing to checked was the no.of rows of first matrix must be equal to no.of columns of second matrix. After this condition is satisfied we will divide the task in such a way based on the number of computations to be performed(which is dependant on the size of two input matrices). Dividing the task will increase the performance of computing especially with matrices of huge size.

Page 8: pp review

OpenMP ,MPI and pthreads

OpenMP and MPI are complementary. OpenMP is used to optimize performance of a program running on a single machine with multiple CPUs, i.e an SMP. MPI uses a message passing mechanism to divide a big problem into smaller problems. Each small problem runs on a separate machine, in parallel with the other. It then uses aMapReduce paradigm to collect the result and solve the big problem. The advantages of the MapReduce paradigm will be explained separately in another post.

Page 9: pp review

To combine them to solve a big problem, first use MPI to divide the problem into parts which can be solved on a single machine. Now to solve this single-machine problem optimally, use OpenMP to efficiently allocate the work among the multiple CPUs on that machine. This will result in a multithreaded program.

Page 10: pp review

Why should we use OpenMP over pthreads? Both of them use threads to divide the work, right? Well, OpenMP enables you to specify a program at a higher abstraction than pthreads. You need not explicitly write the synchronization part of the code which is the trickiest part in multi-threaded computing.

Page 11: pp review

All three, OpenMP, MPI, and pthreads are portable while internally taking advantage of the underlying OS and hardware architecture.Of course, there are cons here. MPI is extremely difficult to learn and code and involves many low level implementation details. You may not be able to entirely substitute pthreads with MPI. MPI parallelizes only loops; any producer-consumer kind of situation has to be explicitly dealt with using pthreads.