为什么我们仍然使用CPU而不是GPU?

为什么我们仍然使用CPU而不是GPU?_第1张图片

Increasingly GPUs are being used for non-graphical tasks like risk computations, fluid dynamics calculations, and seismic analysis. What’s to stop us from adopting GPU-driven devices?

GPU越来越多地用于非图形任务,例如风险计算,流体动力学计算和地震分析。 是什么阻止我们采用GPU驱动的设备?

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-drive grouping of Q&A web sites.

今天的问答环节由SuperUser提供,它是Stack Exchange的一个分支,它是Q&A网站的社区推动组织。

问题 (The Question)

SuperUser reader Ell keeps up with tech news and is curious why we’re not using more GPU-based systems:

超级用户阅读器Ell紧跟技术新闻,并且很好奇我们为什么不使用更多基于GPU的系统:

It seems to me that these days lots of calculations are done on the GPU. Obviously graphics are done there, but using CUDA and the like, AI, hashing algorithms (think Bitcoins) and others are also done on the GPU. Why can’t we just get rid of the CPU and use the GPU on its own? What makes the GPU so much faster than the CPU?

在我看来,这些天来,很多计算都是在GPU上完成的。 显然,图形是在此处完成的,但是使用CUDA等工具,AI,哈希算法(认为是比特币)等也可以在GPU上完成。 为什么我们不能仅仅放弃CPU并单独使用GPU? 是什么使GPU比CPU快得多?

Why indeed? What makes the CPU unique?

为什么会这样呢? 是什么使CPU独特?

答案 (The Answer)

SuperUser contributor DragonLord offers a well supported overview of the differences between GPUs and CPUs:

超级用户贡献者DragonLord提供了受支持的GPU和CPU之间区别的概述:

TL;DR answer: GPUs have far more processor cores than CPUs, but because each GPU core runs significantly slower than a CPU core and do not have the features needed for modern operating systems, they are not appropriate for performing most of the processing in everyday computing. They are most suited to compute-intensive operations such as video processing and physics simulations.

TL; DR回答: GPU比CPU具有更多的处理器内核,但是由于每个GPU内核的运行速度明显慢于CPU内核,并且不具有现代操作系统所需的功能,因此它们不适合每天执行大多数处理计算。 它们最适合计算密集型操作,例如视频处理和物理模拟。

The detailed answer: GPGPU is still a relatively new concept. GPUs were initially used for rendering graphics only; as technology advanced, the large number of cores in GPUs relative to CPUs was exploited by developing computational capabilities for GPUs so that they can process many parallel streams of data simultaneously, no matter what that data may be. While GPUs can have hundreds or even thousands of stream processors, they each run slower than a CPU core and have fewer features (even if they areTuring complete and can be programmed to run any program a CPU can run). Features missing from GPUs include interrupts and virtual memory, which are required to implement a modern operating system.

详细答案: GPGPU仍然是一个相对较新的概念。 GPU最初仅用于渲染图形。 随着技术的进步,GPU相对于CPU的大量内核已通过开发GPU的计算能力而得到利用,因此无论数据是什么,它们都可以同时处理许多并行数据流。 尽管GPU可以具有数百甚至数千个流处理器,但它们的运行速度都比CPU内核慢,并且具有较少的功能(即使它们的Turing完整并且可以被编程为运行CPU可以运行的任何程序)。 GPU缺少的功能包括中断和虚拟内存,这是实现现代操作系统所必需的。

In other words, CPUs and GPUs have significantly different architectures that make them better suited to different tasks. A GPU can handle large amounts of data in many streams, performing relatively simple operations on them, but is ill-suited to heavy or complex processing on a single or few streams of data. A CPU is much faster on a per-core basis (in terms of instructions per second) and can perform complex operations on a single or few streams of data more easily, but cannot efficiently handle many streams simultaneously.

换句话说,CPU和GPU具有明显不同的体系结构,使其更适合于不同的任务。 GPU可以处理许多流中的大量数据,对其执行相对简单的操作,但不适用于对单个或几个数据流进行繁重或复杂的处理。 CPU在每个核的基础上(以每秒的指令数计)要快得多,并且可以更轻松地对单个或几个数据流执行复杂的操作,但不能有效地同时处理多个流。

