1 / 9

Transitioning from Algorithms to Software

Transitioning from Algorithms to Software. Thomas Kue Southern Arkansas University Dr. Ernst Leiss University of Houston REU Summer 2011. Outline. VMM and the Memory Hierarchy Problem Example: Adding Matrices A Basic Algorithm Transitioning Into Software Problems in the Transition

faolan
Download Presentation

Transitioning from Algorithms to Software

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Transitioning from Algorithms to Software Thomas Kue Southern Arkansas University Dr. Ernst Leiss University of Houston REU Summer 2011

  2. Outline • VMM and the Memory Hierarchy Problem • Example: Adding Matrices • A Basic Algorithm • Transitioning Into Software • Problems in the Transition • Adding Matrices: Summary • Conclusion

  3. VMM and the Memory Hierarchy Problem • Scientific computing often requires massive data sets • Virtual Memory Manager – divides program into ‘pages’ • Out of core program – program in which there is transfer of data between memory and hard disk • The goal: reduce frequency of data transfer to and from hard disk

  4. Example: Adding Matrices • We have two matrices, A and B, of size n2 • n is large such that matrix cannot fit within main memory • VMM is invoked and paging occurs A Basic Algorithm for i := 1 to n do for j := 1 to n do C[i,j] = A[i,j] + B[i,j]

  5. Transitioning Into Software • Because memory is linear, these 2-dimensional matrices must be mapped into the 1-dimensional memory • Row Major Mapping • Column Major Mapping A11 A12 … A1n A21 A22 … A2n . . … . . . … . . . … . . . … . An1 An2 … Ann Memory A11 A12 … A1n … Memory A11 A21 … An1 …

  6. Problems Transitioning Into Software • Assume column major mapping • Assume one column = one page • Assume memory can hold three pages (1 from each matrix) Our basic algorithm: for i := 1 to n do for j := 1 to n do C[i,j] = A[i,j] + B[i,j] A11 A12 … A1n A21 A22 … A2n . . … . . . … . . . … . . . … . An1 An2 … Ann Memory A11 A21 … An1 A12 A22 … An2 • Total # of page swaps: 3n2

  7. Problems Transitioning into Software • The interaction between the algorithm and the VMM plays an important role in software performance Modifying the algorithm: for j := 1 to n do for i := 1 to n do C[i,j] = A[i,j] + B[i,j] A11 A12 … A1n A21 A22 … A2n . . … . . . … . . . … . . . … . An1 An2 … Ann Memory A11 A21 … An1 • Total # of page swaps: 3n

  8. Adding Matrices: Summary • Using the first algorithm produces bad software of I/O complexity 3n2 • Using the second algorithm produces a good software that is n times faster than the first • Achieving the goal: • Restructuring the program to reduce disk I/O • Our basic algorithm: • for i := 1 to n do • for j := 1 to n do • C[i,j] = A[i,j] + B[i,j] Modifying the algorithm: for j := 1 to n do for i := 1 to n do C[i,j] = A[i,j] + B[i,j]

  9. Conclusion • With programs requiring larger data sets, reducing access to the hard disk becomes crucial • Thus, good algorithms don’t always translate into good software • Manipulating the program in accordance with the VMM to reduce hard disk access will dramatically improve performance • Ultimately this attains good software from good algorithms

More Related