为什么不使用的GPU为CPU?(Why not using GPUs as a CPU?)

2019-07-29 21:49发布

我知道,问题是只有部分编程相关的,因为我想获得答案最初是从以下两个问题:

为什么CPU核心数量如此之低(相对于GPU)? 而我们为什么不使用的GPU代替的CPU,GPU只或CPU只? (我知道,虽然CPU是多为多任务等GPU是专门)。 我也知道,有内存(主机VS GPU)的限制,精度和缓存能力一起。 但是,在硬件上比较来看,高端到高端的CPU / GPU的GPU相比得多更高性能。

所以我的问题是: 我们可以使用的GPU而不是CPU的对操作系统,应用程序等

我问这个问题的原因是因为我想知道为什么现在的计算机还在使用2个主处理单元(CPU / GPU)有两个主要的内存和缓存系统(CPU / GPU),即使它不是一个理由程序员想。

Answer 1:

GPU是专为图形相关处理(明显),这是本质上的东西,从并行处理的好处(同时做多任务/计算)。 这意味着,不像现代的CPU,正如你可能知道通常有2-8内核,GPU的有数百个内核。 这意味着,他们是唯一适合像光线追踪或其他任何处理的事情,你可能会在3D游戏或其他图形密集的活动遇到的问题。

在另一方面CPU有核的数量相对有限,因为一个CPU通常面临的任务不从并行处理几乎一样多受益渲染3D场景会。 事实上,在CPU中有太多的内核实际上可以降低机器的性能,因为的CPU通常不会在任务的性质和事实,即大量的程序将不会被写入到取芯的众多优势。 这意味着,互联网浏览或其他大多数的桌面任务,有几个强大的核心的CPU将是更适合的工作比许多,许多小核心GPU的。

另外要注意的是,更多的内核通常意味着需要更多的功率。 这意味着,一个256核心的手机或笔记本电脑将是从功耗和发热量的角度来看,更不用说制造挑战和成本非常不切实际的。



Answer 2:

Current GPUs lack many of the facilities of a modern CPU that are generally considered important (crucial, really) to things like an OS.

Just for example, an OS normally used virtual memory and paging to manage processes. Paging allows the OS to give each process its own address space, (almost) completely isolated from every other process. At least based on publicly available information, most GPUs don't support paging at all (or at least not in the way an OS needs).

GPUs also operate at much lower clock speeds than CPUs. Therefore, they only provide high performance for embarrassingly parallel problems. CPUs are generally provide much higher performance for single threaded code. Most of the code in an OS isn't highly parallel -- in fact, a lot of it is quite difficult to make parallel at all (e.g., for years, Linux had a giant lock to ensure only one thread executed most kernel code at any given time). For this kind of task, a GPU would be unlikely to provide any benefit.

From a programming viewpoint, a GPU is a mixed blessing (at best). People have spent years working on programming models to make programming a GPU even halfway sane, and even so it's much more difficult (in general) than CPU programming. Given the difficulty of getting even relatively trivial things to work well on a GPU, I can't imagine attempting to write anything even close to as large and complex as an operating system to run on one.



Answer 3:

通常操作系统非常简单,如果你看一下它们的结构。 但它们并行不会提高速度的多,只有原始时钟速度会做。

GPU的简单缺件,并从他们的指令了很多的指令集,一个操作系统需要,这是复杂的问题。 试想想的虚拟化功能(英特尔VT-x或AMD的AMD-V)。

GPU核心都像哑巴蚂蚁,而CPU就像是一个复杂的人,可以这么说。 两人都因为这个不同的能源消耗和产生非常不同的热量。

看到这个广泛的超级答案在这里更多的信息。



文章来源: Why not using GPUs as a CPU?
标签: cpu opencl gpu