Search code examples
visual-c++gpgpuc++-amp

Why does the "cpu" accelerator report "No" for the supports_double_precision data member?


If you check the "cpu" accelerator with MS C++ AMP, you will get "no" for the supports_double_precision. Now, I was under the impression that a CPU has better precision than a GPU... is this just because MSVC++'s math library is not precise enough?

Example code to get the output:

#include <iostream>

#include <amp.h>

int main()
{
  std::vector<accelerator> accelerators = accelerator::get_all();
  for(const auto& accelerator : accelerators)
  {
    std::wcout << accelerator.description << "\n";
    std::wcout << (accs[i].supports_double_precision ? 
        "double precision: true" : "double precision: false") << "\n";
    std::wcout << (accs[i].supports_limited_double_precision ? 
        "limited double precision: true" : "limited double precision: false") << "\n";
  }
}

Solution

  • The cpu accelerator is not an accelerator you should be executing code on. So supporting double precision (or not) isn't really useful information.

    accelerator::cpu_accelerator Data Member : You can use this accelerator for setting up staging arrays. It cannot execute C++ AMP code. For more information, see the Staging Arrays in C++ AMP post on the Parallel Programming in Native Code blog.

    https://msdn.microsoft.com/en-us/library/hh873132.aspx

    If you want to know more about using the CPU accelerator for creating staging arrays then the MSDN page links to a blog post that has more information.

    http://blogs.msdn.com/b/nativeconcurrency/archive/2011/11/10/staging-arrays-in-c-amp.aspx