Parallel Computing      (with GPars)                     NOV 2011
Evolution● Old Days  ○ threads  ○ synchronize  ○ locks  ○ wait-notify
Evolution● Recent enhancements  ○ java.util.concurrent.*  ○ Future task  ○ Executor Pools  ○ Blocking Queues  ○ Concurrent...
Evolution● Emerging Technologies  ○ Map-Reduce  ○ APIs (Google Collections, JSR-166)  ○ Non-blocking I/O  ○ Parallel Frien...
Groovy Parallel SystemsHigh level abstractions for writing concurrent code! ● Code-level Helpers    ○ Parallel Collections...
Groovy Parallel SystemsHigh level abstractions for writing concurrent code! ● Code-level Helpers    ○ Parallel Collections...
DEMO 1 (Parallel encryption)
Optimal Thread Pool Size   Pool size = ???
Optimal Thread Pool Size   Pool size = Ncores
Optimal Thread Pool Size   Pool size = Ncores + 1
Optimal Thread Pool Size   Pool size = Ncores + Block. Op. Ratio
Optimal Thread Pool Size   Pool size = Ncores + wait time                         cpu time
DEMO 2"Dado un rango obtener la cantidad denr. primos agrupados por él ultimo digito"
Danger Dont mess up with mutable shared data!
DEMO 3 (Facebook Search)
Collections ● eachParallel() ● eachWithIndexParallel() ● collectParallel() ● findAllParallel() ● findAnyParallel ● findPar...
DEMO 4 (Facebook Singles)
Fork-JoinMap-Reduce
DEMO 5 (API Calls)
DEMO 6  (Multiget)
Multiget
+ Info  ● http://gpars.org/0.12/guide/guide/single.html  ● http://www.slideshare.net/paulk_asert/concurrency-with-    gpar...
https://github.com/pablomolnar/gpars_samples                                    @pmolnar
Upcoming SlideShare
Loading in …5
×

Parallel computing with GPars

1,314 views

Published on

This slides are for the Parallel Computing talk. You can read the repo samples of the talk @ https://github.com/pablomolnar/gpars_samples

@pmolnar

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,314
On SlideShare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Parallel computing with GPars

  1. 1. Parallel Computing (with GPars) NOV 2011
  2. 2. Evolution● Old Days ○ threads ○ synchronize ○ locks ○ wait-notify
  3. 3. Evolution● Recent enhancements ○ java.util.concurrent.* ○ Future task ○ Executor Pools ○ Blocking Queues ○ ConcurrentMap
  4. 4. Evolution● Emerging Technologies ○ Map-Reduce ○ APIs (Google Collections, JSR-166) ○ Non-blocking I/O ○ Parallel Friendly Languages (Scala, Clojure, Groovy)
  5. 5. Groovy Parallel SystemsHigh level abstractions for writing concurrent code! ● Code-level Helpers ○ Parallel Collections ○ Asynchronous Processing ○ Fork/Join - Map/Reduce ● Architecture-level Concepts ○ Dataflows ○ Actors ● Protecting Shared Mutable State ○ Agents
  6. 6. Groovy Parallel SystemsHigh level abstractions for writing concurrent code! ● Code-level Helpers ○ Parallel Collections ○ Asynchronous Processing ○ Fork/Join - Map/Reduce ● Architecture-level Concepts ○ Dataflows ○ Actors (For next time...) ● Protecting Shared Mutable State ○ Agents (For next time...)
  7. 7. DEMO 1 (Parallel encryption)
  8. 8. Optimal Thread Pool Size Pool size = ???
  9. 9. Optimal Thread Pool Size Pool size = Ncores
  10. 10. Optimal Thread Pool Size Pool size = Ncores + 1
  11. 11. Optimal Thread Pool Size Pool size = Ncores + Block. Op. Ratio
  12. 12. Optimal Thread Pool Size Pool size = Ncores + wait time cpu time
  13. 13. DEMO 2"Dado un rango obtener la cantidad denr. primos agrupados por él ultimo digito"
  14. 14. Danger Dont mess up with mutable shared data!
  15. 15. DEMO 3 (Facebook Search)
  16. 16. Collections ● eachParallel() ● eachWithIndexParallel() ● collectParallel() ● findAllParallel() ● findAnyParallel ● findParallel() ● everyParallel() ● anyParallel() ● grepParallel() ● groupByParallel() ● foldParallel() ● minParallel() ● maxParallel() ● sumParallel() ● splitParallel() ● countParallel() ● foldParallel()
  17. 17. DEMO 4 (Facebook Singles)
  18. 18. Fork-JoinMap-Reduce
  19. 19. DEMO 5 (API Calls)
  20. 20. DEMO 6 (Multiget)
  21. 21. Multiget
  22. 22. + Info ● http://gpars.org/0.12/guide/guide/single.html ● http://www.slideshare.net/paulk_asert/concurrency-with- gpars ● http://gee.cs.oswego.edu/dl/papers/fj.pdf ● http://static.googleusercontent. com/external_content/untrusted_dlcp/labs.google. com/en/us/papers/mapreduce-osdi04.pdf ● Java Concurrency in Practice (ISBN-0321349601)Pics Credits ● Stone age: http://tinyurl.com/bvnlv74 ● Steam train: http://tinyurl.com/6lp3krq ● Speed train: http://tinyurl.com/7jjc3v5 ● CPU: http://www.flickr.com/photos/olivander/149865626/
  23. 23. https://github.com/pablomolnar/gpars_samples @pmolnar

×