Parallel Programming Made Easy Primož Gabrijelčič,

Slides:



Advertisements
Similar presentations
H IGH - LEVEL M ULTITHREADED P ROGRAMMING [P ART I] Primož Gabrijelčič.
Advertisements

H IGH - LEVEL M ULTITHREADED P ROGRAMMING [P ART II] Primož Gabrijelčič.
H IGH - LEVEL M ULTITHREADED P ROGRAMMING [P ART III] Primož Gabrijelčič.
Programming in Occam-pi: A Tutorial By: Zain-ul-Abdin
My first computer: The Apple ][ It wanted to be programmed.
Parallel Programming with OmniThreadLibrary
Parasol Architecture A mild case of scary asynchronous system stuff.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Fast programs for modern computers
Async Programming WITH ASYNC TASK
Multithreading Made Simple with OmniThreadLibrary
Intro to Threading CS221 – 4/20/09. What we’ll cover today Finish the DOTS program Introduction to threads and multi-threading.
Threads Section 2.2. Introduction to threads A thread (of execution) is a light-weight process –Threads reside within processes. –They share one address.
Precept 3 COS 461. Concurrency is Useful Multi Processor/Core Multiple Inputs Don’t wait on slow devices.
Based on Silberschatz, Galvin and Gagne  2009 Threads Definition and motivation Multithreading Models Threading Issues Examples.
CS 603 Threads, Processes, and Agents March 18, 2002.
Winter 2011ACS Ron McFadyen1 Façade A façade simplifies access to a related set of objects by providing one object that all objects outside the.
Activity Diagrams Derived from several techniques: Event diagrams of Jim Odell SDL state modeling techniques Workflow modeling Petri nets Especially useful.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
CHAPTER 10 Recursion. 2 Recursive Thinking Recursion is a programming technique in which a method can call itself to solve a problem A recursive definition.
Fundamentals of Python: From First Programs Through Data Structures
G ETTING F ULL S PEED WITH D ELPHI Primož Gabrijelčič otl.17slon.com [W HY S INGLE -T HREADING I S N OT E.
1 Advanced Computer Programming Concurrency Multithreaded Programs Copyright © Texas Education Agency, 2013.
Programming Network Servers Topic 6, Chapters 21, 22 Network Programming Kansas State University at Salina.
OpenMP in a Heterogeneous World Ayodunni Aribuki Advisor: Dr. Barbara Chapman HPCTools Group University of Houston.
Collage of Information Technology University of Palestine Advanced programming MultiThreading 1.
Building Multithreaded Solutions with OmniThreadLibrary
Silberschatz, Galvin and Gagne ©2011Operating System Concepts Essentials – 8 th Edition Chapter 4: Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
View-Oriented Parallel Programming for multi-core systems Dr Zhiyi Huang World 45 Univ of Otago.
Threads, Thread management & Resource Management.
Threaded Applications Introducing additional threads in a Delphi application is easy.
Python Concurrency Threading, parallel and GIL adventures Chris McCafferty, SunGard Global Services.
Chapter 2 (PART 1) Light-Weight Process (Threads) Department of Computer Science Southern Illinois University Edwardsville Summer, 2004 Dr. Hiroshi Fujinoki.
The University of Adelaide, School of Computer Science
Problems with Send and Receive Low level –programmer is engaged in I/O –server often not modular –takes 2 calls to get what you want (send, followed by.
An Implementation and Performance Evaluation of Language with Fine-Grain Thread Creation on Shared Memory Parallel Computer Yoshihiro Oyama, Kenjiro Taura,
Concurrent Programming. Concurrency  Concurrency means for a program to have multiple paths of execution running at (almost) the same time. Examples:
SIMPLE PARALLEL PROGRAMMING WITH PATTERNS AND OMNITHREADLIBRARY PRIMOŽ GABRIJELČIČ SKYPE: GABR42
FastMM in Depth Primož Gabrijelčič,
COMP 111 Threads and concurrency Sept 28, Tufts University Computer Science2 Who is this guy? I am not Prof. Couch Obvious? Sam Guyer New assistant.
Working in the Background Radan Ganchev Astea Solutions.
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
Using a simple Rendez-Vous mechanism in Java
J ICOS’s Abstract Distributed Service Component Peter Cappello Computer Science Department UC Santa Barbara.
Discussion Week 2 TA: Kyle Dewey. Overview Concurrency Process level Thread level MIPS - switch.s Project #1.
Lecture 3 Threads Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Simplify Parallel Programming with Patterns Primož Gabrijelčič R&D Manager, FAB.
Threads, Thread management & Resource Management.
Concurrency (Threads) Threads allow you to do tasks in parallel. In an unthreaded program, you code is executed procedurally from start to finish. In a.
Threads. Thread A basic unit of CPU utilization. An Abstract data type representing an independent flow of control within a process A traditional (or.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
GPU Computing for GIS James Mower Department of Geography and Planning University at Albany.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Lecturer 3: Processes multithreaded Operating System Concepts Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess.
Concurrent Revisions: A deterministic concurrency model. Daan Leijen & Sebastian Burckhardt Microsoft Research (OOPSLA 2010, ESOP 2011)
1 Copyright © 2010, Elsevier Inc. All rights Reserved Chapter 4 Shared Memory Programming with Pthreads An Introduction to Parallel Programming Peter Pacheco.
Introduction to threads
Faster parallel programs with improved FastMM
Async or Parallel? No they aren’t the same thing!
Chapter 4 Multithreading programming
Parallel Programming Done Right with OTL and PPL
MXNet Internals Cyrus M. Vahid, Principal Solutions Architect,
Multithreaded Programming
Developing and testing enterprise Java applications
January 8, 2004 Adrienne Noble
January 15, 2004 Adrienne Noble
Parallel Programming with ForkJoinPool Tasks in Java
Chapter 4:Threads Book: Operating System Principles , 9th Edition , Abraham Silberschatz, Peter Baer Galvin, Greg Gagne.
Presentation transcript:

Parallel Programming Made Easy Primož Gabrijelčič,

Why and How

The End of Free Lunch © Herb Sutter, What we want What we have

Three Paths … The Delphi Way – TMyThread = class(TThread) The Windows Way – FHandle := BeginThread(nil, Pointer(Self), 0, FThreadID); The Lightweight Way (AsyncCalls) – TAsyncCalls.Invoke(procedure begin DoTheCalculation; end); – andy.jgknet.de andy.jgknet.de

… Plus One The No-Fuss Way (OmniThreadLibrary) – thread := TOmniFuture.Create(YourFunction); // do some work Show(thread.Value); – otl.17slon.com otl.17slon.com – code.google.com/p/omnithreadlibrary code.google.com/p/omnithreadlibrary –... D2007/2009⇨ only 

When To Use Slow background process Background communication Executing synchronous API Multicore data processing Multiple clients

OmniThreadLibrary

OmniThreadLibrary is … … VCL for multithreading – Simplifies programming tasks – Componentizes solutions – Allows access to the bare metal … trying to make multithreading possible for mere mortals … providing well-tested components packed in reusable classes with high- level parallel programming support

Today‘s Topic Futures Join Parallel for

Futures Wikipedia – “They (futures) describe an object that acts as a proxy for a result that is initially not known, usually because the computation of its value has not yet completed.” – Start background calculation, wait on result. How to use? – Future := TOmniFuture.Create(calculation); – Query Future.Value;

Join “Fork and Wait” Similar to Future – Start multiple background calculations – Wait for all to complete – No result is returned (directly) Two basic forms – Join(task1, task2); – Join([task1, task2, task3, … taskN]);

Parallel For A simple façade for terribly complicated stuff Parallel.ForEach(1, CMaxSGPrimeTest).Execute( procedure (const value: integer) begin if IsPrime(value) then numPrimes.Increment; end);

Parting Notes

Be Afraid Be very afraid! Designing parallel solutions is hard Writing multithreaded code is hard Testing multicore apps is hard Debugging multithreading code is pure insanity

Keep in Mind Don’t parallelize everything Don’t create thousands of threads Rethink the algorithm Prove the improvements Test, test and test

Q & A