- Hands-On GPU Programming with Python and CUDA
- Dr. Brian Tuomanen
- 239字
- 2021-06-10 19:25:39
Getting Started with PyCUDA
In the last chapter, we set up our programming environment. Now, with our drivers and compilers firmly in place, we will begin the actual GPU programming! We will start by learning how to use PyCUDA for some basic and fundamental operations. We will first see how to query our GPU—that is, we will start by writing a small Python program that will tell us what the characteristics of our GPU are, such as the core count, architecture, and memory. We will then spend some time getting acquainted with how to transfer memory between Python and the GPU with PyCUDA's gpuarray class and how to use this class for basic computations. The remainder of this chapter will be spent showing how to write some basic functions (which we will refer to as CUDA Kernels) that we can directly launch onto the GPU.
The learning outcomes for this chapter are as follows:
- Determining GPU characteristics, such as memory capacity or core count, using PyCUDA
- Understanding the difference between host (CPU) and device (GPU) memory and how to use PyCUDA's gpuarray class to transfer data between the host and device
- How to do basic calculations using only gpuarray objects
- How to perform basic element-wise operations on the GPU with the PyCUDA ElementwiseKernel function
- Understanding the functional programming concept of reduce/scan operations and how to make a basic reduction or scan CUDA kernel
- 30天自制操作系統(tǒng)
- Mastering vRealize Operations Manager(Second Edition)
- Windows Server 2019 Cookbook
- Social Media Mining with R
- Linux內(nèi)核完全注釋?zhuān)?0周年版·第2版)
- Instant Optimizing Embedded Systems using Busybox
- 注冊(cè)表應(yīng)用完全DIY
- RHCSARHCE 紅帽Linux認(rèn)證學(xué)習(xí)指南(第7版)EX200 & EX300
- 分布式系統(tǒng)設(shè)計(jì)實(shí)踐
- 精解Windows 10
- Mastering Windows 8 C++ App Development
- Drupal 7 Cookbook
- 鴻蒙HarmonyOS手機(jī)應(yīng)用開(kāi)發(fā)實(shí)戰(zhàn)
- VMware Horizon Mirage Essentials
- OpenHarmony開(kāi)發(fā)與實(shí)踐:基于紅莓RK2206開(kāi)發(fā)板