Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C console program of the matrix multiplication algorithm ( [A}*[B] = [C] ) for double precision data types. Instrument and monitor and measure

Write a C console program of the matrix multiplication algorithm ( [A}*[B] = [C] ) for double precision data types. Instrument and monitor and measure execution time for the computation.

a) Your C program should be single threaded, and sequential. All matrices [A], [B], and [C] are to be square, i.e. same number of rows and columns.

Execution should be scalable and be able to handle matrix dimension N x N , from 4 x 4, 16x16, 32x32, 64x64, 128x128, 256x256, 512x512, 1024x1024 and 2048x2048. Set the matrix dimension, N, number of accuracy improvement loops, and system clock speed using DEFINE statements. Youll need to loop many more times for small array sizes, then reduce the loop iterations as you increase array size.

Hint: you should only need only 1 accuracy loops for matrices 1024x1024 and larger. Use a random number generator to fill the random data into the matrices. Recompile & execute for each vector length (and # of accuracy loops) . Compiler optimizations should be on for full optimization ( -O3 in gcc or /O2 in MS VS). The console window should execute and remain open until manually closed.

Comment your code to explain what it is doing. Make your code portable. Using malloc is the preferred way of doing this.

b) Your console program should print out ( using formatted printf commands )

1) Your name

2) Vector length ( number of vector elements)

3) The number of accuracy improvement loops you run the axpy computation to improve accuracy.

4) Total computation time

5) Computation time for the complete NxN matrix multiplication.

6) Computation time per arithmetic operation

7) The number of machine cycles per arithmetic operation

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions