Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The goal for this lab is to investigate some methods to profile Python code. We will profile code for matrix/matrix multiplication that is given to

The goal for this lab is to investigate some methods to profile Python code. We will profile code for matrix/matrix multiplication that is given to you; you can find the file below . Part 1: Runtime measurements with timing measurements Open the file MatrixMatrixMultiplication.py. It is a functioning script that multiplies two square matrices of the same size after the user enters the size of the matrices Add the appropriate documentation at the top of the file Add commands to measure the elapsed time at the indicated locations in the file, as well as statements to print the results as indicated Run the code for multiple matrix sizes (a good starting range to think about is 10 to 500, but this will vary for different computers) and observe what happens with the time needed for the computation, per element. Add a short description (100 to 150 words) to your code file (at the top, in the documentation section) indicating what happens with the runtimes for Part 1 Part 2: Runtime measurements with addition of profiler Add the following: @profile right above the function definition. This will start profiling the code Repeat the steps above, for the lower half of the range you used for Part 1 and observe what happens with the time needed for the computation, per element. You will also see some output from the profiler that shows the memory requirements of your code. Why do you think the runtimes behave like that now that you have enabled profiling? Add a short description to your code file (at the top, in the documentation section) indicating what happens with the runtimes for Part 1. Why do you think the runtimes are now different? (100 to 150 words)

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

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions