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.

60 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. Source
  26. 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

  27. 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

  28. flower crown

    Fantastic blog post.Really thank you! Really Great.

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

  29. akwam

    Wow, great post. Cool.

    https://www.akwam.network/

  30. Yoga

    Awesome article post.Thanks Again. Cool.

    https://thesilverproductsblog.blogspot.com

  31. Abundance

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

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

  32. Kelvin Kaemingk

    Thanks so much for the blog. Cool.

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

  33. 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

  34. delta8 softgels

    Major thankies for the post. Keep writing.

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

  35. realistic cumming dildo

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

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

  36. 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

  37. garden patio

    I cannot thank you enough for the blog. Awesome.

    https://homesupply.shop/collections/bathroom

  38. Holistic

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

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

  39. 토토사이트 검증

    Awesome post.Thanks Again.

    https://peatix.com/user/11706978

  40. rxce

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

    https://rxce.app/

  41. Home survey

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

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

  42. jakuzili süit oda istanbul

    wow, awesome article. Great.

    https://www.macityhotel.com/deluxe

  43. Download Lagu Mp3 Still Life Bigbang

    Very informative post.Thanks Again.

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

  44. Holistic
  45. laundry renovations melbourne

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

    https://kitchendesignperth.com.au/

  46. donlod lagu

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

    https://zippyshare.com/tilecat68

  47. 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/

  48. 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

  49. HORNADY MATCH 6.5 PRC

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

    https://discountammowarehouse.com/

  50. rysupaudio

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

    https://rysupaudio.com/

  51. 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

  52. legit fake ids

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

    https://www.a3fakeid.com/

  53. fag bearing

    Enjoyed every bit of your article post. Keep writing.

    https://www.adyrbearing.com/

  54. 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

  55. adam and eve g spot vibrator

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

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

  56. how to fix blue balls

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

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

  57. rummy wealth apk

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

    https://rummywealth.app/

  58. rxce apk

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

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

  59. 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