Methodology to Increase the Computational Speed to Obtain the Fractal Dimension Using GPU Programming

  • Juan Ruiz de MirasEmail author
  • Jesús Jiménez Ibáñez
Part of the Springer Series in Computational Neuroscience book series (NEUROSCI)


Computing the fractal dimension (FD) can be a very time-consuming process. Nowadays, the data precision or resolution of many sensors is increasingly high (magnetic resonance, ultrasounds, microcomputed tomography, etc.) and, furthermore, some applications require 3D data post-processing. The processing of large data sets is also very common in several analyses and applications. Therefore, fast algorithms for computing the FD are required, above all for interactive applications. Graphics processing unit (GPU) programming has become a standard tool for optimizing certain sorts of time-consuming algorithms. If the problem fits the GPU programming model well, high speedups can be achieved. CUDA and OpenCL are two of the most popular GPU technologies since they do not require special knowledge of computer graphics programming. In this chapter, we present our experience optimizing the processing time of the classic box-counting algorithm to compute the FD by means of CUDA and OpenCL GPU programming. Speedups of up to 28× (CUDA) and 6.3× (OpenCL) against the single-thread CPU version of the algorithm have been obtained. CUDA results are better because the box-counting algorithm has a strong dependency on sorting, and the OpenCL implementations of the best sorting algorithms are not as efficient as the CUDA ones.


3D fractal dimension GPU Box counting CUDA OpenCL 



