A Datalog Engine for GPUs

  • Carlos Alberto Martínez-Angeles
  • Inês Dutra
  • Vítor Santos Costa
  • Jorge Buenabad-ChávezEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8439)


We present the design and evaluation of a Datalog engine for execution in Graphics Processing Units (GPUs). The engine evaluates recursive and non-recursive Datalog queries using a bottom-up approach based on typical relational operators. It includes a memory management scheme that automatically swaps data between memory in the host platform (a multicore) and memory in the GPU in order to reduce the number of memory transfers. To evaluate the performance of the engine, four Datalog queries were run on the engine and on a single CPU in the multicore host. One query runs up to 200 times faster on the (GPU) engine than on the CPU.


Logic programming Datalog Parallel computing GPUs Relational databases 



CMA thanks the support during his MSc studies from: the University of Porto, the Centre for Research and Postgraduate Studies of the National Polytechnic Institute (CINVESTAV-IPN) of Mexico, and the Mexican Council of Science and Technology (CONACyT). ICD and VSC were partially supported by: the European Regional Development Fund (ERDF), COMPETE Programme; the Portuguese Foundation for Science and Technology (FCT), project LEAP FCOMP-01-0124-FEDER-015008; and project ABLe PTDC/EEI-SII/2094/2012.


  1. 1.
  2. 2.
  3. 3.
    Datalog by the MITRE Corporation.
  4. 4.
  5. 5.
    Thrust: A Parallel Template Library.
  6. 6.
    Abiteboul, S., et al.: Foundations of Databases. Addison-Wesley, Boston (1995)zbMATHGoogle Scholar
  7. 7.
    Afrati, F.N., Borkar, V., Carey, M., Polyzotis, N., Ullman, J.D.: Cluster Computing, Recursion and Datalog. In: de Moor, O., Gottlob, G., Furche, T., Sellers, A. (eds.) Datalog 2010. LNCS, vol. 6702, pp. 120–144. Springer, Heidelberg (2011) CrossRefGoogle Scholar
  8. 8.
    Beeri, C., Ramakrishnan, R.: On the power of magic. J. Log. Program. 10(3–4), 255–299 (1991)CrossRefzbMATHMathSciNetGoogle Scholar
  9. 9.
    Bravenboer, M., Smaragdakis, Y.: Strictly declarative specification of sophisticated points-to analyses. In: OOPSLA, pp. 243–262 (2009)Google Scholar
  10. 10.
    Costa, V.S., et al.: The YAP prolog system. TPLP 12(1–2), 5–34 (2012)zbMATHGoogle Scholar
  11. 11.
    Diamos, G., et al.: Efficient relational algebra algorithms and data structures for GPU. Technical report, Georgia Institute of Technology (2012)Google Scholar
  12. 12.
    Diamos G. et al.: Relational algorithms for multi-bulk-synchronous processors. In: 18th Symposium on Principles and Practice of Parallel Programming (2013)Google Scholar
  13. 13.
    Dong, G., Jianwen, S., Topor, R.W.: Nonrecursive incremental evaluation of datalog queries. Ann. Math. Artif. Intell. 14(2–4), 187–223 (1995)CrossRefzbMATHGoogle Scholar
  14. 14.
    Green, T.J., Aref, M., Karvounarakis, G.: LogicBlox, Platform and Language: A Tutorial. In: Barceló, P., Pichler, R. (eds.) Datalog 2.0 2012. LNCS, vol. 7494, pp. 1–8. Springer, Heidelberg (2012) CrossRefGoogle Scholar
  15. 15.
    Harris, M., et al.: Parallel prefix sum (scan) with CUDA. In: Nguyen, H. (ed.) GPU Gems 3, pp. 851–876. Addison Wesley, Boston (2007) Google Scholar
  16. 16.
    He, B., et al.: Relational joins on graphics processors. In: SIGMOD Conference, pp. 511–524 (2008)Google Scholar
  17. 17.
    He, B., et al.: Relational query coprocessing on graphics processors. ACM Trans. Database Syst. (TODS) 34(4), 21:1–21:39 (2009)CrossRefGoogle Scholar
  18. 18.
    Huang, S.S., et al.: Datalog and emerging applications: an interactive tutorial. In: SIGMOD Conference. pp. 1213–1216 (2011)Google Scholar
  19. 19.
    Loo, B.T., et al.: Declarative networking: language, execution and optimization. In: SIGMOD Conference, pp. 97–108 (2006)Google Scholar
  20. 20.
    Marczak W.R., et al.: Secureblox: customizable secure distributed data processing. In: SIGMOD Conference, pp. 723–734 (2010)Google Scholar
  21. 21.
    Musser, D.R., Derge, G.J., Saini, A.: STL Tutorial and Reference Guide: C++ Programming With The Standard Template Library, 2nd edn. Addison-Wesley Longman Publishing Co. Inc., Boston (2001)Google Scholar
  22. 22.
    Rao, J., Ross, K.A.: Cache conscious indexing for decision-support in main memory. In: 25th VLDB Conference, San Francisco., CA, USA, pp. 78–89 (1999)Google Scholar
  23. 23.
    Shen, W., et al.: Declarative information extraction using datalog with embedded extraction predicates. In: VLDB, pp. 1033–1044 (2007)Google Scholar
  24. 24.
    Swift, T., Warren, D.S.: Xsb: Extending prolog with tabled logic programming. TPLP 12(1–2), 157–187 (2012)zbMATHMathSciNetGoogle Scholar
  25. 25.
    Tekle, K.T., Liu, Y.A.: More efficient datalog queries: subsumptive tabling beats magic sets. In: SIGMOD Conference, pp. 661–672 (2011)Google Scholar
  26. 26.
    Ullman, J.D.: Principles of Database and Knowledge-Base Systems, vol. 1. Computer Science Press, Beijing (1988)Google Scholar
  27. 27.
    Ullman, J.D.: Principles of Database and Knowledge-Base Systems, vol. 2. Computer Science Press, Beijing (1989)Google Scholar
  28. 28.
    Valiant, L.G.: A bridging model for parallel computation. Commun. ACM 33(8), 103–111 (1990)CrossRefGoogle Scholar
  29. 29.
    Wu, H., et al.: Kernel weaver: Automatically fusing database primitives for efficient GPU computation. In: 45th International Symposium on Microarchitecture (2012)Google Scholar
  30. 30.
    Wu, H., et al.: Optimizing data warehousing applications for GPUs using kernel fusion/fission. In: IEEE 26th International Parallel and Distributed Processing Symposium Workshops and PhD Forum (2012)Google Scholar
  31. 31.
    Young, J., et al.: Satisfying data-intensive queries using GPU clusters. In: 2nd Annual Workshop on High-Performance Computing meets Databases (2012)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Carlos Alberto Martínez-Angeles
    • 1
  • Inês Dutra
    • 2
  • Vítor Santos Costa
    • 2
  • Jorge Buenabad-Chávez
    • 1
    Email author
  1. 1.Departamento de ComputaciónCINVESTAV-IPNMexicoMexico
  2. 2.Departmento de Ciência de ComputadoresUniversidade do PortoPortoPortugal

Personalised recommendations