Using int index where double is expected in C++ AMP retrict(direct3d) code
Googling didn’t help much, has anyone used AMP?
In the code snippet below the cast from integer to double (double v = idx.x) leads to a “Failed to create shader” run time error. I thought the restrict(direct3d) would have alerted me of things the GPU won’t be able to handle during compile time. Is there an alternative to pow() – or will I have to write a loop to do that?
concurrency::array_view<double,1> prices = …
concurrency::parallel_for_each(
prices.grid, [=](index<1> idx) mutable restrict(dire开发者_如何学运维ct3d) {
double v = idx.x;
prices[idx] = concurrency::pow(u, v);
…
please see our explanation of double support for GPUs on Windows, and also the C++ AMP math library http://blogs.msdn.com/b/nativeconcurrency/archive/2012/02/08/math-library-for-c-amp.aspx http://blogs.msdn.com/b/nativeconcurrency/archive/2012/02/07/double-precision-support-in-c-amp.aspx
If you still have a question, feel free to post back. Also please tag your questions with c++amp so we have a better chance of finding them.
精彩评论