As a result, GPUs are not suited to handle tasks that do not significantly benefit from or cannot be parallelized, including many common consumer applications such as word processors. Furthermore, GPUs use a fundamentally different architecture; one would have to program an application specifically for a GPU for it to work, and significantly different techniques are required to program GPUs. These different techniques include new programming languages, modifications to existing languages, and new programming paradigms that are better suited to expressing a computation as a parallel operation to be performed by many stream processors. For more information on the techniques needed to program GPUs, see the Wikipedia articles on stream processing and parallel computing.

结果,GPU不适合处理无法从中受益或无法并行化的任务,包括许多常见的消费类应用程序,例如文字处理器。 此外,GPU使用根本不同的架构。 一个人必须为GPU专门编写一个应用程序,然后才能工作,并且对GPU进行编程需要明显不同的技术。 这些不同的技术包括新的编程语言,对现有语言的修改以及新的编程范例,它们更适合于将计算表示为要由许多流处理器执行的并行操作。 有关编程GPU所需技术的更多信息,请参阅Wikipedia上有关流处理和并行计算的文章 。

Modern GPUs are capable of performing vector operations and floating-point arithmetic, with the latest cards capable of manipulating double-precision floating-point numbers. Frameworks such as CUDA and OpenCL enable programs to be written for GPUs, and the nature of GPUs make them most suited to highly parallelizable operations, such as in scientific computing, where a series of specialized GPU compute cards can be a viable replacement for a small compute cluster as in NVIDIA Tesla Personal Supercomputers. Consumers with modern GPUs who are experienced with Folding@home can use them to contribute with GPU clients, which can perform protein folding simulations at very high speeds and contribute more work to the project (be sure to read the FAQs first, especially those related to GPUs). GPUs can also enable better physics simulation in video games using PhysX, accelerate video encoding and decoding, and perform other compute-intensive tasks. It is these types of tasks that GPUs are most suited to performing.

现代的GPU能够执行矢量运算和浮点运算,而最新的显卡能够处理双精度浮点数。 诸如CUDA和OpenCL之类的框架使程序能够为GPU编写,并且GPU的性质使它们最适合高度并行化的操作,例如科学计算中的一系列专用GPU计算卡可以替代小型的可行GPU。计算集群,如NVIDIA Tesla个人超级计算机一样 。 拥有Folding @ home经验的拥有现代GPU的消费者可以使用它们为GPU客户端提供帮助, GPU客户端可以以非常高的速度执行蛋白质折叠模拟并为项目做更多的工作(请务必先阅读FAQ ,尤其是有关FAQ的内容)。 GPU)。 GPU还可以使用PhysX在视频游戏中实现更好的物理模拟,加速视频编码和解码,并执行其他计算密集型任务。 GPU最适合执行这些类型的任务。

AMD is pioneering a processor design called the Accelerated Processing Unit (APU) which combines conventional x86 CPU cores with GPUs. This could allow the CPU and GPU components to work together and improve performance on systems with limited space for separate components. As technology continues to advance, we will see an increasing degree of convergence of these once-separate parts. However, many tasks performed by PC operating systems and applications are still better suited to CPUs, and much work is needed to accelerate a program using a GPU. Since so much existing software use the x86 architecture, and because GPUs require different programming techniques and are missing several important features needed for operating systems, a general transition from CPU to GPU for everyday computing is extremely difficult.

AMD率先推出了称为加速处理单元(APU)的处理器设计,该处理器将传统的x86 CPU内核与GPU结合在一起。 这可以允许CPU和GPU组件一起工作,并在空间有限的单独组件上提高系统的性能。 随着技术的不断发展,这些曾经分离的零件的融合程度将会越来越高。 但是,由PC操作系统和应用程序执行的许多任务仍然更适合CPU,并且需要大量工作来使用GPU加速程序。 由于许多现有软件都使用x86架构,并且由于GPU需要不同的编程技术并且缺少操作系统所需的几个重要功能,因此日常计算从CPU到GPU的一般过渡非常困难。



Have something to add to the explanation? Sound off in the the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不对。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程 。

翻译自: https://www.howtogeek.com/128221/why-are-we-still-using-cpus-instead-of-gpus/

你可能感兴趣的:(内核,java,python,编程语言,linux)