This work has been partially supported by the University of Jaén, the Caja Rural de Jaén, the Ministry of Economy and Competitiveness, and the European Union (via ERDF funds) through the research projects UJA2013/12/04, UJA2013/08/35, and TIN2014-58218-R.


  1. 1.
    3DVIA repository. 2015. Available from
  2. 2.
    Aim@shape repository. 2015. Available from
  3. 3.
    Bainville E. OpenCL sorting. 2011. Available from
  4. 4.
    Banerjee DS, Sakurikar P, Kothapalli K. Comparison sorting on hybrid multicore architectures for fixed and variable length keys. Int J High Perform Comput Appl. 2014;28(3):267–84.CrossRefGoogle Scholar
  5. 5.
    Biswas MK, Ghose T, Guha S, Biswas PK. Fractal dimension estimation for texture images: a parallel approach. Pattern Recogn Lett. 1998;19:309–13.CrossRefGoogle Scholar
  6. 6.
    BrainWeb: Simulated Brain Database. 2015. Available from
  7. 7.
    OpenCL Data Parallel Primitives Library. 2011. Available from
  8. 8.
    Digital Mars. Process.h C Library Specification. 2015. Available from
  9. 9.
    Eklund A, Dufort P, Forsberg D, LaConte SM. Medical image processing on the GPU – past, present and future. Med Image Anal. 2013;17:1073–94.CrossRefPubMedGoogle Scholar
  10. 10.
    Hoberock J, Bell N. Thrust: a parallel template library. v1.8.0, February 2015. Available from
  11. 11.
    Hou X, Gilmore R, Mindlin GB, Solari HG. An efficient algorithm for fast O(N*ln(N)) box counting. Phys Lett A. 1990;151:43–6.CrossRefGoogle Scholar
  12. 12.
    Intel. Intel threading building blocks reference website. 2015. Available from
  13. 13.
    Jiménez J, Ruiz de Miras J. Fast box-counting algorithm on GPU. Comput Methods Progr Biomed. 2012;108:1229–42.CrossRefGoogle Scholar
  14. 14.
    Jiménez J, Ruiz de Miras J. Box-counting algorithm on GPU and multi-core CPU: an OpenCL cross-platform study. J Supercomput. 2013;65:1327–52.CrossRefGoogle Scholar
  15. 15.
    Jiménez J, López AM, Cruz J, Esteban FJ, Navas J, Villoslada P, Ruiz de Miras J. J Biomed Inform. 2014;51:176–90.CrossRefPubMedGoogle Scholar
  16. 16.
    Kirk DB, Hwu WW. Programming massively parallel processors. Hands-on approach. Burlington: Morgan Kaufmann Publishers; 2010.Google Scholar
  17. 17.
    Khronos Working Group. The OpenCL specification. 2015.
  18. 18.
    Kruger A. Implementation of a fast box-counting algorithm. Comput Phys Commun. 1996;98:224–34.CrossRefGoogle Scholar
  19. 19.
    Liebotich LS, Toth T. A fast algorithm to determine fractal dimension by box counting. Phys Lett A. 1989;141:386–90.CrossRefGoogle Scholar
  20. 20.
    Manjón JV, Coupé P. volBrain: an online MRI brain volumetry system. In: Proceeding of organization for human brain mapping; 2015 June 14–18; Honolulu. 2015.Google Scholar
  21. 21.
    Merrill D, Grimshaw A. High performance and scalable radix sorting: a case study of implementing dynamic parallelism for GPU computing. Parallel Process Lett. 2011;21:245–72.CrossRefGoogle Scholar
  22. 22.
    Mukundan R. Parallel implementation of the box counting algorithm in OpenCL. Fractals. 2015;23(3):1–8.CrossRefGoogle Scholar
  23. 23.
    Normant F, Tricot C. Methods for evaluating the fractal dimension of curves using convex hulls. Phys Rev. 1991;43:6518–25.CrossRefGoogle Scholar
  24. 24.
    NVIDIA. NVIDIA CUDA toolkit documentation 2015. Available from
  25. 25.
    Polok L, Ila V, Smrz P. Fast radix sort for sparse linear algebra on GPU. Simul Ser. 2014;46(5):79–86.Google Scholar
  26. 26.
    Russell D, Hanson J, Ott E. Dimension of strange attractors. Phys Rev Lett. 1980;45:1175–8.CrossRefGoogle Scholar
  27. 27.
    Shamonin DP, Bron EE, Lelieveldt BPF, Smits M, Klein S, Staring M. Fast parallel image registration on CPU and GPU for diagnostic classification of Alzheimer’s disease. Front Neuroinforma. 2014;7:1–15.Google Scholar
  28. 28.
    Sarkar N, Chaudhuri BB. An efficient differential box counting approach to compute fractal dimension of images. IEEE Trans Syst Man Cybernet. 1994;24:115–20.CrossRefGoogle Scholar
  29. 29.
    Shamoto H, Shirahata K, Drozd A, Sato H, Matsuoka S. Large-scale distributed sorting for GPU-based heterogeneous supercomputers. In: Proceeding of the IEEE international conference on big data; 2014 October 27–30; Washington, DC: IEEE press; 2014.Google Scholar
  30. 30.
    Smistad E, Elster AC, Lindseth F. GPU accelerated segmentation and centerline extraction of tubular structures from medical images. Int J Comput Assist Radiol Surg. 2014;9:561–75.CrossRefPubMedGoogle Scholar
  31. 31.
    Smistad E, Falch TL, Bozorgi M, Elster AC, Lindseth F. Medical image segmentation on GPUs – a comprehensive review. Med Image Anal. 2015;20:1–18.CrossRefPubMedGoogle Scholar
  32. 32.
    de Souza J, Rostirolla SP. A fast MATLAB program to estimate the multifractal spectrum of multidimensional data: application to fractures. Comput Geosci. 2011;37(2):241–9.CrossRefGoogle Scholar
  33. 33.
    Stanford University: The Stanford 3D scanning repository. 2015. Available from
  34. 34.
    Tzeng YC, Fan KT, Su YJ, Chen KS. A parallel differential box counting algorithm applied to hyperspectral image classifications. In: Proceeding of the IEEE International Geoscience and Remote Sensing Symposium; 2009 July 12–17; Cape Town: IEEE press; 2009.Google Scholar
  35. 35.
    Wittenbrink CM, Kilgari E, Prabhu A. Fermi GF100 GPU architecture. IEEE Micro. 2011;31:50–9.CrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media New York 2016

Authors and Affiliations

  1. 1.Computer Science DepartmentUniversity of JaénJaénSpain

Personalised recommendations