Conversation
Apparently, this line of code: " float inv_ds = rsqrt(ds2 + EPS2) * (__float_as_int(pos_i.w.y) != __float_as_int(pos_j.w.y)); " which should result in "inv_ds==0" for "i==j" results in "inv_ds==NaN" for "i==j" for modern CUDA versions. We suspect that for older CUDA versions this worked well and resulted in "inv_ds==0" for "i==j", i.e. for fictious self-gravitation - which we exclude, of course. Most likely, older CUDA versions did not comply with IEEE 754.
See https://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/html/group__CUDART__THREAD__DEPRECATED_gf423ba04af587d42b52799455a7c094d.html: "cudaThreadExit" has been deprecated: " Note that this function is deprecated because its name does not reflect its behavior. Its functionality is identical to the non-deprecated function cudaDeviceReset(), which should be used instead. "
Collaborator
Author
|
I can confirm that this branch not only compiles with CUDA 13, i.e. that this fixes #1193, but also runs with CUDA 13. |
ErwanH29
approved these changes
Dec 19, 2025
Collaborator
ErwanH29
left a comment
There was a problem hiding this comment.
Tested the code on the AMUSE script sun_venus.py and it gives near identical results to the CPU mode of Ph4 in both solutions and energy conservation. I compiled and tested using CUDA 13.
Contributor
|
Checked by Erwan, and considered ok. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solves #1195
The problem was with this line:
This caused
inv_ds==NaN.Solves #1193