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

Summary

The main advantage of using a GPU over a CPU is its increased throughput, which means that we can execute more parallel code simultaneously on GPU than on a CPU; a GPU cannot make recursive algorithms or nonparallelizable algorithms somewhat faster. We see that some tasks, such as the example of building a house, are only partially parallelizable—in this example, we couldn't speed up the process of designing the house (which is intrinsically serial in this case), but we could speed up the process of the construction, by hiring more laborers (which is parallelizable in this case).

We used this analogy to derive Amdahl's Law, which is a formula that can give us a rough estimate of potential speedup for a program if we know the percentage of execution time for code that is parallelizable, and how many processors we will have to run this code. We then applied Amdahl's Law to analyze a small program that generates the Mandelbrot set and dumps it to an image file, and we determined that this would be a good candidate for parallelization onto a GPU. Finally, we ended with a brief overview of profiling code with the cPython module; this allows us to see where the bottlenecks in a program are, without explicitly timing function calls.

Now that we have a few of the fundamental concepts in place, and have a motivator to learn GPU programming, we will spend the next chapter setting up a Linux- or Windows 10-based GPU programming environment. We will then immediately dive into the world of GPU programming in the following chapter, where we will actually write a GPU-based version of the Mandelbrot program that we saw in this chapter.

主站蜘蛛池模板: 吉木萨尔县| 沙湾县| 阳泉市| 阜阳市| 徐闻县| 林芝县| 蓬溪县| 安庆市| 镇沅| 容城县| 基隆市| 高陵县| 万全县| 武夷山市| 宾川县| 马龙县| 大洼县| 邓州市| 项城市| 丰顺县| 儋州市| 射阳县| 津市市| 南充市| 宣威市| 札达县| 金川县| 闽清县| 阳西县| 英德市| 依安县| 营口市| 阿克陶县| 新龙县| 弥勒县| 平利县| 石门县| 临沭县| 青海省| 唐山市| 嵊州市|