question: Can you use a GPU as a CPU? Why/why not? If not, what's the difference between them that makes it impossible?
comment: While a GPU can do all the operations a CPU can (which mean that you could, *in theory* use it like a CPU), the architecture isn't optimized for it would make it very inefficient. While CPUs and GPUs are basically the same thing (processors), both have different goals: the CPU is optimized for latency, and the GPU is optimized for throughput. (The goal of the CPU is to do any sequence of operations in the smallest possible amount for time, while the goal of the GPU is to do the maximum amount of work per amount of time). To do this they both use different architectures/layouts: the CPU has a few, very big, fast cores and the GPU has hundreds/thousands of tiny, slow "cores". So to make an analogy: * The CPU is a supercar: two seats, 200mph top speed. * The GPU is an articulated bus: 400 seats, 30mph top speed. If you wanna do *one* (or two) things really fast, the CPU wins. If you want to do the same thing over and over and over again a billion time (and don't care how long it takes to do it just once), the GPU wins. ************************ How does this look like on the chip then? To really understand this, you need to know that in a CPU, the circuit that does the actual computation (let's call it the ALU) is incredibly fast and the most important thing for CPU speed isn't to make it faster, but to keep it fed with work to do and data to work on. For this reason CPUs have a ton of extra circuits whose job is to keep the ALU busy (caches, predictors, schedulers, buffers, ...). GPUs don't do that as much. GPUs are designed to process pixels or triangles, and there are millions of them on a screen. The repetitive nature of the work done on a GPU means that most cores will work on the same kind of thing at the same time, and the circuit that feed them with instructions and data can be shared across cores. And since you don't care how long it takes for a single pixel to be computed, but rather how long it takes for the whole screen, each GPU core can afford to compute several pixels in parallel to amortize wait times (if the computation for a pixel has to wait for data from memory, the core can just switch to some other pixel). The resulting architecture is very different: instead of having big cores with their own ALU and a huge control circuit to make the ALU happy, The GPU has groups of cores that share the same control circuit. This means that they can have a lot more ALU (because they don't need as much control stuff), but that cores aren't all independent. Cores withing a group have to work on the same thing, which is fine when doing graphics but can lead to atrocious performance when trying to do one single thing.
passages: Using GPUs to perform computations holds a lot of potential for some applications because of the fundamental differences of GPU microarchitectures compared to CPUs. GPUs achieve much greater throughput (calculations per second) by executing many programs in parallel and restricting flow control (the ability of one program to execute instructions independently of another). Modern GPUs also have addressable on-die memory and extremely high performance multi-channel external memory.
  
  AMD subsequently switched from CTM to OpenCL.
  
  Section::::Open-source.
  
  Some components of CTM and the Stream SDK are open source, such as the Brook+ C-like language and compiler.
  
  Section::::See also.
  
  BULLET::::- CUDA
  
  BULLET::::- BrookGPU
   For some low-power mobile CPUs there is limited video decoding support, while none of the desktop CPUs have this limitation.
  
  Section::::Generations.:Haswell.
  
  On 12 September 2012, Haswell CPUs were announced, with four models of integrated GPUs:
   Section::::GPU vs. CPU.:Caches.
  
  Historically, CPUs have used hardware-managed caches but the earlier GPUs only provided software-managed local memories. However, as GPUs are being increasingly used for general-purpose applications, state-of-the-art GPUs are being designed with hardware-managed multi-level caches which have helped the GPUs to move towards mainstream computing. For example, GeForce 200 series GT200 architecture GPUs did not feature an L2 cache, the Fermi GPU has 768 KiB last-level cache, the Kepler GPU has 1.5 MiB last-level cache, the Maxwell GPU has 2 MiB last-level cache and the Pascal GPU has 4 MiB last-level cache.
  
  Section::::GPU vs. CPU.:Register file.
   Broadcom develops and designs the VideoCore GPU series as part of their SoCs. Since it is used by the Raspberry Pi, there has been considerable interest in a FOSS driver for VideoCore. The Raspberry Pi Foundation, in co-operation with Broadcom, announced on October 24, 2012 that they open-sourced "all the ARM (CPU) code that drives the GPU". However, the announcement was misleading; according to the author of the reverse-engineered Lima driver, the newly open-sourced components only allowed message-passing between the ARM CPU and VideoCore but offered little insight into Videocore and little additional programability. The Videocore GPU runs an RTOS which handles the processing; video acceleration is done with RTOS firmware coded for its proprietary GPU, and the firmware was not open-sourced on that date. Since there was neither a toolchain targeting the proprietary GPU nor a documented instruction set, no advantage could be taken if the firmware source code became available. The Videocoreiv project attempted to document the VideoCore GPUs.
   The GPU, or graphics processing unit, is the unit that allows the graphics card to function. It performs a large amount of the work given to the card. The majority of video playback on a computer is controlled by the GPU. Once again, a GPU can be either integrated or dedicated.
   Since 2005 there has been interest in using the performance offered by GPUs for evolutionary computation in general, and for accelerating the fitness evaluation in genetic programming in particular. Most approaches compile linear or tree programs on the host PC and transfer the executable to the GPU to be run. Typically the performance advantage is only obtained by running the single active program simultaneously on many example problems in parallel, using the GPU's SIMD architecture. However, substantial acceleration can also be obtained by not compiling the programs, and instead transferring them to the GPU, to be interpreted there. Acceleration can then be obtained by either interpreting multiple programs simultaneously, simultaneously running multiple example problems, or combinations of both. A modern GPU can readily simultaneously interpret hundreds of thousands of very small programs.
   Essentially, a GPGPU pipeline is a kind of parallel processing between one or more GPUs and CPUs that analyzes data as if it were in image or other graphic form. While GPUs operate at lower frequencies, they typically have many times the number of cores. Thus, GPUs can process far more pictures and graphical data per second than a traditional CPU. Migrating data into graphical form and then using the GPU to scan and analyze it can create a large speedup.
   Section::::GPU vs. CPU.
   A CUDA enabled GPU is currently required to use this library, although there is an OpenCL prototype available. GPULib provides more capabilities depending on the capability of the graphics processing unit (GPU) being used. For example, double-precision calculations and the ability to transfer data concurrently with computations are not provided by all GPUs, but GPULib supports these operations on GPUs which are capable of performing them.
   Both AMD and Intel have introduced CPUs and motherboard chipsets which support the integration of a GPU into the same die as the CPU. AMD markets CPUs with integrated graphics under the trademark Accelerated Processing Unit (APU), while Intel markets similar technology under the "Intel HD Graphics and Iris" brands. With the 8th Generation Processors, Intel announced the Intel UHD series of Integrated Graphics for better support of 4K Displays. Although they are still not equivalent to the performance of discrete solutions, Intel's HD Graphics platform provides performance approaching discrete mid-range graphics, and AMD APU technology has been adopted by both the PlayStation 4 and Xbox One video game consoles.
   The following figure illustrates the execution flow of launching an OpenCL program on a GPU device. The CPU first detects OpenCL devices (GPU in this case) and than invokes a just-in-time compiler to translate the OpenCL source code into target binary. CPU then sends data to GPU to perform computations. When the GPU is processing data, CPU is free to process its own tasks.
  
  Section::::GPU Programming Languages.:C++ Amp.
  
  C++ Amp is a programming model proposed by Microsoft. C++ Amp is a C++ based library designed for programming SIMD processors
  
  Section::::GPU Programming Languages.:OpenAcc.
   gpasm, the GNU PIC assembler, was originally developed by James Bowman and released as version 0.0.3 on July 13, 1998. Craig Franklin extended gpasm into an entire suite of assembler- and linker-related tools and renamed the project to gputils, releasing gputils 0.0.4 on March 4, 2001. The project is currently maintained by David Barnett. GPUTILS was created by Craig Franklin and James Bowman. Currently, it is primarily supported by Molnár Károly. Until recently has been supported Borut Ražem. In the past it has been supported by David Barnett, Scott Dattalo and Marko Kohtala .
  
  Section::::See also.
  
  BULLET::::- Gpsim
  
  Section::::External links.
   With the emergence of deep learning, the importance of GPUs has increased. In research done by Indigo, it was found that while training deep learning neural networks, GPUs can be 250 times faster than CPUs. The explosive growth of Deep Learning in recent years has been attributed to the emergence of general purpose GPUs. There has been some level of competition in this area with ASICs, most prominently the Tensor Processing Unit (TPU) made by Google. However, these can require changes to existing code and GPUs are still very popular.
  
  Section::::Computational functions.:GPU accelerated video decoding.
   As GPUs advanced (especially with GPGPU compute shaders) they have developed progressively larger and increasingly general caches, including instruction caches for shaders, exhibiting increasingly common functionality with CPU caches. For example, GT200 architecture GPUs did not feature an L2 cache, while the Fermi GPU has 768 KB of last-level cache, the Kepler GPU has 1536 KB of last-level cache, and the Maxwell GPU has 2048 KB of last-level cache. These caches have grown to handle synchronisation primitives between threads and atomic operations, and interface with a CPU-style MMU.
  
  Section::::Examples of hardware caches.:DSPs.
   GPUs have very large register files, which allow them to reduce context-switching latency. Register file size is also increasing over different GPU generations, e.g., the total register file size on Maxwell (GM200) and Pascal GPUs are 6 MiB and 14 MiB, respectively. By comparison, the size of a register file on CPUs is small, typically tens or hundreds of kilobytes. 
  
  Section::::GPU vs. CPU.:Energy efficiency.
  
  Several research projects have compared the energy efficiency of GPUs with that of CPUs and FPGAs.
  
  Section::::Stream processing.
   The term "GPU" was coined by Sony in reference to the 32-bit Sony GPU (designed by Toshiba) in the PlayStation video game console, released in 1994.
   Panfrost is a reverse-engineered driver effort for Mali Txxx (Midgard) and Gxx (Bifrost) GPUs. Introducing Panfrost talk was presented at X.Org Developer's Conference 2018. As of May 2019, the Panfrost driver is part of the mainline Linux kernel.
  
  Section::::See also.
  
  BULLET::::- Adreno – GPU developed by Qualcomm (formerly AMD, then Freescale)
  
  BULLET::::- Atom family of SoCs – with Intel graphics core, not licensed to third parties
  
  BULLET::::- AMD mobile APUs – with AMD graphics core, licensed to Samsung
  
  BULLET::::- PowerVR – by Imagination Technologies
   GPU (disambiguation)
  
  A GPU, or Graphics Processing Unit, is a special stream processor used in computer graphics hardware.
  
  GPU may also refer to
  
  BULLET::::- Gambia Press Union
  
  BULLET::::- General Public Utilities, a defunct American electric utility
  
  BULLET::::- General Purpose Uniform, of the Royal Australian Air Force
  
  BULLET::::- Global Peace and Unity, an annual Muslim conference
  
  BULLET::::- Ground power unit, used to power aircraft on the ground
  
  BULLET::::- State Political Directorate (Russian: , "Gosudarstvennoye Politicheskoye Upravlenie"), the secret police of the RSFSR and USSR until 1934...
   GPU supports API extensions to the C programming language such as OpenCL and OpenMP. Furthermore, each GPU vendor introduced its own API which only works with their cards, AMD APP SDK and CUDA from AMD and Nvidia, respectively. These technologies allow specified functions called compute kernels from a normal C program to run on the GPU's stream processors. This makes it possible for C programs to take advantage of a GPU's ability to operate on large buffers in parallel, while still using the CPU when appropriate. CUDA is also the first API to allow CPU-based applications to directly access the resources of a GPU for more general purpose computing without the limitations of using a graphics API.
   With the introduction of the GeForce 8 series, which was produced by Nvidia, and then new generic stream processing unit GPUs became a more generalized computing device. Today, parallel GPUs have begun making computational inroads against the CPU, and a subfield of research, dubbed GPU Computing or GPGPU for "General Purpose Computing on GPU", has found its way into fields as diverse as machine learning, oil exploration, scientific image processing, linear algebra, statistics, 3D reconstruction and even stock options pricing determination. GPGPU at the time was the precursor to what we now call compute shaders (e.g. CUDA, OpenCL, DirectCompute) and actually abused the hardware to a degree by treating the data passed to algorithms as texture maps and executing algorithms by drawing a triangle or quad with an appropriate pixel shader. This obviously entails some overheads since we involve units like the Scan Converter where they aren't really needed (nor do we even care about the triangles, except to invoke the pixel shader). Over the years, the energy consumption of GPUs has increased and to manage it, several techniques have been proposed.
   A graphics processing unit (GPU), also occasionally called visual processing unit (VPU), is a specialized electronic circuit designed to rapidly manipulate and alter memory to accelerate the building of images in a frame buffer intended for output to a display. Because of the large degree of programmable computational complexity for such a task, a modern video card is also a computer unto itself.
  
  Section::::Parts.:Heat sink.
   Most video cards are not limited to simple display output. Their integrated graphics processor can perform additional processing, removing this task from the central processor of the computer. For example, Nvidia and AMD (previously ATI) produced cards render the graphics pipeline OpenGL and DirectX on the hardware level. In the later 2010s, there has also been a tendency to use the computing capabilities of the graphics processor to solve non-graphic tasks.
   Section::::GPU Programming Languages.
  
  Currently, there are several existing programming languages or interfaces which support GPGPU programming.
  
  Section::::GPU Programming Languages.:CUDA.
  
  CUDA is the standard interface to program NVIDIA GPUs. NVIDIA also provides many CUDA libraries to support DSP acceleration on NVIDIA GPU devices.
  
  Section::::GPU Programming Languages.:OpenCL.
  
  OpenCL is an industrial standard which was originally proposed by Apple Inc. and is maintained and developed by the Khronos Group now. OpenCL provides C++ like APIs for programming different devices universally, including GPGPUs.
   Hollywood (graphics chip)
  
  Hollywood is the name of the graphics processing unit (GPU) used in Nintendo's Wii video game console. It was designed by ATI (now AMD), and is manufactured using the same 90 nm CMOS process as the "Broadway" processor. Very few official details were released to the public by Nintendo, ATI, or IBM. The Hollywood GPU is reportedly based on the GameCube's "Flipper" GPU and is clocked 50% higher at 243 MHz, though none of the clock rates were ever confirmed by Nintendo, IBM, or ATI.
   In the early days, GPGPU programs used the normal graphics APIs for executing programs. However, several new programming languages and platforms have been built to do general purpose computation on GPUs with both Nvidia and AMD releasing programming environments with CUDA and Stream SDK respectively. Other GPU programming languages include BrookGPU, PeakStream, and RapidMind. Nvidia has also released specific products for computation in their Tesla series. The technology consortium Khronos Group has released the OpenCL specification, which is a framework for writing programs that execute across platforms consisting of CPUs and GPUs. AMD, Apple, Intel, Nvidia and others are supporting OpenCL.
  