Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

Write a C console program of the matrix multiplication algorithm ([A]x[B] [C] ) for double precision data types. Instrument and monitor and measure execution time for the computation. 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 CPU clock speed using DEFINE statements. Use a random number generator to fill the random data into the matrices a) Compiler optimizations should be configured for full optimization (-03 in gcc or /Ox in MS vs). Comment your code to explain what it is doing. As in programming exercise 1 and 2, make your code portable. Using malloc is the preferred, and recommended method. b) You should use the time.h header file library, and either the "time() or clock() timing functions to capture the start and end execution times for your benchmark. You will need two nested loops to perform the matrix multiplication, and in addition, as in PE2, you will need to use a 3rd, outer accuracy improvement loop. Adjust the total number of iterations of your inner and outer accuracy improvement loops so that total execution time is approximately constant as you vary the dimensions of your A, B and C matrices change from 4x4 to 2048x2048

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

More Books

Students also viewed these Databases questions