Understand the Java Parallel Image StreamGang Structure ...
Transcript of Understand the Java Parallel Image StreamGang Structure ...
![Page 1: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/1.jpg)
Understand the Java Parallel Image
StreamGang Structure & Functionality
Douglas C. [email protected]
www.dre.vanderbilt.edu/~schmidt
Professor of Computer Science
Institute for Software
Integrated Systems
Vanderbilt University
Nashville, Tennessee, USA
![Page 2: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/2.jpg)
2
Learning Objectives in this Part of the Lesson• Understand the structure & functionality of the ImageStreamGang app
• It applies several Java parallelism frameworks
• Focus is on integrating object-oriented & functional programming paradigms
This design shows the synergy between object-oriented & functional programming
![Page 3: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/3.jpg)
3Patterns are used to emphasize key roles & responsibilities in the app’s design
Learning Objectives in this Part of the Lesson• Understand the structure & functionality of the ImageStreamGang app
• It applies several Java parallelism frameworks
• Focus is on integrating object-oriented & functional programming paradigms
![Page 4: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/4.jpg)
4
The Structure of the ImageStreamGang App
![Page 5: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/5.jpg)
5
The Structure of the ImageStreamGang App• UML class diagram for the object-oriented ImageStreamGang app design
See en.wikipedia.org/wiki/Unified_Modeling_Language
![Page 6: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/6.jpg)
6
• UML class diagram for the object-oriented ImageStreamGang app design
These classes apply Java features to image downloading & processing
The Structure of the ImageStreamGang App
![Page 7: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/7.jpg)
7
• UML class diagram for the object-oriented ImageStreamGang app design
A framework for initiating streams that process input from a list of elements
The Structure of the ImageStreamGang App
![Page 8: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/8.jpg)
8Customizes the StreamGang framework to download & process images …
• UML class diagram for the object-oriented ImageStreamGang app design
The Structure of the ImageStreamGang App
![Page 9: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/9.jpg)
9
• UML class diagram for the object-oriented ImageStreamGang app design
… based on different Java concurrency & parallelism frameworks
The Structure of the ImageStreamGang App
![Page 10: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/10.jpg)
10
• UML class diagram for the object-oriented ImageStreamGang app design
Uses Java streams to download & filter images sequentially
The Structure of the ImageStreamGang App
![Page 11: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/11.jpg)
11
• UML class diagram for the object-oriented ImageStreamGang app design
Uses Java parallel streams to download & filter images concurrently
The Structure of the ImageStreamGang App
![Page 12: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/12.jpg)
12
• UML class diagram for the object-oriented ImageStreamGang app design
Uses Java CompletableFutures to download & filter images asynchronously
The Structure of the ImageStreamGang App
![Page 13: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/13.jpg)
13Stores image meta-data & provides methods for common image-/file-related tasks
• UML class diagram for the object-oriented ImageStreamGang app design
The Structure of the ImageStreamGang App
![Page 14: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/14.jpg)
14This class hierarchy applies operations to filter & store images
• UML class diagram for the object-oriented ImageStreamGang app design
The Structure of the ImageStreamGang App
![Page 15: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/15.jpg)
15
• UML class diagram for the object-oriented ImageStreamGang app design
Provides the user interface for an Android app
The Structure of the ImageStreamGang App
![Page 16: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/16.jpg)
16
• UML class diagram for the object-oriented ImageStreamGang app design
There’s a Java console version of ImageStreamGang that shares most of the code
The Structure of the ImageStreamGang App
![Page 17: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/17.jpg)
17
Running the Image StreamGang App
![Page 18: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/18.jpg)
18
Starting ImageStreamGangTestPrinting 4 results for input file 1 from fastest to slowestCOMPLETABLE_FUTURES_1 executed in 312 msecsCOMPLETABLE_FUTURES_2 executed in 335 msecsPARALLEL_STREAM executed in 428 msecsSEQUENTIAL_STREAM executed in 981 msecs
Printing 4 results for input file 2 from fastest to slowestCOMPLETABLE_FUTURES_2 executed in 82 msecsCOMPLETABLE_FUTURES_1 executed in 83 msecsPARALLEL_STREAM executed in 102 msecsSEQUENTIAL_STREAM executed in 251 msecsEnding ImageStreamGangTest
Running the ImageStreamGang App
ImageStreamGang
Tests conducted on a 2.6 GHz six-core Lenovo P52 with 64 Gbytes of RAM
![Page 19: Understand the Java Parallel Image StreamGang Structure ...](https://reader033.fdocuments.net/reader033/viewer/2022051517/627ee84fbebba42c4344baad/html5/thumbnails/19.jpg)
19
End of Understand the Java Parallel ImageStreamGangStructure & Functionality