locked
AMP math Library Function differences RRS feed

  • Question

  • I notice in the documentation on MSDN that in the Math Library in the Concurrency namespace many Functions (like acos and atan) have coutnerparts prefaced with "fast_" (like fast_acos and fast_atan) while othres (like acosf) do not.

    I also notice that some Functions (like fast_abs) don't have non-fast counterparts.

    What is the difference between "fast" and non-fast versions?

    For that matter, what is the difference between acos and acosf?


    Ken Miller
    Wednesday, September 28, 2011 2:57 AM

Answers

  • Hi Ken,

    The math functions that start with "fast_" are DirectX built-in intrinsics.  They are single-precision only, and have accuracy that is good enough for gaming and visual computations (in other words, they're not terribly accurate).

    The functions without "fast_" are C99-compliant math functions that support single and double precision.  The single-precision ones have "f" appended to the name, so "acos" is a double-precision function, and "acosf" is a single-precision function.  We will publish the accuracy of these functions in the final release, but these are the ones you should use if your computations demand the most accuracy we can provide.  Note that these functions also require extended double-precision support on your hardware and driver -- even the single-precision ones, which often use double-precision under the covers to achieve the required accuracy. Extended double-precision support means your hardware and driver must support hardware division and reciprocal, and unfortunately, it is unlikely that your current cards do.  (We're working on it.  See http://social.msdn.microsoft.com/Forums/en-US/parallelcppnative/thread/f27510be-c71a-4f14-8bc7-ceca4299a8f6 for a discussion around that.)

    Thanks.


    ++don;
    • Edited by Don McCrady Wednesday, September 28, 2011 5:06 PM
    • Proposed as answer by Rahul V. PatilModerator Wednesday, September 28, 2011 6:33 PM
    • Marked as answer by K C M Thursday, September 29, 2011 1:17 PM
    Wednesday, September 28, 2011 4:30 PM
  • Ken, while I think all those models support double-precision, none of their DirectX drivers do.  It's mostly a driver issue at this point.
    ++don;
    • Marked as answer by K C M Friday, September 30, 2011 1:33 PM
    Thursday, September 29, 2011 8:54 PM

All replies

  • Hi Ken,

    The math functions that start with "fast_" are DirectX built-in intrinsics.  They are single-precision only, and have accuracy that is good enough for gaming and visual computations (in other words, they're not terribly accurate).

    The functions without "fast_" are C99-compliant math functions that support single and double precision.  The single-precision ones have "f" appended to the name, so "acos" is a double-precision function, and "acosf" is a single-precision function.  We will publish the accuracy of these functions in the final release, but these are the ones you should use if your computations demand the most accuracy we can provide.  Note that these functions also require extended double-precision support on your hardware and driver -- even the single-precision ones, which often use double-precision under the covers to achieve the required accuracy. Extended double-precision support means your hardware and driver must support hardware division and reciprocal, and unfortunately, it is unlikely that your current cards do.  (We're working on it.  See http://social.msdn.microsoft.com/Forums/en-US/parallelcppnative/thread/f27510be-c71a-4f14-8bc7-ceca4299a8f6 for a discussion around that.)

    Thanks.


    ++don;
    • Edited by Don McCrady Wednesday, September 28, 2011 5:06 PM
    • Proposed as answer by Rahul V. PatilModerator Wednesday, September 28, 2011 6:33 PM
    • Marked as answer by K C M Thursday, September 29, 2011 1:17 PM
    Wednesday, September 28, 2011 4:30 PM
  • Thanks for clearing that up Don.

    With respect to your comment regarding double-precision support...

    I've read the reference you cited, but it seems odd.

    Are you saying that the current drivers for GPUs under Win7 don't support double-precision?

    Because, if it's just under Win 8 that the drivers don't work then no worries, but without working double-precision even under Win 7 how is anyone doing any work that requires precision beyond that provided by single-precision???


    Ken Miller

    • Edited by K C M Thursday, September 29, 2011 1:31 PM
    Thursday, September 29, 2011 1:25 PM
  • We're also working with all the driver vendors as well as the DirectX team to bring full double-precision support to Windows 7.  But I can't give you any timeframe on when that will happen, and until it does, you'll have to be very mindful when using double-precision that it simply won't work on a card/driver/OS that doesn't support it.
    ++don;
    Thursday, September 29, 2011 4:01 PM
  • Are there any combinations known to work currently? I'll happily procure one of those.

    I have GTX 590s and HD6990s.

    Do the Quadro products work?

    Would a Tesla C2050 work?

     

     


    Ken Miller
    Thursday, September 29, 2011 8:35 PM
  • Ken, while I think all those models support double-precision, none of their DirectX drivers do.  It's mostly a driver issue at this point.
    ++don;
    • Marked as answer by K C M Friday, September 30, 2011 1:33 PM
    Thursday, September 29, 2011 8:54 PM