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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 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
Johnston, W.M., Hanna, J.R.P., Millar, R.J.: Advances in dataflow programming languages. ACM Comput. Surv. 36(1), 1–34 (2004)
MathWorks Inc.: Parallel Computing Toolbox (2014). http://www.mathworks.com/help/distcomp/index.html
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)
Sanderson, C.: Armadillo: an open source C++ linear algebra library for fast prototyping and computationally intensive experiments. Technical report (2010)
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)
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)
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)
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)
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)
Margrave, D.G.: CREWES. http://www.crewes.org
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)
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)
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)
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)
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)
Travinin Bliss, N., Kepner, J.: pMatlab parallel MATLAB library. Int. J. High Perform. Comput. Appl. 21(3), 336–359 (2007)
Beck, M., Johnson, R., Pingali, K.: From control flow to dataflow. J. Parallel Distrib. Comput. 12, 118–129 (1989)
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)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights 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)