Skip to main content

Estimating the overlap between dependent computations for automatic parallelization


Researchers working on the automatic parallelization of programs have long known that too much parallelism can be even worse for performance than too little, because spawning a task to be run on another CPU incurs overheads. Autoparallelizing compilers have therefore long tried to use granularity analysis to ensure that they only spawn off computations whose cost will probably exceed the spawn-off cost by a comfortable margin. However, this is not enough to yield good results, because data dependencies may also limit the usefulness of running computations in parallel. If one computation blocks almost immediately and can resume only after another has completed its work, then the cost of parallelization again exceeds the benefit. We present a set of algorithms for recognizing places in a program where it is worthwhile to execute two or more computations in parallel that pay attention to the second of these issues as well as the first. Our system uses profiling information to compute the times at which a procedure call consumes the values of its input arguments and the times at which it produces the values of its output arguments. Given two calls that may be executed in parallel, our system uses the times of production and consumption of the variables they share to determine how much their executions would overlap if they were run in parallel, and therefore whether executing them in parallel is a good idea or not. We have implemented this technique for Mercury in the form of a tool that uses profiling data to generate recommendations about what to parallelize, for the Mercury compiler to apply on the next compilation of the program. We present preliminary results that show that this technique can yield useful parallelization speedups, while requiring nothing more from the programmer than representative input data for the profiling run.

Hide All
Bevemyr, J., Lindgren, T. and Millroth, H. 1993. Reform Prolog: The language and its implementation. In Proceedings of the Tenth International Conference on Logic Programming. Budapest, Hungary, 283298.
Casas, A., Carro, M. and Hermenegildo, M. V. 2007. Annotation algorithms for unrestricted independent AND-parallelism in logic programs. In Proceedings of the 17th International Symposium on Logic-based Program Synthesis and Transformation. Lyngby, Denmark, 138153.
Gras, D. C. and Hermenegildo, M. V. 2009. Non-strict independence-based program parallelization using sharing and freeness information. Theoretical Computer Science 410 (46), 47044723.
Halstead, R. H. 1984. Implementation of MultiLisp: Lisp on a multiprocessor. In Proceedings of the 1984 ACM Symposium on List and Functional Programming. Austin, Texas, 917.
Harris, T. and Singh, S. 2007. Feedback directed implicit parallelism. SIGPLAN Notices 42 (9), 251264.
Lopez, P., Hermenegildo, M. and Debray, S. 1996. A methodology for granularity-based control of parallelism in logic programs. Journal of Symbolic Computation 22 (4), 715734.
Marlow, S., Jones, S. P. and Singh, S. 2009. Runtime support for multicore Haskell. SIGPLAN Notices 44 (9), 6578.
Muthukumar, K., Bueno, F., de la Banda, M. J. G. and Hermenegildo, M. V. 1999. Automatic compile-time parallelization of logic programs for restricted, goal level, independent AND-parallelism. Journal of Logic Programming 38 (2), 165218.
Pontelli, E., Gupta, G., Pulvirenti, F. and Ferro, A. 1997. Automatic compile-time parallelization of prolog programs for dependent and-parallelism. In Proceedings of the 14th International Conference on Logic Programming. Leuven, Belgium, 108122.
Shen, K., Costa, V. S. and King, A. 1999. Distance: A new metric for controlling granularity for parallel execution. Journal of Functional and Logic Programming 1999 (1).
Somogyi, Z., Henderson, F. and Conway, T. 1996. The execution algorithm of Mercury, an efficient purely declarative logic programming language. Journal of Logic Programming 26 (1–3), 1764.
Tannier, J. 2007. Parallel Mercury. M.S. thesis, Institut d'informatique, Facultés Universitaires Notre-Dame de la Paix, 21, rue Grandgagnage, B-5000 Namur, Belgium.
von Praun, C., Ceze, L. and Caşcaval, C. 2007. Implicit parallelism with ordered transactions. In Proceedings of the 12th Symposium on Principles and Practice of Parallel Programming. San Jose, California, 7989.
Wang, P. and Somogyi, Z. 2011. Minimizing the overheads of dependent AND-parallelism. In Proceedings of the 27th International Conference on Logic Programming. Lexington, Kentucky.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Theory and Practice of Logic Programming
  • ISSN: 1471-0684
  • EISSN: 1475-3081
  • URL: /core/journals/theory-and-practice-of-logic-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *



Full text views

Total number of HTML views: 0
Total number of PDF views: 5 *
Loading metrics...

Abstract views

Total abstract views: 107 *
Loading metrics...

* Views captured on Cambridge Core between September 2016 - 22nd April 2018. This data will be updated every 24 hours.