Skip to main content

Automatic Parallelism Through Macro Dataflow in MATLAB

  • Conference paper
  • First Online:
Languages and Compilers for Parallel Computing (LCPC 2014)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 8967))

  • 878 Accesses

Abstract

Dataflow computation model is a powerful paradigm that exploits the inherent parallelism in a program. It is especially relevant on modern machines that offer multiple avenues for parallelizing code. However, adopting this model has been challenging as neither hardware- nor language-based approaches have had much success in the past outside specialized contexts. We argue that macro dataflow, where each dataflow operation is computationally non-trivial, can be implemented effectively on contemporary general-purpose hardware with the help of a runtime system employing a modern task-oriented library, such as Intel Threading Building Blocks (TBB). In order to make this approach attractive to community of scientific programmers, a strategy that enables programs written in popular programming languages to execute as dataflow computations is required.

We present a fully automatic compilation technique to translate matlab programs to dynamic dataflow graphs that are capable of handling unbounded structured control flow. These graphs are executed on multicore machines in an event driven fashion with the help of a runtime system built on top of Intel TBB. Array statements in matlab naturally lead to coarse-grained tasks that are translated to C++ code and executed in task-parallel fashion using TBB. By letting each task itself be data parallel, we are able to leverage existing data parallel libraries and utilize parallelism at multiple levels. We use type inference to aid in the creation of macro tasks with sufficient granularity. Our experiments on a set of benchmarks show speedups of up to 18x using our approach, over the original code on a machine with two 16-core processors.

A. Chauhan—Currently with Google Inc.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    The for-loop in C/C++ (excluding C++11) is not a true for-loop, just a convenient form of while. In contrast, matlab supports Fortran-style true for-loops.

References

  1. Johnston, W.M., Hanna, J.R.P., Millar, R.J.: Advances in dataflow programming languages. ACM Comput. Surv. 36(1), 1–34 (2004)

    Article  Google Scholar 

  2. MathWorks Inc.: Parallel Computing Toolbox (2014). http://www.mathworks.com/help/distcomp/index.html

  3. Willhalm, T., Popovici, N.: Putting intel\(^{\textregistered }\) threading building blocks to work. In: Proceedings of the 1st International Workshop on Multicore Software Engineering, IWMSE 2008, pp. 3–4. ACM, New York (2008)

    Google Scholar 

  4. Sanderson, C.: Armadillo: an open source C++ linear algebra library for fast prototyping and computationally intensive experiments. Technical report (2010)

    Google Scholar 

  5. Ottenstein, K.J., Ballance, R.A., MacCabe, A.B.: The program dependence web: a representation supporting control-, data-, and demand-driven interpretation of imperative languages. SIGPLAN Not. 25(6), 257–271 (1990)

    Article  Google Scholar 

  6. Tu, P., Padua, D.: Gated SSA-based demand-driven symbolic analysis for parallelizing compilers. In: Proceedings of the 9th International Conference on Supercomputing, ICS 1995, pp. 414–423. ACM, New York (1995)

    Google Scholar 

  7. Chauhan, A., Kennedy, K.: Slice-hoisting for array-size inference in MATLAB. In: Rauchwerger, L. (ed.) LCPC 2003. LNCS, vol. 2958, pp. 495–508. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  8. Shei, C.Y., Chauhan, A., Shaw, S.: Compile-time disambiguation of MATLAB types through concrete interpretation with automatic run-time fallback. In: HiPC, pp. 264–273. IEEE (2009)

    Google Scholar 

  9. Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst. 13(4), 451–490 (1991)

    Article  Google Scholar 

  10. Margrave, D.G.: CREWES. http://www.crewes.org

  11. Sterling, T., Keuhn, J., Thistle, M., Anastasio, T.: Studies on optimal task granularity and random mapping. In: Gao, G.R., Bic, L., Gaudiot, J.L. (eds.) Advanced Topics in Dataflow Computing and Multithreading. Wiley-IEEE Computer Society Press, Los Alamitos (1995)

    Google Scholar 

  12. Frigo, M., Leiserson, C.E., Randall, K.H.: The implementation of the Cilk-5 multithreaded language. In: Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation, PLDI 1998, pp. 212–223. ACM, New York (1998)

    Google Scholar 

  13. Ramaswamy, S., Hodges IV., E.W., Banerjee, P.: Compiling MATLAB programs to ScaLAPACK: exploiting task and data parallelism. In: Proceedings of the 10th International Parallel Processing Symposium, IPPS 1996, pp. 613–619. IEEE Computer Society, Washington, DC (1996)

    Google Scholar 

  14. Choy, R., Edelman, A., Gilbert, J.R., Shah, V., Cheng, D.: Star-P: high productivity parallel computing. In: 8th Annual Workshop on High-Performance Embedded Computing (HPEC 2004) (2004)

    Google Scholar 

  15. Teo, Y.-M., Chen, Y., Wang, X.: On grid programming and MATLAB*G. In: Jin, H., Pan, Y., Xiao, N., Sun, J. (eds.) GCC 2004. LNCS, vol. 3251, pp. 761–768. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  16. Travinin Bliss, N., Kepner, J.: pMatlab parallel MATLAB library. Int. J. High Perform. Comput. Appl. 21(3), 336–359 (2007)

    Article  Google Scholar 

  17. Beck, M., Johnson, R., Pingali, K.: From control flow to dataflow. J. Parallel Distrib. Comput. 12, 118–129 (1989)

    Article  Google Scholar 

  18. Jagannathan, R.: Coarse-grain dataflow programming of conventional parallel computers. In: Gao, G.R., Bic, L., Gaudiot, J.L. (eds.) Advanced Topics in Dataflow Computing and Multithreading. Wiley-IEEE Computer Society Press, Los Alamitos (1995)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Pushkar Ratnalikar .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Ratnalikar, P., Chauhan, A. (2015). Automatic Parallelism Through Macro Dataflow in MATLAB. In: Brodman, J., Tu, P. (eds) Languages and Compilers for Parallel Computing. LCPC 2014. Lecture Notes in Computer Science(), vol 8967. Springer, Cham. https://doi.org/10.1007/978-3-319-17473-0_19

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-17473-0_19

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-17472-3

  • Online ISBN: 978-3-319-17473-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics