From the course: Parallel and Concurrent Programming with Java 2
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Measure speedup: Java demo - Java Tutorial
From the course: Parallel and Concurrent Programming with Java 2
Measure speedup: Java demo
- [Instructor] To demonstrate how I measure the speedup of a parallel program in Java, I'll be using recursive sum algorithm that I created in an earlier video. It uses a divide-and-conquer approach to sum together all of the numbers within a range of values. The parallel implementation of that algorithm is contained within the recursive sum class on line eight, but since I already covered how it works, I'll use code folding to hide it for now. Down in the measure speedup demo class, I've written a method called sequential sum on line 38 which uses a for loop to implement a sequential version of that summing routine. I'll use it to measure the sequential execution time to provide a baseline for comparison, but, for now, I'll hide its inner workings as well. Now, the main method of this program contains a simple framework that I like to use to evaluate the performance of my parallel algorithms. On line 46, I have a variable to indicate the number of evaluation runs to measure each…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.