-
Notifications
You must be signed in to change notification settings - Fork 36
Keep more track members in registers in example19 #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Can one of the admins verify this patch? |
822af79 to
71fbce9
Compare
Hm, I'm feeling a bit uneasy merging something which gives different results when applied to a different example. I think we really must make an effort to understand what's going on there before we proceed with changing other examples... |
dceb689 to
5db0d5d
Compare
5db0d5d to
aeed9ef
Compare
aeed9ef to
c08531a
Compare
|
Also causes differences when activating magnetic field, cf #213 (comment) |
|
I am starting to believe there is a compiler bug involved. When computing the safety in double safety = 0;
if (!navState.IsOnBoundary()) {
const auto localPos = currentTrack.pos;
const double safety1 = BVHNavigator::ComputeSafety(localPos, navState);
const double safety2 = BVHNavigator::ComputeSafety(currentTrack.pos, navState);
if (safety1 != safety2) {
printf("safety: %.20f vs.\nsafety: %.20f\n", safety1, safety2);
printf("pos: %.20f %.20f %.20f vs.\npos: %.20f %.20f %.20f\n", localPos.x(), localPos.y(), localPos.z(), currentTrack.pos.x(),
currentTrack.pos.y(), currentTrack.pos.z());
__trap();
}
safety = safety2;
}The kernel traps and produces the following output: You can see that the inputs are (obviously) identical, but the result computed by @hahnjo do you have any idea on what we could do here? The result is marginally affected by this difference, as you observed. |
|
The last commit introduces two workarounds to reproduce the old behavior, but I would like to get rid of them. How can I proceed? |
|
Okay, that's not a compiler bug but a feature / more optimizations happening. I can get identical results before / with only the first commit by building with And same question as there: Do you want to merge the changes in this PR into #213 because they are essentially the same modification? |
|
Wow, that is awesome! Thx for finding that out! How did you discover the difference comes from
I split off the changes for example19 on purpose, because I needed the change for my LLAMA heatmaps to be more accurate and I needed the change for my ACAT22 presentation. So I hoped by just aiming in example19 I could get them in faster. Now that ACAT22 is in the past, I don't mind to combine both of them. But since you now tested that the changeset is fine, I would like to remove my workaround commit and have it merged sooner, if that is fine for you! |
The track variables are loaded at the beginning of the kernel and written back when the track survives. The signature of InitAsSecondary() had to be changed to not load from the track again. The results of the simulation change slighly because nvcc now generates a few fma instructions in different places (thx to hahnjo for finding out!).
18c7ac7 to
aca7736
Compare
No no, that's not how I want to do this. I will test all examples before merging any of this, there's no "overtaking on the right" for a single example... |
In that case, I can merge the PRs. |
Adds a lambda function to mark a tracks survival more explicit. Then keeps more track state in local registers.
example19 -batch 1000 -gdml_file ../examples/Example14/macros/testEm3.gdml, 5 time average:master+ #225:Mean: 0.200212
Stddev: 0.00043419
with this PR:
Mean: 0.18434
Stddev: 0.000701656
Depends on: