Learn to use a CUDA to dramatically speed up code in Python

Python Book

The first thing to understand is that normal Python code cannot use GPU acceleration, only programs designed for the GPU can be run on the GPU. Hardware acceleration must be implemented in hardware language.

GPU concept correlation
Graphics Processing Unit (GPU) : a visual processor or Graphics display card.

GPU is responsible for rendering 2D, 3D and VR effects, mainly focusing on computer graphics and image field. Gpus have since been found to be well suited for parallel computing, speeding up modern scientific computing and moving beyond games and video.

No matter CPU or GPU, it is necessary to use Core (ALU+ register) to do arithmetic logic operation when performing calculation.

A core can only perform a certain task sequentially. In order to process more tasks in parallel at the same time, chip companies have developed a multi-core architecture. As long as there is no dependence between each other, each core does its own thing and the multi-cores do not interfere with each other, the effect of parallel computing can be achieved.

The limitations of the CPU
A PC CPU has only 2 to 8 cores, and a data server only has 20 to 40 cores, while a GPU has thousands of cores.

However, the CPU and GPU core are not the same, the GPU core can only focus on certain features of the task, while the CPU core has a wider range of computing power.

The CPU is more general, playing a role of coordination and management, while the GPU is limited to computing specific tasks.

The CPU reads and writes data from Main Memory and interacts with the GPU through the Bus.

In addition to many computing cores, gpus also have their own independent storage, called video memory.

GPU core in the calculation, can only directly read and write data from the video memory, programmers need to specify in the code which data need to be copied between memory and video memory, these data transmission is on the bus, so the bus (NVLink technology, PCI-E technology…) Transmission speed and bandwidth can also be bottlenecks for some computing tasks.

Because CPU and GPU are separate, in Nvidia's design philosophy, CPU and main memory are called hosts and GPU is called Device.

Use a combination of CPU and GPU to speed up computation, also known as heterogeneous computing.

The Summit, the world's no. 1 supercomputer, uses 9,216 IBM POWER9 cpus and 27,648 Nvidia Tesla Gpus.

When GPU is introduced, the calculation process becomes:

Class and copy the necessary data to the graphics memory of the GPU device.
The CPU invokes the GPU function to enable multiple GPU cores to compute at the same time.
CPU and GPU perform asynchronous computing.
Copy the GPU calculation result back to the host to obtain the calculation result.

The basic flow of CUDA programming is as follows:

Class and copy the necessary data to the graphics memory of the GPU device.
CUDA kernel functions are called with some granularity of parallelism using an execution configuration.
The CPU and GPU perform asynchronous computing.
Copy the GPU calculation results back to the host.

64 comments

  1. Abertpails

    коли закінчиться війна в україні 2022 скільки може тривати війна в україні в той день коли закінчиться війна

  2. Abrtpails
  3. Abrtpails
  4. Abrtpails
  5. Abrtpails
  6. auto detailing overland park

    Say, you got a nice blog.Much thanks again. Keep writing.

    http://mobileautodetailingkc.com

  7. Abrtpails
  8. Abrtpails
  9. Abrtpails
  10. Abrtpails
  11. Abrtpails
  12. Abrtpails
  13. Abrtpails
  14. Abrtpails
  15. Abrtpails
  16. Abrtpails
  17. Abrtpails
  18. Abrtpails
  19. Abrtpails
  20. Abrtpails
  21. Abrtpails
  22. ambbet

    Im obliged for the article.Much thanks again. Really Cool.

    https://amb19.com/

  23. perth web design
  24. purple venus butterfly

    Im grateful for the post.Much thanks again. Really Great.

    https://www.youtube.com/watch?v=vBq0Lzyopuc

  25. card shop

    FRESHCC.RU - Best auto shop 2021,Trusted Cvv Shop,Sell fresh cvv, Valid cc, Cvv Store,Buy cc online,Cvv fullz.

    https://freshcc.ru/login.aspx

  26. Source
  27. Holistic Health

    Enjoyed every bit of your blog post.Much thanks again. Awesome.

    https://www.lifetechnology.com/products/the-tesla-shield-ultimate-power-version-1-0

  28. how to mold his penis using a dildo with balls

    I am so grateful for your blog article.Much thanks again. Much obliged.

    https://www.youtube.com/watch?v=33VK2KBZ08w

  29. feetfinder reviews online

    Muchos Gracias for your blog post.Much thanks again. Great.

    https://www.youtube.com/watch?v=cIB669f4T6M

  30. flower crown

    Fantastic blog post.Really thank you! Really Great.

    https://www.hjyhyn.com/collections/flower-crown

  31. akwam

    Wow, great post. Cool.

    https://www.akwam.network/

  32. Yoga

    Awesome article post.Thanks Again. Cool.

    https://thesilverproductsblog.blogspot.com

  33. Abundance

    I appreciate you sharing this article post.Really thank you! Really Great.

    https://www.lifetechnology.com/blogs/life-technology-medical-news

  34. Kelvin Kaemingk

    Thanks so much for the blog. Cool.

    https://www.facebook.com/kelvin.kaemingk

  35. https://s3.amazonaws.com/potchefstroom1/tree-felling/index.html

    Enjoyed every bit of your blog. Keep writing.

    https://s3.amazonaws.com/potchefstroom1/tree-felling/index.html

  36. bandar slot online

    I really like and appreciate your blog article.Really thank you! Cool.

    https://www.pasaangkit.com/wp-includes/daftar-situs-judi-slot-online/

  37. delta8 softgels

    Major thankies for the post. Keep writing.

    https://amazing.money/cbd-oils-edibles-vapes/

  38. realistic cumming dildo

    I really like and appreciate your post.Really thank you! Fantastic.

    https://www.youtube.com/watch?v=ZiS_-gRDwMk

  39. mold inspection greenville sc

    Major thankies for the blog post.Really thank you! Keep writing.

    https://yellow.place/en/greenville-mold-pros-mold-remediation-greenville-sc-usa

  40. garden patio

    I cannot thank you enough for the blog. Awesome.

    https://homesupply.shop/collections/bathroom

  41. Holistic

    A round of applause for your blog post.Really thank you! Really Cool.

    https://thecryptocurrencynewsblog.blogspot.com/feeds/posts/default

  42. 토토사이트 검증

    Awesome post.Thanks Again.

    https://peatix.com/user/11706978

  43. rxce

    wow, awesome article post.Much thanks again. Will read on...

    https://rxce.app/

  44. Home survey

    Thanks-a-mundo for the article.Thanks Again. Want more.

    http://www.jamesonconsult.co.uk/

  45. jakuzili süit oda istanbul

    wow, awesome article. Great.

    https://www.macityhotel.com/deluxe

  46. Download Lagu Mp3 Still Life Bigbang

    Very informative post.Thanks Again.

    http://hf2sdn.com/home.php?mod=space&uid=168706

  47. Holistic
  48. laundry renovations melbourne

    This is one awesome blog post.Really looking forward to read more. Much obliged.

    https://kitchendesignperth.com.au/

  49. donlod lagu

    Very good blog.Really thank you! Will read on...

    https://zippyshare.com/tilecat68

  50. which is basically a bet

    Enjoyed every bit of your blog post.Really looking forward to read more. Really Cool.

    https://3655968.com/how-to-make-the-most-of-your-online-gambling-experience/

  51. source

    I think this is a real great article.Really thank you! Keep writing.

    https://www.cnatrainingexperts.com/taking-the-first-steps-to-improve-your-cna-salary/

  52. aplikasi penghasil uang

    Having read this I thought it was rather informative. I appreciate you spending some time and effort to put this content together. I once again find myself spending a lot of time both reading and leaving comments. But so what, it was still worthwhile.

    https://coderwall.com/p/kszkgw/cara-menciptakan-uang-melalui-internet

  53. HORNADY MATCH 6.5 PRC

    This is one awesome blog.Much thanks again. Want more.

    https://discountammowarehouse.com/

  54. rysupaudio

    I appreciate you sharing this article post.Really thank you! Awesome.

    https://rysupaudio.com/

  55. download lagu

    I seriously love your website.. Pleasant colors & theme. Did you make this web site yourself? Please reply back as I’m trying to create my very own site and would like to know where you got this from or just what the theme is named. Many thanks!

    https://orangetv.co.id/download/dj-gam-gam-piri.html

  56. legit fake ids

    I value the article.Much thanks again. Much obliged.

    https://www.a3fakeid.com/

  57. fag bearing

    Enjoyed every bit of your article post. Keep writing.

    https://www.adyrbearing.com/

  58. best stroker for men

    Thanks for sharing, this is a fantastic article post.Really thank you! Really Cool.

    https://www.youtube.com/watch?v=jtfQFdM5-cE

  59. adam and eve g spot vibrator

    Thanks again for the article.Much thanks again. Want more.

    https://www.youtube.com/watch?v=zyiaa8OkdzU

  60. how to fix blue balls

    I am so grateful for your article.Thanks Again. Great.

    https://www.youtube.com/watch?v=IE23EGdQxW8

  61. rummy wealth apk

    I loved your article post.Really looking forward to read more. Really Great.

    https://rummywealth.app/

  62. rxce apk

    I cannot thank you enough for the blog. Keep writing.

    https://techbiote.com/rxce-app-download-referral-code/

  63. rummy gold

    Thanks for sharing, this is a fantastic blog post.Really looking forward to read more.

    https://rummygold.app/

评论已关闭。

Related recommendation

No related articles!

微信扫一扫,分享到朋友圈

Learn to use a CUDA to dramatically speed up code in Python