Secrets of Supercomputing


Published on

Brought to you by
Sustainable, Green Lunar Colonization by 2022

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Secrets of Supercomputing

  1. 1. Secrets of Supercomputing Decoding the Language of Wizards Los Alamos National Laboratory
  2. 2. Calculus and Supercomputing <ul><li>Calculus and Supercomputing are intertwined. Why? Here is an example. </li></ul><ul><li>A simple problem – Add up the volume of earth above sea-level for an island 500 ft high by half a mile wide and twenty miles long. </li></ul><ul><li>Typical science homework problem using simple algebra. Can be done by hand. Not appropriate for supercomputing. Not enough complexity. </li></ul>
  3. 3. Add Complexity <ul><li>The island profile is a jagged mountainous terrain cut by deep canyons. How do we add up the volume? </li></ul><ul><li>Calculus – language of complexity </li></ul><ul><ul><li>Addition – summing numbers </li></ul></ul><ul><ul><li>Multiplication – summing numbers with a constant magnitude </li></ul></ul><ul><ul><li>Integration – summing numbers with an irregular magnitude </li></ul></ul>
  4. 4. Divide and Conquer <ul><li>In discrete form </li></ul><ul><li>Divide the island into small pieces and sum up the volume of each piece. </li></ul><ul><li>Approaches the solution as the size of the intervals grows smaller for a jagged profile. </li></ul>
  5. 5. Divide and Conquer <ul><li>In Continuous Form – Integration </li></ul><ul><li>Think of the integral symbols as describing a shape that is continuously varying </li></ul><ul><li>The accuracy of the solution can be improved by summing over smaller increments </li></ul><ul><li>Lots of arithmetic operations – now you have a “computing” problem. Add more work and you have a “supercomputing” problem. </li></ul>
  6. 6. Calculus - Describing Change <ul><li>Derivatives describe change. </li></ul><ul><li>Problem: The pine bark beetle epidemic is sweeping the southwest. But the concentration of pine bark beetles is not constant. It varies by time and location. The variable P describes the population of pine bark beetles. </li></ul>
  7. 7. Calculus and Change <ul><li>Derivatives describe the change in a variable (numerator or top variable) relative to another variable (denominator or bottom). These three derivatives describe the change in pine bark beetle population versus time, x-direction and y-direction. </li></ul>
  8. 8. Calculus Terminology <ul><li>Two branches of Calculus </li></ul><ul><ul><li>Integral Calculus </li></ul></ul><ul><ul><li>Derivative Calculus </li></ul></ul><ul><li>P = f(x, y, t) </li></ul><ul><ul><li>Population is a function of x, y, and t </li></ul></ul><ul><li>dP/dx – derivative, instantaneous rate of change, or slope of a function </li></ul><ul><li>∂ P/∂x – partial derivative implying that P is a function of more than one variable </li></ul><ul><li>∫ f(x)dx – definite integral, area under the curve, or summation </li></ul>
  9. 9. Two Main Approaches to Divide up Problem <ul><li>Eulerian – divide up by spatial coordinates </li></ul><ul><ul><li>Track populations in a location </li></ul></ul><ul><ul><li>Observer frame of reference </li></ul></ul><ul><li>Lagrangian – divide up by objects </li></ul><ul><ul><li>Track groups of pine bark beetles </li></ul></ul><ul><ul><li>Object frame of reference </li></ul></ul><ul><ul><li>Easier to track attributes of population since they travel with the objects </li></ul></ul><ul><ul><li>Agent based modeling of Star Logo uses this </li></ul></ul><ul><ul><li>Can tangle </li></ul></ul>
  10. 10. Mixed Representation <ul><li>Exercise: Divide up the pine bark beetle problem with the pine bark beetles represented in a lagrangian framework and the tree population in a eulerian framework. </li></ul>
  11. 11. Eulerian <ul><li>Eulerian – The area stays fixed and has a Population per area. We observe the change in population across the boundaries of the area. </li></ul><ul><li>Langrangian – The number of beetles stays fixed. The beetles move with velocity vx and vy and we move with them. The size of the area will change if the four vertexes of the rectangle move at different velocities. Changes in area will result in different densities. </li></ul>
  12. 12. Exercise <ul><li>Pick topic </li></ul><ul><ul><li>Air, ants, blood, students, grass, water flow </li></ul></ul><ul><li>Decide Eulerian or Lagrangian </li></ul><ul><li>Study the behavior (what variables?) </li></ul><ul><ul><li>Eulerian – observe area or volume; what crosses boundaries? </li></ul></ul><ul><ul><li>Lagrangian – follow object; what influences it? </li></ul></ul>
  13. 13. Supercomputing <ul><li>Our Working definition of Supercomputing </li></ul><ul><ul><li>Harnessing lots of processors to do lots of small calculations </li></ul></ul><ul><ul><li>There are many other definitions </li></ul></ul><ul><li>Writing a program </li></ul><ul><ul><li>Data parallel model </li></ul></ul><ul><ul><ul><li>Distributed data split across processors </li></ul></ul></ul><ul><ul><ul><li>All other data replicated across processors </li></ul></ul></ul>
  14. 14. Data Parallel Model Serial operations are done on every processor so that replicated data is the same on every processor. This may seem like a waste of work, but it is easier than synchronizing data values. Sections of distributed data are “owned” by each processor. This is where the parallel speedups occur. Often ghost cells around each processor’s data is a way to handle communication. P(400) – distributed Ptot -- replicated Proc 1 P(1-100) Ptot Proc 2 P(101-200) Ptot Proc 3 P(201–300) Ptot Proc 4 P(301-400) Ptot
  15. 15. Message Passing Interface (MPI) <ul><li>A software library to communicate across processors </li></ul><ul><li>Defacto standard for parallel processing </li></ul><ul><ul><li>MPICH from Argonne National Lab is the most common MPI package </li></ul></ul><ul><ul><li>OpenMPI is an open source consortium including Los Alamos National Laboratory and is the best supported MPI in Eclipse </li></ul></ul><ul><ul><li>LAM is a common MPI package in Linux distros. </li></ul></ul>
  16. 16. MPI Program <ul><li>Example Program is called Beetlemania </li></ul><ul><ul><li>Models a pine bark beetle infestation. </li></ul></ul><ul><ul><li>Initial population placed at center of mesh. </li></ul></ul><ul><ul><li>New population is the sum of the population in the current cell and the surrounding eight cells divided by nine (called a stencil operation). </li></ul></ul><ul><ul><li>Trees are placed in a linearly increasing profile from the top of the screen to the bottom. </li></ul></ul><ul><ul><li>Random number is initially applied to tree distribution to make it less smooth. </li></ul></ul><ul><ul><li>Population is multiplied by the tree density each time step. Trees are reduced by a function of beetle population. </li></ul></ul>
  17. 17. Tools <ul><li>MPE -- graphics calls that comes with MPICH. Graphics calls are done in parallel from each processor! Most linux distros have an MPICH package. </li></ul><ul><li>Eclipse -- Programmers Workbench. This is an open source project and Los Alamos National Lab (LANL) is contributing an Parallel Tools module including MPI and Fortran. Download tools from </li></ul>
  18. 18. Setting up Eclipse <ul><li>Download from (may need to go to Calisteo download to find platform module) </li></ul><ul><ul><li>eclipse-SDK-3.2.1-linux-gtk.tar </li></ul></ul><ul><ul><li>eclipse-platform-3.2.1-linux-gtk.tar </li></ul></ul><ul><ul><li>org.eclipse.cdt-3.1.1-linux.x86.tar </li></ul></ul><ul><ul><li>org.eclipse.ptp-1.0.0.tar </li></ul></ul><ul><ul><li>org.eclipse.ptp.mpi-1.0.tar </li></ul></ul><ul><ul><li>org.eclipse.ptp.orte-linux-x86-1.0.0.tar </li></ul></ul><ul><ul><li>org.eclipse.ptp.debug-orte-linux-x86-1.0.0.tar </li></ul></ul><ul><li>Untar using ark, tar or other Linux utility </li></ul><ul><li>You are ready to go </li></ul>
  19. 19. Setting up Project in Eclipse <ul><li>Right click on project name and select Properties at bottom of long menu. Select C/C++ Build </li></ul><ul><ul><li>Select Configuration and change to Release </li></ul></ul><ul><ul><li>Under C compiler, Directories </li></ul></ul><ul><ul><ul><li>Set include path to /usr/lib/mpich/include </li></ul></ul></ul><ul><ul><li>Under C linker, Libraries </li></ul></ul><ul><ul><ul><li>Set libraries directories to /usr/lib/mpich/lib </li></ul></ul></ul><ul><ul><ul><li>Set libraries to </li></ul></ul></ul><ul><ul><ul><ul><li>mpe </li></ul></ul></ul></ul><ul><ul><ul><ul><li>mpich </li></ul></ul></ul></ul><ul><ul><ul><ul><li>X11 </li></ul></ul></ul></ul><ul><ul><ul><ul><li>pthread </li></ul></ul></ul></ul><ul><ul><ul><ul><li>rt </li></ul></ul></ul></ul><ul><ul><ul><ul><li>m </li></ul></ul></ul></ul>
  20. 20. Eclipse (cont) <ul><li>MPI run is still buggy so set up a C executable run project. This will only run one processor. </li></ul><ul><ul><li>Select run on top menus, and run from pulldown menu </li></ul></ul><ul><ul><ul><li>Name: Beetlemania </li></ul></ul></ul><ul><ul><ul><li>Project: Beetlemania </li></ul></ul></ul><ul><ul><ul><li>C/C++ Application: Release/Beetlemania </li></ul></ul></ul><ul><ul><li>Click on Apply and then Run </li></ul></ul><ul><ul><li>Prompts appear in bottom screen. Enter </li></ul></ul><ul><ul><ul><li>X size: 400, Y size 400, and Iterations: 1000 </li></ul></ul></ul><ul><li>To run multiple processors, go to project directory (workspace/Beetlemania) and type </li></ul><ul><ul><li>“ mpirun –np 4 Release/Beetlemania” </li></ul></ul>
  21. 21. Programming Language <ul><li>Beetlemania is written in C, a functional language, and is in a single routine. </li></ul><ul><li>Could be converted to C++. Java is trickier because the MPI interface (C) is difficult to handle from Java. C++ and Java support is well-supported in Eclipse. </li></ul>
  22. 22. Exercise <ul><li>Try modifying the sample program </li></ul><ul><ul><li>Change initial tree distribution </li></ul></ul><ul><ul><li>Change stencil operator to weigh neighbors differently </li></ul></ul><ul><ul><li>Add another variable such as wind, rain </li></ul></ul><ul><li>Comparing to data is critical </li></ul><ul><ul><li>A narrow strip without trees would block spread – population should be dependent on a wider region. </li></ul></ul><ul><ul><li>Are there other unrealistic behaviors of the model? </li></ul></ul><ul><ul><li>Design an experiment to isolate variable effects. This can greatly improve your model. </li></ul></ul>