Skip to main content

Memory Optimized Dynamic Matrix Chain Multiplication Using Shared Memory in GPU

  • Conference paper
  • First Online:
Distributed Computing and Internet Technology (ICDCIT 2021)

Part of the book series: Lecture Notes in Computer Science ((LNISA,volume 12582))

Abstract

Number of multiplications needed for Matrix Chain Multiplication of \( n \) matrices depends not only on the dimensions but also on the order to multiply the chain. The problem is to find the optimal order of multiplication. Dynamic programming takes \( O\left( {n^{3} } \right) \) time, along with \( O\left( {n^{2} } \right) \) space in memory for solving this problem. Now-a-days, Graphics Processing Unit (GPU) is very useful to the developers for parallel programming using CUDA computing architecture. The main contribution of this paper is to recommend a new memory optimized technique to solve the Matrix Chain Multiplication problem in parallel using GPU, mapping diagonals of calculation tables \( m[][] \) and \( s[][] \) into a single combined calculation table of size \( O\left( {n^{2} } \right) \) for better memory coalescing in the device. Besides optimizing the memory requirement, a versatile technique of utilizing Shared Memory in Blocks of threads is suggested to minimize time for accessing dimensions of matrices in GPU. Our experiment shows best ever Speedup as compared to sequential CPU implementation, run on large problem size.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 3rd edn. MIT Press and PHI, New Delhi (2012)

    MATH  Google Scholar 

  2. Nishida, K., Ito, Y., Nakano, K.: Accelerating the dynamic programming for the matrix chain product on the GPU. In: Second International Conference on Networking and Computing, pp. 320–326 (2011)

    Google Scholar 

  3. NVIDIA, CUDA C Programming Guide Version 4.2 (2012). https://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/CUDA_C_Programming_Guide.pdf. Accessed 22 Jun 2020

  4. Wani, M.A., Quadri, S.M.K.: Accelerated dynamic programming on gpu: a study of speed up and programming approach. In: Int. J. Comput. Appl., 0975–8887 (2013)

    Google Scholar 

  5. NVIDIA, CUDA ZONE. https://developer.nvidia.com/cuda-zone. Accessed 12 Jul 2020

  6. Fauzia, N., Pouchet, L.N., Sadayappan, P.: Characterizing and enhancing global memory data coalescing on GPUs. In: IEEE/ACM International Symposium on Code Generation and Optimization (2015)

    Google Scholar 

  7. Whitepaper NVIDIA’s Next Generation CUDATM Compute Architecture: FermiTM. https://www.nvidia.com/content/PDF/fermi_white_papers/NVIDIA_Fermi_Compute_Architecture_Whitepaper.pdf. Accessed 15 Jul 2020

  8. Ito, Y., Nakano, K.: A GPU implementation of dynamic programming for the optimal polygon triangulation. IEICE Trans. Inf. Syst., D(12), 2596–2603 (2013)

    Google Scholar 

  9. Pimple, M.R., Sathe, S.R.: Analysis of resource utilization on GPU. Int. J. Adv. Comput. Sci. Appl., 10(2) (2019)

    Google Scholar 

  10. Bergeron, J.P.: Programming of shared memory GPUs shared memory systems, University of Ottawa (2011)

    Google Scholar 

  11. NVIDIA, DEVELOPER ZONE. https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html#shared-memory. Accessed 26 Jul 2020

  12. NVIDIA, Shared memory bank conflicts with byte arrays. https://forums.developer.nvidia.com/t/shared-memory-bank-conflicts-with-byte-arrays/20553/4. Accessed 26 Jul 2020

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Girish Biswas .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Biswas, G., Mukherjee, N. (2021). Memory Optimized Dynamic Matrix Chain Multiplication Using Shared Memory in GPU. In: Goswami, D., Hoang, T.A. (eds) Distributed Computing and Internet Technology. ICDCIT 2021. Lecture Notes in Computer Science(), vol 12582. Springer, Cham. https://doi.org/10.1007/978-3-030-65621-8_10

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-65621-8_10

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-65620-1

  • Online ISBN: 978-3-030-65621-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics