Skip to main content

CPU–GPU buffer communication using compute shader to fill volumes with spheres


This paper describes the usage of shaders to make parallel operations by improving the CPU–GPU communication, using both rendering and compute shaders. When the number of spheres is large, the execution becomes slow and requires a lot of space to store particles. We parallelized the frozen method using an efficient inter-process GPU communication to reduce the operations required. We propose to handle two buffers, one for operations and the other for rendering. While the rendering buffer increases as the number of spheres is required, the operational buffer maintains its size and the number of operations is hold. Experimental results demonstrate that the proposed method shows up 100x throughput improvement over the sequential version. We define a configuration by a 4-tuple as input to the algorithm, and we found a pattern to choose better configurations.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5


  1. 1.

    Alduán I, Otaduy MA (2011) SPH Granular Flow with Friction and Cohesion. In: Proceedings of the 2011 ACM SIGGRAPH/Eurographics Symposium on Computer Animation. Vancouver, British Columbia, Canada

  2. 2.

    Bell N, Yu Y, Mucha PJ (2005) Particle-based Simulation of Granular Materials. In: Proceedings of the 2005 ACM SIGGRAPH/Eurographics Symposium on Computer Animation, SCA ’05. Los Angeles, California

  3. 3.

    Cohen J, Tariq S, Green S (2010) Interactive fluid-particle simulation using translating Eulerian grids. In: Proceedings of I3D 2010: The 2010 ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games.

  4. 4.

    Dharma D, Jonathan C, Kistidjantoro AI, Manaf A (2017) Material Point Method Based Fluid Simulation on GPU Using Compute Shader. In: International Conference on Advanced Informatics, Concepts, Theory, and Applications (ICAICTA), Denpasar, Indonesia, pp. 1-6,

  5. 5.

    Di B, Sun J, Li D, Chen H, Quan Z (2018) GMOD: A Dynamic GPU Memory Overflow Detector. In: Proceedings of the 27th International Conference on Parallel Architectures and Compilation Techniques (PACT ’18). Association for Computing Machinery, New York, NY, USA. Article 20, 1–13.

  6. 6.

    Erb C, Greathouse JL (2018) clARMOR: a dynamic buffer overflow detector for OpenCL kernels. In: IWOCL ’18: Proceedings of the International Workshop on OpenCL, article 15, pp1-2,

  7. 7.

    Ericson C (2005) Real-time collision detection, the Morgan Kaufman series in interactive 3D technology. CRC Press, Boca Raton

    Google Scholar 

  8. 8.

    The Art and Business of Making Games (2020) Pool hall lessons: fast, accurate collision detection between circles or spheres (accessed in September 2020).

  9. 9.

    Markus Ihmsen J, Orthmann B, Kolb SA, Matthias T (2014) SPH Fluids in Computer Graphics. In: Eurographics conference, State of the Art Reports,.

  10. 10.

    Jacobson D (2007) Hardware accelerated point-based rendering of granular matter for interactive applications, mastersthesis. UMEA University, Department of Computing Science, SE-901 87 UMEA, Sweden

  11. 11.

    Juhasz Zoltan, Dŭrian Ján, Derzsi Aranka, Matejčík Štefan, Donkó Zoltán, Hartmann Peter (2021) Efficient GPU implementation of the particle-in-cell/Monte-Carlo collisions method for 1D simulation of low-pressure capacitively coupled plasmas. Comput Phys Commun 263(2021):107913.

    MathSciNet  Article  Google Scholar 

  12. 12.

    Kanchev A (2020) Review of several techniques for accelerating physical simulations on the GPU. 59-th annual scientific conference of Angel Kanchev University of Ruse and Union of Scientists - Ruse “New Industries, Digital Economy, Society - Projections of the Future III”

  13. 13.

    Kolb A, Latta L, Rezk-Salama C (2004) Hardware-Based Simulation and Collision Detection for Large Particle Systems. In: Proceedings of the ACM SIGGRAPH/EUROGRAPHICS Conference on Graphics Hardware, HWWS ’04. Grenoble, France

  14. 14.

    Kusnadi L, Dharma D, Manaf A (2017) Material point method based fluid simulation optimization on GPU with CUDA. In: International conference on advanced informatics, concepts, theory, and applications (ICAICTA).

  15. 15.

    Madera FA, Moo-Mena FJ, Montalvo JRG (2020) Sphere polygon interaction to fill volume objects objects. Ventana Inform 40:131–144

    Google Scholar 

  16. 16.

    OpenGL (2021) The Industry’s Foundation for High Performance Graphics (accessed in April 2021).

  17. 17.

    Ren D, Lee B, Höllerer Tobias (2017) Stardust: accessible and transparent GPU support for information visualization rendering. Comput Graph Forum 36(3):179–188.

    Article  Google Scholar 

  18. 18.

    Winchenbach R, Hochstetter H, Kolb A (2016) Constrained neighbor lists for SPH-based fluid simulations. In: Proceedings of the ACM SIGGRAPH/Eurographics symposium on computer animation (SCA ’16). Eurographics Association, Goslar, DEU, 49–56

Download references

Author information



Corresponding author

Correspondence to F. A. Madera-Ramirez.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Madera-Ramirez, F.A., Lopez-Martinez, J.L., Moo-Mena, F. et al. CPU–GPU buffer communication using compute shader to fill volumes with spheres. J Supercomput (2021).

Download citation


  • Compute shader
  • Particle parallel algorithm
  • CPU–GPU communication