Abstract
The estimation and control of resource usage is now an important challenge in an increasing number of computing systems. In particular, requirements on timing and energy arise in a wide variety of applications such as internet of things, cloud computing, health, transportation, and robots. At the same time, parallel computing, with (heterogeneous) multi-core platforms in particular, has become the dominant paradigm in computer architecture. Predicting resource usage on such platforms poses a difficult challenge. Most work on static resource analysis has focused on sequential programs, and relatively little progress has been made on the analysis of parallel programs, or more specifically on parallel logic programs. We propose a novel, general, and flexible framework for setting up cost equations/relations which can be instantiated for performing resource usage analysis of parallel logic programs for a wide range of resources, platforms, and execution models. The analysis estimates both lower and upper bounds on the resource usage of a parallel program (without executing it) as functions on input data sizes. In addition, it also infers other meaningful information to better exploit and assess the potential and actual parallelism of a system. We develop a method for solving cost relations involving the max function that arise in the analysis of parallel programs. Finally, we instantiate our general framework for the analysis of logic programs with Independent And-Parallelism, report on an implementation within the CiaoPP system, and provide some experimental results. To our knowledge, this is the first approach to the cost analysis of parallel logic programs.
Research partially funded by Spanish MINECO TIN2015-67522-C3-1-R TRACES project, and the Madrid P2018/TCS-4339 BLOQUES-CM program. We are also grateful to the anonymous reviewers for their useful comments.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
For the sake of clarity, we abuse notation in the examples when representing the cost functions that depend on data sizes.
- 2.
We give equivalent but simpler descriptions than in [24], which are allowed by assuming that programs are the result of a normalization process that makes all unifications explicit in the clause body, so that the arguments of the clause head and the body literals are all unique variables. We also change some notation for readability and illustrative purposes.
- 3.
As the algorithm used by SMT solvers in this case is not guaranteed to terminate, we set a timeout.
References
Albert, E., Arenas, P., Genaim, S., Gómez-Zamalloa, M., Puebla, G.: Cost analysis of concurrent OO programs. In: Yang, H. (ed.) APLAS 2011. LNCS, vol. 7078, pp. 238–254. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-25318-8_19
Albert, E., Arenas, P., Genaim, S., Puebla, G.: Closed-form upper bounds in static cost analysis. J. Autom. Reason. 46(2), 161–203 (2011)
Albert, E., Arenas, P., Genaim, S., Zanardini, D.: Task-level analysis for a language with async-finish parallelism. In: Proceedings of LCTES 2011, pp. 21–30. ACM Press (2011)
Albert, E., Correas, J., Johnsen, E., Pu, K., Román-Díez, G.: Parallel cost analysis. ACM Trans. Comput. Logic 19(4), 1–37 (2018)
Alonso, L., Reingold, E., Schott, R.: Multidimensional divide-and-conquer maximin recurrences. SIAM J. Discret. Math. 8(3), 428–447 (1995)
Blelloch, G.E., Greiner, J.: A provable time and space efficient implementation of NESL. In: ACM International Conference on Functional Programming, pp. 213–225, May 1996
Debray, S.K., Lin, N.W.: Cost analysis of logic programs. ACM TOPLAS 15(5), 826–875 (1993)
Debray, S.K., Lin, N.W., Hermenegildo, M.V.: Task granularity analysis in logic programs. In: Proceedings of the PLDI 1990, pp. 174–188. ACM, June 1990
Debray, S.K., Lopez-Garcia, P., Hermenegildo, M.V., Lin, N.W.: Lower bound cost estimation for logic programs. In: ILPS 1997, pp. 291–305. MIT Press (1997)
Gupta, G., Pontelli, E., Ali, K., Carlsson, M., Hermenegildo, M.V.: Parallel execution of prolog programs: a survey. ACM TOPLAS 23(4), 472–602 (2001)
Haemmerlé, R., López-García, P., Liqat, U., Klemen, M., Gallagher, J.P., Hermenegildo, M.V.: A transformational approach to parametric accumulated-cost static profiling. In: Kiselyov, O., King, A. (eds.) FLOPS 2016. LNCS, vol. 9613, pp. 163–180. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-29604-3_11
Harper, R.: Practical Foundations for Programming Languages, 2 edn. Cambridge University Press (2016). https://doi.org/10.1017/CBO9781316576892
Hermenegildo, M., Puebla, G., Bueno, F., Garcia, P.L.: Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Sci. Comput. Program. 58(1–2), 115–140 (2005)
Hermenegildo, M., Rossi, F.: Strict And non-strict independent and-parallelism in logic programs: correctness, efficiency, and compile-time conditions. J. Log. Program. 22(1), 1–45 (1995)
Hoefler, T., Kwasniewski, G.: Automatic complexity analysis of explicitly parallel programs. In: 26th ACM Symposium on Parallelism in Algorithms and Architectures, SPAA 2014, pp. 226–235 (2014)
Hoffmann, J., Shao, Z.: Automatic static cost analysis for parallel programs. In: Vitek, J. (ed.) ESOP 2015. LNCS, vol. 9032, pp. 132–157. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46669-8_6
Hwang, H., Tsai, T.H.: An asymptotic theory for recurrence relations based on minimization and maximization. Theoret. Comput. Sci. 290(3), 1475–1501 (2003)
Klemen, M., Lopez-Garcia, P., Gallagher, J., Morales, J., Hermenegildo, M.V.: Towards a general framework for static cost analysis of parallel logic programs. Technical report CLIP-1/2019.0, The CLIP Lab, IMDEA Software Institute and T.U. Madrid, July 2019. http://arxiv.org/abs/1907.13272
Lopez-Garcia, P., Darmawan, L., Bueno, F.: A framework for verification and debugging of resource usage properties. In: Technical Communications of ICLP. LIPIcs, vol. 7, pp. 104–113. Schloss Dagstuhl, July 2010
Lopez-Garcia, P., Darmawan, L., Klemen, M., Liqat, U., Bueno, F., Hermenegildo, M.V.: Interval-based resource usage verification by translation into Horn clauses and an application to energy consumption. TPLP 18, 167–223 (2018)
Lopez-Garcia, P., Klemen, M., Liqat, U., Hermenegildo, M.V.: A general framework for static profiling of parametric resource usage. TPLP 16(5–6), 849–865 (2016)
Méndez-Lojo, M., Navas, J., Hermenegildo, M.V.: A flexible, (C)LP-based approach to the analysis of object-oriented programs. In: King, A. (ed.) LOPSTR 2007. LNCS, vol. 4915, pp. 154–168. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78769-3_11
de Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78800-3_24
Navas, J., Mera, E., López-García, P., Hermenegildo, M.V.: User-definable resource bounds analysis for logic programs. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 348–363. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74610-2_24
Rosendahl, M.: Automatic complexity analysis. In: Proceedings of FPCA 1989, pp. 144–156. ACM Press (1989)
Serrano, A., Lopez-Garcia, P., Hermenegildo, M.V.: Resource usage analysis of logic programs via abstract interpretation using sized types. TPLP 14(4–5), 739–754 (2014). ICLP 2014 Special Issue
Shen, K., Hermenegildo, M.: High-level characteristics of or- and Independent and-parallelism in Prolog. Int. J. Parallel Prog. 24(5), 433–478 (1996). https://doi.org/10.1007/BF02583023
Wang, B.F.: Tight bounds on the solutions of multidimensional divide-and-conquer maximin recurrences. Theoret. Comput. Sci. 242(1), 377–401 (2000)
Wegbreit, B.: Mechanical program analysis. Comm. ACM 18(9), 528–539 (1975)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Klemen, M., López-García, P., Gallagher, J.P., Morales, J.F., Hermenegildo, M.V. (2020). A General Framework for Static Cost Analysis of Parallel Logic Programs. In: Gabbrielli, M. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2019. Lecture Notes in Computer Science(), vol 12042. Springer, Cham. https://doi.org/10.1007/978-3-030-45260-5_2
Download citation
DOI: https://doi.org/10.1007/978-3-030-45260-5_2
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-45259-9
Online ISBN: 978-3-030-45260-5
eBook Packages: Computer ScienceComputer Science (R0)