<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Books on Programming Massively Parallel Processors (5th Edition)</title>
    <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/</link>
    <description>Recent content in Books on Programming Massively Parallel Processors (5th Edition)</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    
    
    
      
    
    
      <atom:link href="https://codingpracticegroup.github.io/pmpp5-zh/en/book/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
        <title>Appendix C CUDA memories, address spaces, and pointers</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/32-chc/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/32-chc/</guid>
        <description>&lt;h1 id=&#34;cC&#34;&gt;Appendix C CUDA memories, address spaces, and pointers&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;APPENDIX&lt;/p&gt;&#xA;&lt;p&gt;CUDA memories, address spaces, and pointers C With special contributions from Isaac Gelado and Mark Harris Throughout this book, we have mostly assumed a fairly simple model of interaction between the host and the device in a heterogeneous computing system. In this simple model, as presented in Chapter 2, each device has a device memory (CUDA global memory) that is separate from the host memory, or the system memory. The data to be processed by a kernel running on a device need to be transferred from the host memory to the device memory by calling the cudaMemcpy() function. The data produced by the device also need to be transferred from the device memory to the host by calling the cudaMemcpy() function before it can be utilized by the host. Early GPU generations only supported this simple host/device interaction model. Although the model is simple and easy to understand, it has resulted in several problems at the application level. First, I/O devices such as disk controllers and network interface cards are designed to operate efficiently on the host memory. Since the device memory is separate from the host memory, input data need to be transferred from the host memory to the device memory and output data need to be transferred from the device memory to the host memory for use by I/O devices. Such additional transfers increase the I/O latency and reduce the achievable I/O throughput. For many applications, the ability of I/O devices to operate directly on the device memory would improve overall application performance and simplify the application code. Second, traditional programming systems such as Python place their application data structures in the host memory. Some of the data structures are large. The device memory in CUDA-enabled GPUs tends to offer higher bandwidth but smaller capacity compared to the host memory, which forces application developers to partition their large data structures into chunks that each fit into the device memory. For example, in Chapter 21, the 3D electrostatic energy grid array was partitioned into 2D slices that are transferred between the host memory and the device memory. For many applications, it would be much better if entire data structures can reside in the device memory. For some applications, there may not even be a good way to partition the data structure into smaller chunks. For these applications, it would be best if the GPU can directly access the data in the host memory or have the CUDA runtime system software to migrate the data that are used during kernel execution. As more applications adopted GPU computing, their needs motivated CUDA system software developers and GPU hardware designers to provide a better solution. Researchers have been aware of these needs and have proposed solutions since the early days of CUDA [1]. The rest of this section will go over a brief history of advancements that address these limitations.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Appendix B Deep learning basics</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/31-chb/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/31-chb/</guid>
        <description>&lt;h1 id=&#34;cB&#34;&gt;Appendix B Deep learning basics&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;APPENDIX&lt;/p&gt;&#xA;&lt;p&gt;Deep learning basics&lt;/p&gt;&#xA;&lt;p&gt;B&lt;/p&gt;&#xA;&lt;p&gt;With special contributions from Carl Pearson and Boris Ginsburg Machine learning, a term coined by Arthur Samuel of IBM in 1959 [1], is a field of computer science which studies methods for learning application logic from data rather than designing explicit algorithms. Machine learning is most successful in computing tasks where designing explicit algorithms is infeasible, mostly because there is not enough knowledge in the design of such explicit algorithms. That is, one can give examples on what should happen in various situations but not general rules for making such decisions for all possible inputs. For example, machine learning has contributed to the recent improvements in application areas such as automatic speech recognition, computer vision, natural language processing, and recommender systems. In these application areas, one can provide many input examples and what should come out for each input, but there is no algorithm that can correctly process all possible inputs. The kinds of application logic created with machine learning can be organized according to the types of tasks that they perform. There is a wide range of machine learning tasks. Here we show a few out of a large number: • Classification &amp;ndash; to determine to which of the k categories an input belongs. An example is object recognition: which type of food is shown in this photo? • Regression &amp;ndash; to predict a numerical value given some inputs. An example is to predict the price of a stock at the end of the next trading day. • Transcription &amp;ndash; to convert unstructured data into textual form. An example is optical character recognition. • Translation &amp;ndash; to convert a sequence of symbols in one language to a sequence of symbols in another. An example is translating from English to Chinese. • Embedding &amp;ndash; to convert an input to a vector while preserving relationships between entities. An example is to convert a natural language sentence into a multidimensional vector. The readers are referred to a large body of literature on the mathematical background and practical solutions to the various tasks of machine learning. The purpose of this appendix is to introduce the computation kernels involved in the neural network approach to the classification task. A concrete understanding of these kernels will allow the reader to understand and develop kernels for deep learning approaches to other machine learning tasks. As such, in the next section, we will go into details of the classification task to establish the background knowledge needed to understand neural networks.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Appendix A Numerical considerations</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/30-cha/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/30-cha/</guid>
        <description>&lt;h1 id=&#34;cA&#34;&gt;Appendix A Numerical considerations&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;In the early days of computing, floating-point arithmetic capability was found only in mainframes and supercomputers. Although many microprocessors designed in the 1980’s started to have floating-point coprocessors, their floating-point arithmetic speed was extremely slow, about three orders of magnitude slower than that of mainframes and supercomputers. With advances in microprocessor technology, many microprocessors designed in the 1990’s, such as Intel Pentium III and AMD Athlon, started to have high performance floating-point capabilities that rival supercomputers. High speed floating-point arithmetic has become a standard feature for microprocessors and GPUs today. More recently, in response to the unsatisfiable demand for high-speed floating-point arithmetic from LLM training and inference use cases, GPUs have dramatically increased the throughput of their floating-point throughput. Floating-point representation allows for larger dynamic range of representable data values and more precise representation of tiny data values than its integer counterpart. These desirable properties make floating-point preferred data representative for modeling the physical and artificial phenomena, such as combustion, aerodynamics, light illumination, and financial risks [1]. Large scale evaluation of these models has been driving the need for parallel computing. As a result, it is important for application programmers to understand the nature of floating-point arithmetic in developing their parallel applications. In particular, we will focus on the accuracy of floating-point arithmetic operations, the precision of floating-point number representation, the stability of numerical algorithms and how they should be taken into consideration in parallel programming.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 24 Conclusion and future outlook</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/24-ch24/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/24-ch24/</guid>
        <description>&lt;h1 id=&#34;c24&#34;&gt;Chapter 24 Conclusion and future outlook&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Conclusion and future outlook&lt;/p&gt;&#xA;&lt;p&gt;CONTENTS 24.1 Goals revisited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577 24.2 Future outlook. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578 You made it! We have arrived at the finishing line. In this final chapter, we will briefly review the learning goals that you have achieved through this book. Instead of drawing a conclusion, we will offer our vision for the future of massively parallel computing and how its advancements will impact the future course of science and technology.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 23 Multi-GPU programming</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/23-ch23/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/23-ch23/</guid>
        <description>&lt;h1 id=&#34;c23&#34;&gt;Chapter 23 Multi-GPU programming&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Multi-GPU programming And an introduction to MPI, NCCL, and NVSHMEM With special contributions from Jiri Kraus and Isaac Gelado CONTENTS 23.1 Stencil as a running example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 23.2 Multi-GPU stencil with MPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 23.3 Overlapping computation and communication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 23.4 Multi-GPU stencil with NCCL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563 23.5 Multi-GPU stencil with NVSHMEM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 23.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574 23.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 So far, we have focused on programming a heterogeneous computing system with one host and one device. However, many applications require the aggregate computing power of multiple hosts and devices. Many clusters and data centers today have one or more hosts and one or more devices attached to each host. In this chapter, we look at three programming models for programming clusters with multiple GPUs: the Message Passing Interface (MPI) [1], the NVIDIA Collective Communications Library (NCCL) [2], and the NVIDIA OpenSHMEM Library (NVSHMEM) [3]. We only present the key concepts from each programming model that a programmer needs to understand in order to scale their heterogeneous applications to multiple GPUs and nodes in a cluster environment. We focus on domain partitioning, point-topoint communication, collective communication, and overlapping computation and communication in the context of scaling a CUDA stencil computation across multiple GPU nodes. The implementations presented are intended to illustrate the core principles behind each programming model and can each be further optimized within their respective programming models. Readers are encouraged to refer to tutorials and application case studies of each of the three programming models for a more extensive coverage of the full capabilities of each model once they master the concepts in this chapter. Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00034-2&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00034-2&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 22 Algorithm selection, problem decomposition, and problem formulation</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/22-ch22/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/22-ch22/</guid>
        <description>&lt;h1 id=&#34;c22&#34;&gt;Chapter 22 Algorithm selection, problem decomposition, and problem formulation&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Algorithm selection, problem decomposition, and problem formulation CONTENTS 22.1 Algorithm selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 22.2 Problem decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 22.3 Application level considerations &amp;ndash; Amdahl’s law . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 22.4 Problem formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538 22.5 Batching: latency vs. throughput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 22.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 We have so far concentrated on practical knowledge in parallel programming, which consists of CUDA programming features, the GPU architecture, performance optimization techniques, parallel patterns, and application case studies. In this chapter, we switch our discussions to concepts that are more abstract. We first generalize parallel programming into a thinking process of designing/selecting parallel algorithms and decomposing a domain problem into well-defined and coordinated parallel work units that can each be efficiently performed by the selected algorithms. With good algorithm selection and problem decomposition, the programmer can achieve an appropriate compromise between parallelism, work efficiency, and resource consumption. A strong combination of domain knowledge and parallel thinking skills is often needed for creating successful computational solutions to challenging domain problems. With strong parallel thinking skills, a parallel programmer does not need to be confined to the role of solving domain problems handed down by domain scientists. Rather, the programmer can collaborate with domain scientists to analyze and transform the structure of a domain problem: which parts are inherently serial, which parts are amenable to high-performance parallel execution, and the domain-specific tradeoffs involved in moving parts from the former category to the latter. This chapter gives the reader more insight into parallel programming and parallel thinking in general. Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00033-0&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00033-0&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 21 Electrostatic potential map</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/21-ch21/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/21-ch21/</guid>
        <description>&lt;h1 id=&#34;c21&#34;&gt;Chapter 21 Electrostatic potential map&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Electrostatic potential map&lt;/p&gt;&#xA;&lt;p&gt;With special contributions from John Stone CONTENTS 21.1 Background. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 21.2 Scatter vs. gather in kernel design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 21.3 Thread coarsening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 21.4 Memory coalescing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 21.5 Cutoff binning for data size scalability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 21.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527 21.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 In this chapter, we use a molecular dynamics application based on regular grid data structures to illustrate the use of optimization techniques that achieve global memory access coalescing and improved computation throughput. We present a series of implementations of an electrostatic potential map calculation kernel, with each version improving upon the previous one. Each version adopts one or more practical techniques from Chapter 6. Some of the techniques are in common with the previous chapters but some are different: gather-to-scatter transformation, systematic reuse of computational results, and fast boundary condition checking. The effective use of these practical techniques can significantly improve application speed.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 20 Large language models</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/20-ch20/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/20-ch20/</guid>
        <description>&lt;h1 id=&#34;c20&#34;&gt;Chapter 20 Large language models&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Large language models&lt;/p&gt;&#xA;&lt;p&gt;With special contributions from Juan Gómez-Luna CONTENTS 20.1 Transformer architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478 20.2 Multi-head attention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 20.3 Implementing attention in CUDA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486 20.4 KV caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 20.5 Flash attention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 20.6 KV cache arithmetic intensity and memory requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504 20.7 Alleviating the memory requirements of the attention mechanism. . . . . . . . . . . . . . . . . . . . 508 20.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510 20.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 Before Google Researchers introduced Transformers [1] in 2017, language tasks had been predominantly based on statistical language modeling techniques pioneered by IBM (e.g., [2]). In 2018, Google introduced the BERT language model based on Transformers and achieved unprecedented results in natural language tasks. Since then, the Transformer architecture1 has become the backbone of the deep learning approaches to natural language processing (NLP) based on neural networks. Since then, LLMs have captured the attention of the industry and advanced rapidly, demonstrating human-level performance in diverse tasks such as text generation, summarization, translation, and conversation. These language models have grown by orders of magnitude in size compared to BERT to accommodate more training data. The term Large Language Models (LLMs) has been coined to distinguish them from previous generations of language models. While LLMs were originally developed to process and generate information in text form, multi-modal models (i.e., trained with and used for different types of visual, audio, and other types of data such as scientific data) started to appear. The core idea of LLMs is to predict the next token (e.g., a word, sub-word, character) given a sequence of previous tokens. In chatbot applications such as OpenAI 1 In this chapter, the term &lt;code&gt;architecture&#39;&#39; refers to &lt;/code&gt;neural network architecture&amp;rsquo;&amp;rsquo;, not ``hardware architec ture&amp;rsquo;&amp;rsquo; as we do through the rest of the book. Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00031-7&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00031-7&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 19 Convolutional neural networks</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/19-ch19/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/19-ch19/</guid>
        <description>&lt;h1 id=&#34;c19&#34;&gt;Chapter 19 Convolutional neural networks&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;With special contributions from Juan Gómez-Luna CONTENTS 19.1 Convolutional neural networks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 19.2 A CUDA convolutional layer kernel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 19.3 Formulating convolutional layer as GEMM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 19.4 CUDNN library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 19.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 19.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Deep learning [1] is a branch of the machine learning discipline whose studies give computers the ability to learn to perform certain tasks without being explicitly programmed. Machine learning for a task starts with a human developer architecting a parameterized model for given datasets that explicitly or implicitly specify the expected action for each input instance. The model parameters are ``learned&amp;rsquo;&amp;rsquo; by processing the datasets. The complexity and size of the machine learning models can vary widely based on the task being performed and the size of the datasets used. Deep learning models are designed for complex tasks, such as human facial recognition and natural language processing, whose expected actions can only be captured with and learned from datasets with massive numbers of examples. These models typically employ a deep hierarchy of classifiers that consist of a massive number of parameters to learn a large number of complex features. Thus, they can achieve more accurate pattern recognition results if there is enough training data to allow the system to properly learn the parameter values of all the layers of feature extractors in the model to automatically discover an adequate number of relevant patterns. While machine learning has existed as a subject of computer science for a long time and has been applied successfully to automate many simple, routine tasks, its deep learning branch had stayed dormant for decades because of the lack of massive datasets and the computing power needed to learn the values of the large number of model parameters from the massive datasets. Since 2012, deep learning based on multi-layer Artificial Neural Networks has gained a great deal of industry attention for two reasons. The first reason is the massive datasets available for training deep learning models from the pervasive use of the internet by both consumers and businesses. The second reason is the availability of ample computing power in GPU Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00030-5&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00030-5&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 18 Graph traversal</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/18-ch18/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/18-ch18/</guid>
        <description>&lt;h1 id=&#34;c18&#34;&gt;Chapter 18 Graph traversal&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Graph traversal&lt;/p&gt;&#xA;&lt;p&gt;With special contributions from John Owens and Juan Gómez-Luna CONTENTS 18.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 18.2 Breadthfirst search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 18.3 Vertex-centric parallelization of BFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 18.4 Edge-centric parallelization of BFS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 18.5 Improving work efficiency with frontiers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 18.6 Reducing contention with privatization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 18.7 Reducing launch overhead with cooperative groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 18.8 Other optimizations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 18.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 18.10 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 A graph is a data structure that represents the relations between entities. The entities involved are represented as vertices and the relations are represented as edges. Many important real-world problems are naturally formulated as large-scale graph problems and can benefit from massively parallel computation. Prominent examples include social networks and driving direction map services. There are multiple strategies for parallelizing graph computations, some of which are centered on processing vertices in parallel while others are centered on processing edges in parallel. Graphs are intrinsically related to sparse matrices because graph adjacency matrices tend to be very sparse. Graph computation can be formulated in terms of sparse matrix operations on square matrices. However, one can often improve the efficiency of graph computation by exploiting properties that are specific to the type of graph computation being performed. In this chapter, we will focus on breadth first search, a graph traversal computation that underlies many real-world applications.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 17 Sparse matrix computation</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/17-ch17/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/17-ch17/</guid>
        <description>&lt;h1 id=&#34;c17&#34;&gt;Chapter 17 Sparse matrix computation&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Sparse matrix computation&lt;/p&gt;&#xA;&lt;p&gt;CONTENTS 17.1 Background. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 17.2 A simple SpMV kernel with the COO format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 17.3 Grouping row non-zeros with the CSR format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 17.4 Improving memory coalescing with the ELL format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 17.5 Regulating padding with the hybrid ELL-COO format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 17.6 Reducing control divergence with the JDS format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 17.7 Column-wise accessibility with the CSC format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 17.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 17.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 Our next parallel pattern is sparse matrix computation. In a sparse matrix, the majority of the elements are zeros. Storing and processing these zero elements are wasteful in terms of memory capacity, memory bandwidth, time, and energy. Many important real-world problems involve sparse matrix computation. Due to the importance of these problems, several sparse matrix storage formats and their corresponding processing methods have been developed and are widely used in the field. All these methods employ some type of compaction techniques to avoid storing or processing zero elements at the cost of introducing some level of irregularity into the data representation. Unfortunately, such irregularity can lead to underutilization of memory bandwidth, control flow divergence, and load imbalance in parallel computing. It is therefore important to strike a good balance between compaction and regularization. Some storage formats achieve a high level of compaction at a high level of irregularity. Others achieve a more moderate level of compaction while keeping the representation more regular. The relative performance of a parallel computation using each storage format is known to be heavily dependent on the distribution of non-zero elements in the sparse matrices. Understanding the wealth of work in sparse matrix storage formats and their corresponding parallel algorithms gives a parallel programmer important background for addressing compaction and regularization challenges in solving related problems. Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00028-7&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00028-7&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 16 Dynamic programming and wavefront parallelism</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/16-ch16/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/16-ch16/</guid>
        <description>&lt;h1 id=&#34;c16&#34;&gt;Chapter 16 Dynamic programming and wavefront parallelism&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Wavefront parallelism is an algorithmic technique for exploiting data parallelism in applications with data dependencies along space and/or time dimensions. In this chapter, we study wavefront parallelism in the context of dynamic programming applications. Dynamic programming represents a class of problems that can be solved by dividing a problem into smaller sub-problems. The solution to the original problem can be found by assembling the solutions found for the sub-problems. Parallelizing dynamic programming algorithms on GPUs entails interesting challenges in terms of hardware utilization and synchronization across threads. In this chapter, we discuss these challenges and present software techniques that address them efficiently.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 15 Advanced optimizations for matrix multiplication</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/15-ch15/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/15-ch15/</guid>
        <description>&lt;h1 id=&#34;c15&#34;&gt;Chapter 15 Advanced optimizations for matrix multiplication&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Advanced optimizations for matrix multiplication CONTENTS 15.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 15.2 Data reuse analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 15.3 Using larger tiles with thread coarsening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 15.4 Register tiling of the input tiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 15.5 Coalesced storing of the output tile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 15.6 Eliminating bank conflicts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 15.7 Occupancy considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 15.8 Software pipelining. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 15.9 Specialized software and hardware support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 15.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 15.11 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 Matrix multiplication is an important operation in science, engineering, and graphics applications. Due to its high computation complexity, it exhibits a high degree of data reuse and thus significant optimization opportunities. In Chapter 3, we used matrix multiplication as an example of mapping multi-dimensional grids to data. Subsequently, in Chapter 5, we used matrix multiplication as an example of using shared memory tiling to reduce global memory accesses. In this chapter, we will dive more deeply into matrix multiplication and the advanced optimizations for this important computation on the GPU architecture.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 14 Sorting</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/14-ch14/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/14-ch14/</guid>
        <description>&lt;h1 id=&#34;c14&#34;&gt;Chapter 14 Sorting&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Sorting&lt;/p&gt;&#xA;&lt;p&gt;With special contributions from Michael Garland CONTENTS 14.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 14.2 Parallel odd-even sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 14.3 Parallel merge sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 14.4 Radix sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 14.5 Parallel radix sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 14.6 Optimizing for memory coalescing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 14.7 Choice of radix value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 14.8 Thread coarsening to improve coalescing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 14.9 Other parallel sort methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 14.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 14.11 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 Sorting algorithms place the data elements of a list into a certain order. Sorting is foundational to modern data and information services since the computational complexity of retrieving information from data sets can be significantly reduced if the data set is in proper order. For example, sorting is often used to canonicalize the data for fast comparison and reconciliation between data lists. Also, the efficiency of many data processing algorithms can be improved if the data is in a certain order. Due to their importance, efficient sorting algorithms have been the subject of many computer science research efforts. Even with these efficient algorithms, sorting large data lists is still time consuming and can benefit from parallel execution. Parallelizing efficient sorting algorithms is challenging and sometimes requires elaborate designs. This chapter presents the designs of three parallel sorting algorithms &amp;ndash; odd-even sort, merge sort, and radix sort. Odd-even sort is covered briefly due to its simplicity and merge sort is covered briefly because it largely depends on the merge pattern already presented in Chapter 13. Most of the chapter is dedicated to radix sort and its optimizations, which rely on a more general form of the stable filter pattern which will be discussed further in Chapter 12. Other popular parallel sorting algorithms such as transposition sort and sampling sort are also discussed. Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00024-X&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00024-X&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 13 Merge</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/13-ch13/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/13-ch13/</guid>
        <description>&lt;h1 id=&#34;c13&#34;&gt;Chapter 13 Merge&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Merge And dynamic input data identification With special contributions from Li-Wen Chang and Jie Lv CONTENTS 13.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 13.2 A sequential merge algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 13.3 A parallelization approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 13.4 Co-rank function implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 13.5 A basic parallel merge kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 13.6 A tiled merge kernel to improve coalescing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 13.7 A circular-buffer merge kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 13.8 Thread coarsening for merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 13.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 13.10 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 Our next parallel pattern is an ordered merge operation, which takes two sorted lists and generates a combined, sorted list. Ordered merge operations can be used as a building block of sorting algorithms as we will see in Chapter 14. Ordered merge operations also form the basis of modern map-reduce frameworks. This chapter presents a parallel ordered merge algorithm where the input data for each thread is dynamically determined. The dynamic nature of the data access makes it challenging to exploit locality and tiling techniques for improved memory access efficiency and performance. The principles behind dynamic input data identification are also relevant to many other important computations, such as set intersection and set union. We present increasingly sophisticated buffer management schemes for achieving increasing levels of memory access efficiency for order merged and other operations that determine their input data dynamically.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 12 Filter</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/12-ch12/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/12-ch12/</guid>
        <description>&lt;h1 id=&#34;c12&#34;&gt;Chapter 12 Filter&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Filter And warp voting&lt;/p&gt;&#xA;&lt;p&gt;CONTENTS 12.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 12.2 A simple parallel unstable filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 12.3 Coalescing atomic operations with warp-level primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 12.4 Privatization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 12.5 A simple parallel stable filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 12.6 Improving memory coalescing with shared memory and thread coarsening . . . . . . 298 12.7 In-place stable filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 12.8 Related patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 12.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 12.10 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 Filter operations rearrange data in a list to make more efficient use of memory after some of the list elements are deleted. If we view the deleted elements and the remaining elements as two sub-lists, a filter operation can be viewed as the inverse of a merge operation. In this chapter, we show that using a technique called warp voting we can enable coalescing of atomic operations across threads and improve the speed of parallel implementations of filter. We look at the considerations for performing the stable filter operation in place instead of out of place. Finally, we discuss other related patterns with similar implementations and optimizations, such as removing duplicates from a sorted list and adding/removing rows and columns from a matrix.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 11 Scan</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/11-ch11/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/11-ch11/</guid>
        <description>&lt;h1 id=&#34;c11&#34;&gt;Chapter 11 Scan&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Scan And work efficiency in parallel algorithms With special contributions from Li-Wen Chang, Juan Gómez-Luna, and John Owens CONTENTS 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 11.2 Parallel scan with the Kogge-Stone algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 11.3 Double-buffering to reduce synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 11.4 Warp-level primitives to reduce synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 11.5 Work efficiency considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 11.6 Coarsening to improve work-eiciency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 11.7 Register tiling to avoid shared memory access latency. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 11.8 Memory bandwidth considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 11.9 Consolidating block segments for a global scan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 11.10 Parallel scan with the Brent-Kung algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 11.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 11.12 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Parallel scan is frequently used to parallelize seemingly sequential operations, such as resource allocation, work assignment, and polynomial evaluation. In general, if a computation is naturally described as a mathematical recursion where each item in a series is defined in terms of the previous item, it is likely parallelizable as a parallel scan operation. Parallel scan plays a key role in massively parallel computing for a simple reason: any sequential section of an application can drastically limit the overall performance of the application. Many such sequential sections can be converted into parallel computation with parallel scan. For this reason, parallel scan is often used as a primitive operation in parallel algorithms that perform filtering, radix sort, quick sort, string comparison, polynomial evaluation, solving recurrences, and tree operations. The filtering example is presented in Chapter 12 and the radix sort example is presented in Chapter 14. Multiple algorithms exist for parallel scan with different tradeoffs between work complexity and span. Some parallel algorithms can have higher work complexity than a sequential algorithm. As we shall discuss in this chapter, an increase in work complexity can make a parallel scan run slower than a sequential scan when hardware resources are constrained, necessitating optimizations that mitigate the higher work Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00021-4&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00021-4&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 10 Reduction</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/10-ch10/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/10-ch10/</guid>
        <description>&lt;h1 id=&#34;c10&#34;&gt;Chapter 10 Reduction&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Reduction And mitigating control divergence CONTENTS 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Reduction trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 A simple reduction kernel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Reducing control divergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Reducing memory access divergence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Reducing global memory accesses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 Reducing synchronization overhead with warp-level primitives. . . . . . . . . . . . . . . . . . . . . 237 Further reducing synchronization overhead with two-stage warp-wide reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 10.9 Reduction for arbitrary length inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 10.10 Thread coarsening to reduce overhead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 10.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 10.12 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 A reduction operation derives a single value from a list of values. The single value could be the sum, the maximum, the minimum, etc. of all the values in the list. The value can also be of various types: integer, single-precision floating point, doubleprecision floating point, half-precision floating point, characters, etc. All these types of reductions share the same computation structure. Like histogram, reduction is an important computation pattern as it generates a summary from a large amount of data. Parallel reduction is an important parallel pattern that requires parallel threads to coordinate with each other to produce correct results. Such coordination must be done carefully to avoid performance bottlenecks commonly found in parallel computing systems. Parallel reduction is therefore a good vehicle for illustrating these performance bottlenecks and introducing techniques for mitigating them.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 9 Histogram</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/09-ch9/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/09-ch9/</guid>
        <description>&lt;h1 id=&#34;c9&#34;&gt;Chapter 9 Histogram&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Histogram An introduction to atomic operations and privatization CONTENTS 9.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 9.2 Atomic operations and a basic histogram kernel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 9.3 Latency and throughput of atomic operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 9.4 Privatization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 9.5 Thread coarsening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 9.6 Thread-level privatization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 9.7 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 9.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 The parallel computation patterns that we have presented so far all allow the task of computing each output element to be exclusively assigned to, or owned by, a thread. Therefore, these patterns are amenable to the owner-computes rule, where every thread can write into their designated output element(s) without any concern about interference from other threads. This chapter introduces the parallel histogram pattern, where each output element can potentially be updated by any thread. As such, one must take care to coordinate among threads as they update output elements and avoid any interference that corrupts the final result. In practice, there are many other important parallel computation patterns where output interference cannot be easily avoided. The parallel histogram pattern provides an example of such output interference. We will first examine a baseline approach that uses atomic operations to serialize the updates to each element. This baseline approach is simple but inefficient, often resulting in disappointing execution speed. We will then present some widely used optimization techniques, most notably privatization, to significantly enhance execution speed while preserving correctness. The cost and benefit of these techniques depend on the underlying hardware as well as the characteristics of the input data. It is therefore important for a developer to understand the key ideas of these techniques and reason about their applicability under different circumstances. Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00019-6&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00019-6&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 8 Stencil computation</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/08-ch8/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/08-ch8/</guid>
        <description>&lt;h1 id=&#34;c8&#34;&gt;Chapter 8 Stencil computation&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Stencil computation And thread coarsening CONTENTS 8.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 8.2 Parallel stencil &amp;ndash; a basic kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 8.3 Memory bandwidth considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 8.4 Shared-memory tiling for stencil sweep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 8.5 Thread coarsening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 8.6 Register tiling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 8.7 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 8.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Stencils are foundational to numerical methods for solving partial differential equations in application domains like fluid dynamics, heat conductance, combustion, weather forecast, climate simulation, and electromagnetics. The data processed by stencil-based algorithms are discretized quantities of physical significance, such as mass, velocity, force, acceleration, temperature, electrical field, and energy whose relations with each other are governed by differential equations. A common use of stencils is to approximate the derivative values of a function based on the function values within a range of input variable values. Stencils bear strong resemblance to convolution in that they both calculate the new value of an element of a multidimensional array based on the current value of the element at the same position and those in the neighborhood in another multidimensional array. Therefore, stencils also need to deal with halo cells and ghost cells. Unlike convolution, a stencil computation is used to iteratively solve the values of continuous and differentiable functions within the domain of interest. The data elements and the weight coefficients used for the elements in the stencil neighborhood are governed by the differential equations being solved. Some stencil patterns are amenable to optimizations that are not applicable to convolution. In the solvers where initial conditions are iteratively propagated through the domain, the calculations of output values may have dependences and need to be performed according to some ordering constraints. Furthermore, because of the numerical accuracy requirements in solving differential equations, the data processed by stencils tend to be high-precision floating data that consume more on-chip memory for tiling techniques. Due to these differences, stencils tend to motivate different optimizations than convolution. Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00018-4&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00018-4&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 7 Convolution</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/07-ch7/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/07-ch7/</guid>
        <description>&lt;h1 id=&#34;c7&#34;&gt;Chapter 7 Convolution&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;In the next several chapters, we discuss a set of important patterns of parallel computation. These patterns are the basis of a wide range of parallel algorithms that appear in many parallel applications. We start with convolution, which is a popular array operation that is used in various forms in signal processing, digital recording, image processing, video processing, and computer vision. In these application areas, convolution is often performed as a filter that transforms signals and pixels into more desirable values. Our image blur kernel is such a filter that smooths out the signal values so that one can see the big-picture trend. For another example, Gaussian filters are convolution filters that can be used to sharpen boundaries and edges of objects in images.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 6 Performance considerations</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/06-ch6/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/06-ch6/</guid>
        <description>&lt;h1 id=&#34;c6&#34;&gt;Chapter 6 Performance considerations&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Performance considerations&lt;/p&gt;&#xA;&lt;p&gt;CONTENTS 6.1 Global memory access coalescing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 6.2 Hiding memory latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 6.3 Vector loads and stores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 6.4 Shared memory bank conflicts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 6.5 Thread coarsening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 6.6 Loop unrolling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 6.7 Double buffering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 6.8 A checklist of optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 6.9 Optimization strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 6.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 6.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 The execution speed of a parallel program can vary greatly depending on the interactions between the resource demands of the program and the resource constraints of the hardware. Managing the interaction between parallel code and hardware resource constraints is important for achieving high performance in virtually all parallel programming models. It is a practical skill that requires deep understanding of the hardware architecture and is best learned with hands-on exercises in a parallel programming model designed for high-performance. So far, we have learned about the basic aspects of the GPU architecture and their implications on performance. In Chapter 4, we learned about the compute architecture of the GPU and related performance considerations such as control divergence and occupancy. In Chapter 5, we learned about the on-chip memory architecture of the GPU and the use of shared memory tiling and register tiling to alleviate global memory bandwidth limitations. In this chapter, we will learn more about the off-chip memory (DRAM) architecture and discuss related performance considerations such as memory coalescing, memory latency hiding, and vector loads and stores. We also introduce additional important optimizations such as avoiding shared memory bank conflicts, thread granularity coarsening, loop unrolling, and double-buffering. Finally, we wrap up this part of the textbook with a checklist of common performance optimizations that will serve as a guide for optimizing the performance of the parallel patterns discussed in the second and third parts of the book. Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00015-9&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00015-9&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 5 Memory architecture and data locality</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/05-ch5/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/05-ch5/</guid>
        <description>&lt;h1 id=&#34;c5&#34;&gt;Chapter 5 Memory architecture and data locality&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;&lt;strong&gt;global&lt;/strong&gt; void foo_kernel(int* a, int* b) { unsigned int i = blockIdx.x*blockDim.x + threadIdx.x; if(threadIdx.x &amp;lt; 40 || threadIdx.x &amp;gt;= 104) { b[i] = a[i] + 1; } if(i%2 == 0) { a[i] = b[i]*2; } for(unsigned int j = 0; j &amp;lt; 5 - (i%3); ++j) { 4.10 Exercises&lt;/p&gt;&#xA;&lt;p&gt;b[i] += j; } } void foo(int* a_d, int* b_d) { unsigned int N = 1024; foo_kernel &amp;laquo;&amp;lt; (N + 128 - 1)/128, 128 &amp;raquo;&amp;gt;(a_d, b_d); } a. What is the number of warps per block? b. What is the number of warps in the grid? c. For the statement on line 04: i. How many warps in the grid are active? ii. How many warps in the grid are divergent? iii. What is the SIMD efficiency (in %) of warp 0 of block 0? iv. What is the SIMD efficiency (in %) of warp 1 of block 0? v. What is the SIMD efficiency (in %) of warp 3 of block 0? d. For the statement on line 07: i. How many warps in the grid are active? ii. How many warps in the grid are divergent? iii. What is the SIMD efficiency (in %) of warp 0 of block 0? e. For the loop on line 09: i. How many iterations have no divergence? ii. How many iterations have divergence? 2. For a vector addition, assume that the vector length is 2000, each thread calculates one output element, and the thread block size is 512 threads. How many threads will be in the grid? 3. For the previous question, how many warps do you expect to have divergence due to the boundary check on vector length? 4. Consider a hypothetical block with 8 threads executing a section of code before reaching a barrier. The threads require the following amount of time (in micro seconds) to execute the sections: 2.0, 2.3, 3.0, 2.8, 2.4, 1.9, 2.6, 2.9 and spend the rest of their time waiting for the barrier. What percentage of the threads’ total execution time is spent waiting for the barrier? 5. A CUDA programmer says that if they launch a kernel with only 32 threads in each block, they can leave out the __syncthreads() instruction wherever barrier synchronization is needed. Do you think this is a good idea? Explain. 6. If a CUDA device’s SM (streaming multiprocessor) can take up to 1536 threads and up to 4 thread blocks. Which of the following block configuration would result in the most number of threads in the SM? a. 128 threads per block b. 256 threads per block c. 512 threads per block d. 1024 threads per block 7. Assume a device that allows up to 64 blocks per SM and 2048 threads per SM. Indicate which of the following assignments per SM is possible. In the cases where it is possible, indicate the occupancy level. a. 8 blocks with 128 threads each b. 16 blocks with 64 threads each c. 32 blocks with 32 threads each d. 64 blocks with 32 threads each e. 32 blocks with 64 threads each 8. Consider a GPU with the following hardware limits: 2048 threads/SM, 32 blocks/SM, and 64 K (65,536) registers/SM. For each of the following kernel characteristics, specify if the kernel can achieve full occupancy. If not, specify the limiting factor. a. The kernel uses 128 threads/block and 30 registers/thread. b. The kernel uses 32 threads/block and 29 registers/thread. c. The kernel uses 256 threads/block and 34 registers/thread. 9. A student mentions that they were able to multiply two 1024×1024 matrices using a matrix multiplication kernel with 32×32 thread blocks. The student is using a CUDA device that allows up to 512 threads per block and up to 8 blocks per SM. The student further mentions that each thread in a thread block calculates one element of the result matrix. What would be your reaction and why?&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 4 Compute architecture and scheduling</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/04-ch4/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/04-ch4/</guid>
        <description>&lt;h1 id=&#34;c4&#34;&gt;Chapter 4 Compute architecture and scheduling&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Compute architecture and scheduling&lt;/p&gt;&#xA;&lt;p&gt;CONTENTS 4.1 Architecture of a modern GPU. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 4.2 Thread block scheduling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 4.3 Synchronization and transparent scalability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 4.4 Warps and SIMD hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 4.5 Control divergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 4.6 Warp scheduling and latency tolerance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.7 Resource partitioning and occupancy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 4.8 Querying device properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 4.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 4.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 In Chapter 1, we saw that CPUs are designed to minimize the latency of instruction execution and that GPUs are designed to maximize the throughput of executing instructions. In Chapter 2 and Chapter 3, we learned the core features of CUDA programming for creating and calling kernels to launch and execute threads. In the next three chapters, we discuss the architecture of modern GPUs, both the compute architecture and the memory architecture, and the performance optimization techniques stemming from the understanding of this architecture. This chapter presents several aspects of the GPU compute architecture that are essential for CUDA C++ programmers to understand and reason about the performance behavior of their kernel code. We start by showing a high-level simplified view of the compute architecture and explore the concepts of flexible resource assignment, scheduling of thread blocks, and occupancy. We then advance into thread scheduling, latency tolerance, control divergence, and synchronization. We will finish the chapter with a description of the API functions that can be used to query the resources available in the GPU and the tools to help estimate the occupancy of the GPU when executing a kernel. In the following two chapters, we present the core concepts and programming considerations of the GPU memory architecture. In particular, Chapter 5 focuses on the on-chip memory architecture, and Chapter 6 briefly covers the off-chip memory architecture then elaborates on various performance considerations of the GPU architecture as a whole. A CUDA C++ programmer who masters these concepts is well equipped to write and to understand high-performance parallel kernels. Programming Massively Parallel Processors. &lt;a href=&#34;https://doi.org/10.1016/B978-0-44-343900-1.00013-5&#34;&gt;https://doi.org/10.1016/B978-0-44-343900-1.00013-5&lt;/a&gt; Copyright © 2027 Elsevier Inc. All rights are reserved, including those for text and data mining, AI training, and similar technologies.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 3 Multidimensional grids and data</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/03-ch3/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/03-ch3/</guid>
        <description>&lt;h1 id=&#34;c3&#34;&gt;Chapter 3 Multidimensional grids and data&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;CHAPTER&lt;/p&gt;&#xA;&lt;p&gt;Multidimensional grids and data&lt;/p&gt;&#xA;&lt;p&gt;CONTENTS 3.1 Multidimensional grid organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.2 Mapping threads to MultiDimensional data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.3 Image blur &amp;ndash; a more complex kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.4 Matrix multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 3.5 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 In Chapter 2, we learned to write a simple CUDA C++ program that calls a kernel function to launch a one-dimensional grid of threads that operates on elements of one-dimensional arrays. A kernel specifies the statements that are executed by each individual thread in the grid. In this chapter, we look more generally at how threads are organized and learn how threads and blocks can be used to process multidimensional arrays. Multiple examples are used throughout the chapter, including converting a colored image to a grayscale image, blurring an image, and matrix multiplication. These examples also serve to familiarize the reader with reasoning about data parallelism before we proceed to discuss the GPU architecture, memory organization, and performance optimizations in the upcoming chapters.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 2 Heterogeneous data-parallel computing</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/02-ch2/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/02-ch2/</guid>
        <description>&lt;h1 id=&#34;c2&#34;&gt;Chapter 2 Heterogeneous data-parallel computing&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Data parallelism refers to the phenomenon that the computations to be performed on different parts of a dataset can be done independently of each other and thus can be done in parallel with each other. Many applications exhibit a rich amount of data parallelism that makes them amenable to scalable parallel execution where the speed of execution improves proportionally to the amount of execution resources in the system. It is therefore important for parallel programmers to be familiar with the concept of data parallelism and the parallel programming language constructs for writing code that exploit data parallelism. In this chapter, we will use the CUDA C++ language constructs to develop a simple data parallel program.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Chapter 1 Introduction</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/01-ch1/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/01-ch1/</guid>
        <description>&lt;h1 id=&#34;c1&#34;&gt;Chapter 1 Introduction&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Ever since the beginning of computing, many high-valued applications have demanded more execution speed and resources than the computing devices can offer. Early applications relied on the advancement of processor speed, memory speed, and memory capacity to enhance application-level capabilities such as the timeliness of weather forecast, the accuracy of engineering structural analysis, the realism of computer-generated graphics, the number of airline reservations processed per second, or the number of fund transfers processed per second. More recently, new applications such as deep learning have demanded even more execution speed and resources than what the best computing devices can offer. These application demands have fueled fast advancement in computing device capabilities in the past five decades and will continue to do so in the foreseeable future.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Preface</title>
        <link>https://codingpracticegroup.github.io/pmpp5-zh/en/book/00-preface/</link>
        
        
        <guid>https://codingpracticegroup.github.io/pmpp5-zh/en/book/00-preface/</guid>
        <description>&lt;h1 id=&#34;preface&#34;&gt;Preface&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;We are proud to present to you the 5th edition of &amp;ldquo;Programming Massively Parallel Processors &amp;ndash; a hands-on approach.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;Since the publication of the fourth edition in 2022, exascale computing using hundreds of thousands of GPUs interconnected with fast networks has powered the AI revolution to full gear. GPUs have played a front-and-center role in training the large language models behind ChatGPT, DeepSeek, and Gemini. GPUs have also become the workhorse of serving AI queries from users that span the entire age, race, and geography spectrum. The impact of GPU computing is now felt across all sectors of the industry and society.&lt;/p&gt;</description>
      </item>
    
  </channel>
</rss>
