1 / 13

Operator Formulation of Irregular Algorithms

Operator Formulation of Irregular Algorithms. Keshav Pingali University of Texas, Austin. Irregular applications. Organized around large, pointer-based data structures such as graphs, trees, grids, etc. Artificial intelligence : Bayesian inference, SAT solvers: WalkSAT, survey propagation

Download Presentation

Operator Formulation of Irregular Algorithms

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. Operator Formulationof Irregular Algorithms Keshav Pingali University of Texas, Austin

  2. Irregular applications • Organized around large, pointer-based data structures such as graphs, trees, grids, etc. • Artificial intelligence: Bayesian inference, SAT solvers: WalkSAT, survey propagation • Computational biology: protein homology networks • Finite-element methods: mesh generation, refinement, partitioning, sparse linear solvers • Data-mining: clustering • Social networks: finding communities • Simulation: event-driven simulation, Petri-nets • N-body methods: Barnes-Hut, FMM • Galois project: • (Wirth): algorithms + data structures = programs • understand patterns of parallelism and locality in irregular algorithms • build systems for exploiting this parallelism on multicore processors

  3. High-level message • Lot of parallelism in irregular algorithms • amorphous data-parallelism (ADP) • Compile-time analysis cannot find ADP in most irregular algorithms • points-to analysis, shape analysis,…  • Optimistic parallel execution is necessary to find ADP in some irregular applications • but speculation is not needed for most irregular algorithms • There is a lot of structure in irregular algorithms • can be exploited to optimize parallel execution • regular algorithms become a special case of irregular algorithms • Dependence graphs are the wrong abstraction for irregular algorithms • data-centric abstractions are crucial • rethink algorithms: operator formulation

  4. Operator formulation of algorithms i3 • Algorithm = repeated application of operator to graph • active element: • node or edge where computation is needed • neighborhood: • set of nodes and edges read/written to perform activity • distinct usually from neighbors in graph • ordering: • order in which active elements must be executed in a sequential implementation • any order • problem-dependent order • Amorphous data-parallelism • parallel execution of activities, subject to neighborhood and ordering constraints i1 i2 i4 i5 : active node : neighborhood

  5. Delaunay Mesh Refinement Mesh m = /* read in mesh */ WorkList wl; wl.add(m.badTriangles()); while (true) { if ( wl.empty() ) break; Element e = wl.get(); if (e no longer in mesh) continue; Cavity c = new Cavity(e);//determine new cavity c.expand(); c.retriangulate();//re-triangulate region m.update(c);//update mesh wl.add(c.badTriangles()); } • Iterative refinement to remove badly shaped triangles: while there are bad triangles do { Pick a bad triangle; Find its cavity; Retriangulate cavity; // may create new bad triangles } • Don’t-care non-determinism: • final mesh depends on order in which bad triangles are processed • applications do not care which mesh is produced • Data structure: • graph in which nodes represent triangles and edges represent triangle adjacencies • Parallelism: • bad triangles with cavities that do not overlap can be processed in parallel • parallelism is dependent on runtime values • compilers cannot find this parallelism • (Miller et al) at runtime, repeatedly build interference graph and find maximal independent sets for parallel execution

  6. Event-driven simulation • Stations communicate by sending messages with time-stamps on FIFO channels • Stations have internal state that is updated when a message is processed • Messages must be processed in time-order at each station • Data structure: • Messages in event-queue, sorted in time-order • Parallelism: • activities created in future may interfere with current activities • Jefferson time-warp • station can fire when it has an incoming message on any edge • requires roll-back if speculative conflict is detected • Chandy-Misra-Bryant • conservative event-driven simulation • requires null messages to avoid deadlock 2 A 3 4 6 B C 5

  7. Galois programming model (PLDI 2007) • Joe programmers • sequential, OO model • Galois set iterators: for iterating over unordered and ordered sets of active elements • for each e in Set S do B(e) • evaluate B(e) for each element in set S • no a priori order on iterations • set S may get new elements during execution • for each e in OrderedSet S do B(e) • evaluate B(e) for each element in set S • perform iterations in order specified by OrderedSet • set S may get new elements during execution • Stephanie programmers • Galois concurrent data structure library • (Wirth) Algorithms + Data structures = Programs Mesh m = /* read in mesh */ Set ws; ws.add(m.badTriangles()); // initialize ws for each tr in Set ws do { //unordered Set iterator if (tr no longer in mesh) continue; Cavity c = new Cavity(tr); c.expand(); c.retriangulate(); m.update(c); ws.add(c.badTriangles()); //bad triangles } DMR using Galois iterators

  8. Galois parallel execution model • Parallel execution model: • shared-memory • optimistic execution of Galois iterators • Implementation: • master thread begins execution of program • when it encounters iterator, worker threads help by executing iterations concurrently • barrier synchronization at end of iterator • Independence of neighborhoods: • software TLS/TM variety • logical locks on nodes and edges • Ordering constraints for ordered set iterator: • execute iterations out of order but commit in order • cf. out-of-order CPUs Master main() …. for each …..{ ……. ……. } ..... i3 i1 i2 i4 i5 Concurrent Data structure Joe Program

  9. ParaMeter Parallelism Profiles: DMR • Input mesh: • Produced by Triangle (Shewchuck) • 550K triangles • Roughly half are badly shaped • Available parallelism: • How many non-conflicting triangles can be expanded at each time step? • Parallelism intensity: • What fraction of the total number of bad triangles can be expanded at each step?

  10. Structural analysis of irregular algorithms general graph topology grid tree refinement coarsening morph general topology-driven data-driven irregular algorithms local computation operator reader unordered ordering ordered Jacobi: topology: grid, operator: local computation, ordering: unordered DMR, graph reduction: topology: graph, operator: morph, ordering: unordered Event-driven simulation: topology: graph, operator: local computation, ordering: ordered

  11. Cautious operators (PPoPP 2010) • Cautious operator implementation: • reads all the elements in its neighborhood before modifying any of them • (eg) Delaunay mesh refinement • Algorithm structure: • cautious operator + unordered active elements • Optimization: optimistic execution w/o buffering • grab locks on elements during read phase • conflict: someone else has lock, so release your locks • once update phase begins, no new locks will be acquired • update in-place w/o making copies • zero-buffering • note: this is not two-phase locking

  12. Eliminating speculation • Coordinated execution of activities: if we can build dependence graph • Run-time scheduling: • cautious operator implementation + unordered active elements • execute all activities partially to determine neighborhoods • create interference graph and find independent set of activities • execute independent set of activities in parallel w/o synchronization • Just-in-time scheduling: • local computation + topology-driven • (eg) tree walks, sparse MVM (inspector-executor) • Compile-time scheduling: • previous case + graph is known at compile-time (eg. grid or clique) • make all scheduling decisions at compile-time time • Speculation needed if • operator implementation is not cautious, or • unordered algorithm that can create new active nodes dynamically

  13. Summary • (Wirth): Algorithms + Data structures = Programs • deep understanding of structure in algorithms and data structures is critical for success in parallelization • Wrong abstractions: • dependence graphs, dataflow graphs, etc. • Right abstraction: • operator formulation of algorithms • key notions: active nodes, neighborhoods, ordering • Exposes key properties of algorithms • amorphous data-parallelism • structure in algorithms and data structures

More Related