-
Notifications
You must be signed in to change notification settings - Fork 60
Allow Phonon_simple to accept more than 1 solution #2094
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
Merge newest commit to phonon branch
Make sure that vf_list has length of 100 and allow the user to choose the amount of scan steps actually taken, if they need to optimise the instrument. This counteracts overflow of vf_list. Also change from parms array to parms struct in order to improve readability.
|
@Lomholy thanks, will have a closer look later - but one non-McStas-3 (and GPU friendly) feature you added is the structure that contains mixed component and neutron data... They must be separated to avoid thread collisions on GPU. Functions applied in |
|
Just to quickly illustrate the collision issue, I get megabytes of these "FATAL ERROR" messages running on GPU - and the results are completely off ;-) |
|
Why not simply use the normal particle struct? |
|
I reckoned that particle struct didn't have the intermediate values that will be changed during the calculations |
|
Would you make a struct that wraps the particle struct inside it? I don't think I am quite following you there |
|
…and general mcstas logic
|
When I wrote the intermediate values i meant the unit vector of the incoming neutron, and the candidate final velocities for the algorithm etc. |
|
Once I patch your version of the code in the direction indicated above, the code compiles on GPU but crashes... (Still very likely a thread-collision issue...) I will likely start from fresh on a new branch and implement your changes one by one / add safety belts on the way... Stay tuned. |
…allow correct GPU execution. Secondary changes: 1. calloc not available on gpu (in TRACE), use malloc 2. Don't use e_steps_low*e_steps_high but e_steps_low+e_steps_high for array allocation 3. Cosmetics to comp header
|
@Lomholy I finally got the code to agree (to within machine precision) between GPU and cpu. I in essence overlooked the changes in findroots that did not make it across to findroots_gpu.
I am in principle ready to merge - but please confirm that my observation wrt. required length of vf_list is correct: I.e. that the the number of solutions is |
|
I can confirm your observation. Must've missed that one 😅
…On Wed, 20 Aug 2025, 14:27 Peter Willendrup, ***@***.***> wrote:
*willend* left a comment (mccode-dev/McCode#2094)
<#2094 (comment)>
@Lomholy <https://github.com/Lomholy> I finally got the code to agree (to
within machine precision) between GPU and cpu. I in essence overlooked the
changes in findroots that did not make it across to findroots_gpu.
Screenshot.2025-08-20.at.14.25.20.png (view on web)
<https://github.com/user-attachments/assets/37594a93-8d68-4214-ab9c-0c5880a845c9>
I am in principle ready to merge - but please confirm that my observation
wrt. required length of vf_list is correct: I.e. that the the number of
solutions is e_steps_low+e_steps_high and not e_steps_low*e_steps_high...
:-)
—
Reply to this email directly, view it on GitHub
<#2094 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2SYLP6WGPG5GRPTITTBFPL3ORSUBAVCNFSM6AAAAACD4CXLSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEMBWGEYDMMBQGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
OK @Lomholy then I will proceed to merge. I have on my list to look at the Bent mono also in respect to the GPU side. |

Allows Phonon_simple to use more than 1 solution, by removing an if statement, and extending the vf_list to be as long as the new input parameters, that allow for finetuning scan steps below and above the elastic line.
Also change the parms array to be a struct, containing names of the parameters.