a course based usability analysis of cilk plus and openmp
play

A Course-Based Usability Analysis of Cilk Plus and OpenMP Michael - PowerPoint PPT Presentation

A Course-Based Usability Analysis of Cilk Plus and OpenMP Michael Coblenz, Robert Seacord, Brad Myers, Joshua Sunshine, and Jonathan Aldrich 1 PROGRAMMING PARALLEL SYSTEMS Parallel programming is notoriously hard Must coordinate work of


  1. A Course-Based Usability Analysis of Cilk Plus and OpenMP 
 Michael Coblenz, Robert Seacord, Brad Myers, Joshua Sunshine, and Jonathan Aldrich 1

  2. PROGRAMMING PARALLEL SYSTEMS Parallel programming is notoriously hard Must coordinate work of many different processing units 2

  3. C LANGUAGE PARALLEL PROGRAMMING C has only low-level parallel programming features The CPLEX study group wants to fix this! Can they decide on a human-centered basis? 3

  4. 4

  5. THE DESIGN SPACE Cilk Plus and OpenMP: both existing, popular approaches Both use shared-memory, fork-join parallelism 5

  6. FORK-JOIN PARALLELISM • Overall approach in Cilk Plus and OpenMP: split task into subtasks; assign subtasks to different threads • Tasks, e.g. loop Monolithic task iterations, are split across threads … Subtask Subtask Subtask Reducers combine partial results Combined result 6

  7. OpenMP vs. Cilk Plus OpenMP: very popular approach using compiler directives Introduced in 1997 Managed by OpenMP ARB Came from industry. Supports FORTRAN too. Cilk Plus: now owned by Intel, originated at MIT Introduced in 1995 Keyword-based approach 7

  8. EMPIRICAL COMPARISON Does one approach lead to fewer bugs? Faster performance? Faster task completion times? Preliminary study; didn’t plan for statistical significance 8

  9. METHOD Master’s level Secure Coding class assignment 9 students; 8 submitted the assignment; 8 participated in experiment Experienced programmers but no apparent experience with parallel programming Gave lectures on OpenMP , Cilk Plus, parallel programming (including race conditions) 9

  10. TASK Parallelize provided serial anagram-finding code twice Told to use reducers and get speedup ≥ 1.5 All students used both extensions controlled for ordering effects Students given VM with Eclipse + Fluorite 10

  11. CILK PLUS CRASH COURSE (1) cilk_for (int i = 0; i < 10; i++) { printf("Hello, world!"); } 11

  12. CILK PLUS CRASH COURSE (2) CILK_C_DECLARE_REDUCER(results_t) results = CILK_C_INIT_REDUCER( results_t, reduce, identity, destroy ); cilk_for (int i = 0; i < word_len - pos; i++) { find_anagrams( dict, permutations[i], results , word_len, pos+1 ); } … results_append(&REDUCER_VIEW(* results ), word); 12

  13. OPENMP CRASH COURSE (1) #pragma omp parallel for { for (int i = 0; i < 10; i++) { printf("Hello, world!"); } } 13

  14. OPENMP CRASH COURSE (2) #pragma omp declare reduction (results_reduction : results_t : results_reduce(&omp_out, &omp_in) ) initializer(results_init(&omp_priv)) results_t results ; … #pragma omp parallel for reduction(results_reduction: results) for (int i = 0; i < word_len; i++) { find_anagrams( dict, permutations[i], & results , word_len, 1 ); } 14

  15. WHICH DO YOU PREFER? CILK_C_DECLARE_REDUCER(results_t) results = CILK_C_INIT_REDUCER( results_t, reduce, identity, destroy ); #pragma omp declare reduction (results_reduction : results_t : results_reduce(&omp_out, &omp_in) ) initializer(results_init(&omp_priv)) 15

  16. SUMMARY OF RESULTS Cilk Plus OpenMP Number of correct programs 5 3 Average speedup 1.5 1.2 Number of correct programs with 4 2 speedup at least 1.5 16

  17. CORRECTNESS 4/8 OpenMP solutions attempted to use reducer One tried but failed; three were successful 4/8 OpenMP solutions didn’t use reducers at all (but two tried) One tried to use #pragma omp critical but neglected {} 8/8 Cilk Plus solutions attempted to use reducer Two tried but failed (one declared reducer but didn’t use it; one called REDUCER_VIEW outside parallel region) 17

  18. PERFORMANCE OpenMP speedups Cilk Plus speedups 2 Speedup (safe solutions 1.5 only) 1 0.5 0 18

  19. ESTIMATED TIME ON TASK Estimates (hours) based on Fluorite logs OpenMP Cilk Plus Total task average average task time task time time OpenMP first, 11 4 15 Cilk Plus second OpenMP second, 3 9 12 Cilk Plus first 19 Second task First task

  20. HYPOTHESES Parallel programming languages cannot be used safely (yet) by naïve programmers 😲 Distinct reducer, value types may reduce error rates Reducer syntax in OpenMP impedes programmers 20

  21. LIMITATIONS Small sample size Results affected by instruction and provided materials One small task with learning effects Short time frame Small code size Novices in these extensions specifically; students in general 21

  22. CONCLUSIONS Fork/join parallel programming cannot be used safely (yet) by naïve programmers 😲 Maybe we can design better languages, tools, or training OpenMP seems to be harder for novices to use than Cilk Plus Differences seem to affect productivity and correctness — study is worthwhile 22

  23. THANKS! Thanks to the DoD, NSA and NSF for support, and to our anonymous reviewers Contact: Michael Coblenz (mcoblenz@cs.cmu.edu) 23

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend