<h3>Introduction</h3>
GPUs are really good at doing math. The Achilles heel is when it comes to 64-bit double precision math. GPUs, at least consumer grade, are not built for high performance FP64. This is because they are targeted towards gamers and game developers, who do not really care about high precision compute. So vendors like NVIDIA and AMD do not cram FP64 compute cores in their GPUs.

For example, on a GTX 780 Ti, the FP64 performance is 1/24 FP32. Which means in an ideal case, running the same code by only changing float types to double types, would yield the single precision run time to be about 1/24th of the double precision time (time(F32) = time(FP64)/24.

Keep in mind, for compute-bound algorithms, such as GEMM and FFT, the theoretical best case for FP64 performance is 1:2 FP32, simply because it involves computing with double the number of bits as FP32. If the algorithms are memory bound, such as matrix transpose, then most GPUs will attain the 1:2 performance. The numbers we discuss below will all be compute-bound performance numbers.

How double precision performs really depends on the architecture of the GPU.

<h3>Comparing NVIDIA GPUs</h3>
Lets take three almost identical cards: <a href="http://www.geforce.com/hardware/desktop-gpus/geforce-gtx-780-ti" target="_blank">GTX 780 Ti</a>, <a href="http://www.geforce.com/hardware/desktop-gpus/geforce-gtx-titan-black" target="_blank">GTX Titan Black</a> and the <a href="http://www.nvidia.com/object/tesla-servers.html" target="_blank">Tesla K40c</a>. All are Kepler <a href="http://www.nvidia.com/content/PDF/kepler/NVIDIA-Kepler-GK110-Architecture-Whitepaper.pdf" target="_blank">GK110</a> based GPUs, with the same number of SMX and cores (15 SMX, 2880 cores) and the same bus width (384-bit). The 780 Ti and Titan Black even have nearly same base clock speeds (~880MHz; K40c is 745MHz) and identical memory clock speeds (7GHz; K40 is 6GHz).

<strong>Single Precision Performance</strong>
With respect to single precision performance, all three are fairly in the same ball park. Which the 780 Ti and Titan Black sit just around 5.1 TFlops, owing to their similar clock speeds, the Tesla K40c drops in at 4.3 TFlops. You could give the Tesla a pass because it has a lower clock speed.

All three only vary significantly in three categories.

<strong>1. Memory</strong>
This doesn't affect performance very much (at least when the sizes fit in all GPUs). The price difference based on market prices of other GPUs with similar memory size variations should not be that big either.

<strong>2. Price</strong>
At launch, the GTX 780 Ti was priced at $699, $999 for the Titan Black and an estimated $5500 for the K40c. Well, that escalated quickly.
(Price Sources: <a href="http://www.anandtech.com/show/7492/the-geforce-gtx-780-ti-review" target="_blank">GTX 780 Ti</a>, <a href="http://www.anandtech.com/show/7765/nvidias-geforce-gtx-titan-black-no-compromises-for-gaming-compute" target="_blank">GTX Titan Black</a>, <a href="http://www.anandtech.com/show/7521/nvidia-launches-tesla-k40" target="_blank">K40</a>)

<strong>3. Double Precision Performance</strong>
So if the 780 Ti and the Titan Black are practically the same in every respect, why is there a $300 difference in their price at launch (discounting memory size difference)?

The answer is in the double precision capabilities. The 780 Ti is physically locked at 1:24 FP32 where has the Titan Black has an ace up it's sleeve.

For the Titan Black, the magic happens in the driver. The Titan black's driver gives the user an option to choose the double precision performance between 1:3 and 1:24 FP32 (by switching the GPU to TCC mode). When the double precision performance is set to 1:24 FP32, which is the same as the 780 Ti, the the single precision performance of the Titan Black and 780 Ti are identical. But when the user sets the double precision performance to 1:3 FP32, the single precision performance is compromised to boost double precision performance and make it equal to the K40c. In other words, you can choose the performance of the Titan Black to match either the 780 Ti or the K40c based and your preference.

The K40c has a double precision performance of 1:3 without compromising the single precision performance. This is because the K40 is given a special double precision unit for every 3 single precision cores (<a href="http://www.nvidia.com/content/PDF/kepler/NVIDIA-Kepler-GK110-Architecture-Whitepaper.pdf" target="_blank">white paper</a>). It combines the best of both worlds. NVIDIA also states that the Tesla GPUs go through a much more rigorous Q&A process which guarantees lesser failures and also has additional features such as ECC memory. Hence the large price difference.

<h4>Summary of NVIDIA GPUs</h4>
<strong>NVIDIA's GTX series</strong> are known for their great FP32 performance but are very poor in their FP64 performance. The performance generally ranges between <strong>1:24 (Kepler) and 1:32 (Maxwell)</strong>. The exceptions to this are the GTX Titan cards which blur the lines between the consumer GTX series and the professional Tesla/Quadro cards.

The <strong>Kepler architecture Quadro and Tesla series</strong> card provide full double precision performance with <strong>1:3 FP32</strong>. However, with the <strong>Quadro M6000</strong>, NVIDIA has decided to provide only minimal FP64 performance by giving it only <strong>1:32 of FP32 capability</strong> and touting the M6000 as the best graphics card rather than the best graphics+compute card like the Quadro K6000.

<h3>AMD GPUs</h3>

AMD GPUs perform fairly well for FP64 compared to FP32. Most AMD cards (including consumer/gaming series) will give between <strong>1:3 and 1:8 FP32 performance for FP64</strong>. The AMD Tahiti architectures tested in these benchmarks here do not suffer from the same problems FP64 problems as NVIDIA's GTX series and give a 1:4 performance. Newer Hawaii architecture consumer grade GPUs are expected to provide 1:8 performance.

The <strong>FirePro W9100, W8100 and S9150 will give you an incredible FP64 1:2 FP32 performance</strong>.

Overall, AMD GPUs hold a reputation for good double precision performance ratios compared to their NVIDIA counterparts.

<h3>Benchmarks</h3>
Here are some benchmarks comparaing FP32 and FP64 GEMM.
<iframe width="600" height="371" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/1gEjX5751zdYWom0_JG1FFLhM17l0OyWbUgWK90of59Q/pubchart?oid=381229711&amp;format=interactive"></iframe>
<iframe width="600" height="371" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/1gEjX5751zdYWom0_JG1FFLhM17l0OyWbUgWK90of59Q/pubchart?oid=722963661&amp;format=interactive"></iframe>
<iframe width="600" height="371" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/1gEjX5751zdYWom0_JG1FFLhM17l0OyWbUgWK90of59Q/pubchart?oid=1083990145&amp;format=interactive"></iframe>
<iframe width="600" height="371" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/1gEjX5751zdYWom0_JG1FFLhM17l0OyWbUgWK90of59Q/pubchart?oid=1438814030&amp;format=interactive"></iframe>

<h3>Conclusion</h3>
There is no perfect solution to the problem of choosing between FP32 and FP64 when it comes to GPUs. The best users can do is to decide whether they need the accuracy of double precision compute and how much compute they need, eventually going for a GPU that maximizes their productivity. Some applications like physics modelling and simulation, high accuracy financial computations etc which call for double precision accuracy at high performance require capable FP64 cards. Applications such as image and video processing, signal processing, statistics may not require such high precision and can get away with high FP32 performance only.

Disclaimer: We receive GPUs from both NVIDIA and AMD. However, this blog does not promote or advocate any specific vendor.

Sources:
Wikipedia: <a href="https://en.wikipedia.org/wiki/GeForce_700_series" target="_blank">NVIDIA GeForce 700 Series</a>, <a href="https://en.wikipedia.org/wiki/Nvidia_Tesla" target="_blank">NVIDIA Tesla Series</a>, <a href="https://en.wikipedia.org/wiki/Nvidia_Quadro" target="_blank">NVIDIA Quadro Series</a>, <a href="https://en.wikipedia.org/wiki/List_of_AMD_graphics_processing_units#Comparison_table:_Workstation_GPUs" target="_blank">AMD FirePro Series</a>, <a href="https://en.wikipedia.org/wiki/List_of_AMD_graphics_processing_units" target="_blank">AMD GPUs</a>
NVIDIA Website: <a href="http://www.geforce.com/hardware/desktop-gpus/geforce-gtx-780-ti" target="_blank">NVIDIA GTX 780 Ti</a>, <a href="http://www.geforce.com/hardware/desktop-gpus/geforce-gtx-titan-black" target="_blank">NVIDIA GTX Titan Black</a>, <a href="http://www.nvidia.com/object/tesla-servers.html" target="_blank">NVIDIA Tesla K40</a>
Anandtech: <a href="http://www.anandtech.com/show/7492/the-geforce-gtx-780-ti-review" target="_blank">NVIDIA GTX 780 Ti</a>, <a href="http://www.anandtech.com/show/7765/nvidias-geforce-gtx-titan-black-no-compromises-for-gaming-compute" target="_blank">NVIDIA GTX Titan Black</a>, <a href="http://www.anandtech.com/show/7521/nvidia-launches-tesla-k40" target="_blank">NVIDIA Tesla K40</a>