Results 1 to 6 of 6

Thread: Calculations and results on different devices

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    4

    Calculations and results on different devices

    If I use the same start data and do the same calculations, will be the results equal on different devices? Of course if there's no problems with parallelism - thread dependency etc.

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Calculations and results on different devices

    If I use the same start data and do the same calculations, will be the results equal on different devices?
    Not necessarily identical, but they will be very close. The reason is that different devices may support different rounding rounding modes, some will support denormalized floats, some not, etc. Also the result from math functions may be very slightly different within the error limits allowed by the specification.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    4

    Re: Calculations and results on different devices

    Looks like more safe solution is using fixed point numbers. But if I remember, GPUs are optimized for using floats.

  4. #4
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Calculations and results on different devices

    Unless you are doing scientific computations, the difference between devices is going to be so minimal it won't matter. If necessary, rather than using fixed point I would modify slightly my code so that it handles very small differences gracefully.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  5. #5
    Junior Member
    Join Date
    Jul 2011
    Posts
    4

    Re: Calculations and results on different devices

    I want to use OpenCL for AI, for multiplayer - so very small differences at the beginning can result in huge differences after a long time.
    In OpenCL documentation, I found:
    float - A single precision float. The float data type must conform to the IEEE 754 single precision storage format.
    Looks like there is a standard for this variable - but is "must" equal "is in real"? Or "in real" is equal:
    Quote Originally Posted by david.garcia
    The reason is that different devices may support different rounding rounding modes, some will support denormalized floats, some not, etc.

  6. #6
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Calculations and results on different devices

    I honestly can't understand your question. The representation of floats in OpenCL is identical to IEEE 754:2008. However, there's some leeway in corner cases such as behavior of denormalized floats, etc. Also, different devices may have different rounding modes. If you are only concerned about desktop devices, then round-towards-even is the default and it's guaranteed.

    More complex functions like sine, cosine, etc. may vary very slightly between devices. This is given by section 7.4 of the CL 1.1. spec. Notice that the precision of sine/cosine/etc. in C or C++ is not defined at all, so OpenCL is actually going to give you more predictable accuracy.

    Again, I would not worry about precision issues.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. Strange results
    By Rui in forum OpenCL
    Replies: 2
    Last Post: 04-07-2010, 01:29 PM
  2. GPGPU and rendering calculations on same GPU?
    By garydeng in forum OpenCL
    Replies: 4
    Last Post: 12-05-2009, 09:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •