官术网_书友最值得收藏!

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

主站蜘蛛池模板: 循化| 千阳县| 昌乐县| 平果县| 霍山县| 彝良县| 甘孜| 渭南市| 寿阳县| 东乡县| 百色市| 秭归县| 浮梁县| 广水市| 白山市| 阳曲县| 东阿县| 周至县| 晋中市| 丘北县| 永平县| 凤凰县| 安多县| 清流县| 正定县| 江口县| 东明县| 庄浪县| 怀来县| 遵义市| 澄江县| 旌德县| 湖州市| 集贤县| 卢湾区| 隆尧县| 闵行区| 仁化县| 察哈| 密山市| 仪陇县|