Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Computations carried out on GPUs are hardly ever deterministic.

Things happen in parallel and as we known not even something as basic as adding up a bunch of floats is associative. Combining that with the fact that CUDA makes few guarantees about the order your operations will be carried out (at the block level) makes true deterministic behavior unachievable.



Thank you! That really helped me understand this issue.

I got ChatGPT Code Interpreter to generate an example for me:

    a = 0.1
    b = 0.2
    c = 0.3
    result1 = (a + b) + c
    result2 = a + (b + c)
    (result1, result2, result1 == result2)
Output:

    (0.6000000000000001, 0.6, False)


Interestingly when I copy paste your example I get true. Perhaps that itself is the example




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: