GPRT integration - #94
Conversation
|
@pshriwise Thanks for the help getting started with the CI! I have added an extra job to the CI workflow to explicitly set some vulkan-sdk environment variables to fix the issue where the workflow was failing when attempting to compile spirv code. I also switched back to ubuntu-latest for the container image for the runner since it was having issues with mismatched glibc references between MOAB/libmesh and XDG. The CI workflow is successfully building XDG with GPRT and passing now but it looks like the OpenMC-Testing workflow is still failing. |
Ah yeah I think I was making similar changes for the OpenMC workflow to add the VULKAN_SDK and GPRT, but at this point I don't think that makes sense. I've reverted those changes. Once we're testing GPRT with OpenMC transport we can add those changes back in. At that point it probably makes sense to combine the OpenMC testing into the CI workflow as they're doing pretty much the same thing at that point. |
|
Ah, as you mentioned though GPRT is a requirement at the moment. Can you make it optional with an |
GPRT should now be disabled by default. I can see a scenario in which we may have multiple GPRT based tools in which case it makes sense for them to potentially be separate? The latest commit restructures the If in the future we did have more tools though we would probably want another directory layer to separate out the shader code for each tool though. Something like this: |
|
When attempting to link gprt to xdg in the CMakeLists.txt, I was encountering a CMake error to do with GPRT not exporting install targets: This error would be thrown but CMake would still generate the Makefile and XDG could be compiled as normal with tests passing and installation still seemingly working. As a work around for this CMake error I have changed the following line in the CMakeLists.txt: |
|
Made a PR #100 to expose methods in the mesh manager to return a flattened array of a surface's vertices and triangle/element connectivity - this should help in the efforts to triangle data to device in GPRT. |
|
Merged a bunch of changes I had on a separate branch in my fork. This is mostly me just experimenting with trying to get single precision h5m meshes read into GPRT. At this point looks like its working. Changes with this merge:
More details of the progress made has been documented in this issue Waqar-ukaea#3 |
|
Description copied below from a PR into this branch from my fork Waqar-ukaea#5: Quite a lot of new stuff in here and all of it is still super experimental. I've been playing around with what the internal XDG-GPRT interface will look like with the There is still a lot of placeholder at the moment and random comments here and I need to verify that the device is actually doing what I think it is supposed to be doing within the Edit 2025/05/15 - The raygen shader is working as it should with origins/directions correctly passed to it. The problem is that every ray is missing when there should be hits - so only the miss shader is being run (hence why All of this work essentially builds on from what I learnt producing my first simple gprt-test tool with XDG. That tool has all of the GPRT calls contained within its Some extra notes:
|
|
I've marked this PR as ready for review since I now have Current status:
There are probably more things to note and we may want to address some more of these issues before merging into main. But that being said, this branch is in a pretty workable/stable state now. |
|
A note about passing data between shader stages. I had a lot of trouble with silent hangs when trying to transfer data between raygen and intersection. I'm not sure if I am missing something but this is my understanding from a lot of annoying troubleshooting:
Previously in the h5m reader we had explicit But I have not been able to recreate this functionality with GPRT anymore. The main issue seems to be that the geometry data is seen as read only once the shader pipeline is started, so any attempts to write to the data causes silent hangs. Instead I have opted to define a buffer for double precision rays on the host, where both This could be pretty easily extended to a function which loops over an array of origins/directions where the buffer |
|
Latest commit has some debugging prints in place to compare embree vs gprt ray-fires I have got the GPRT branch to a state where all of the ray-fire tests (on our simple mesh mock) are passing. However there are still problems when trying to fire certain rays against more complex meshes. When trying to run the particle sim on the jezebel.h5m mesh I see a ray which should return a hit returning no intersections. A table summarising the debug outputs I've produced between the two RT libraries for the following ray-fires:
So the vertices' coords match between the two RT implementations but the order of them is different between the two implementations? A further update on this - apparently moving the ray off of the origin has drastic effects on the results. A ray launched in the same direction as the one above but from the origin produces identical results between embree and gprt:
But as soon as we move off of the origin they no longer match:
What could be causing this? |
3fe0c79 to
756ee36
Compare
|
@pshriwise I think this is in a position where its ready to review. I've rebased all the changes from main and fixed any conflicts which arose because of them. All tests are currently passing except find_element tests with MOAB. I'll dig into that a little bit more. But all of the stuff around GPRT is ready to be reviewed. Let me know if you have any trouble with getting things to build etc. I have been changing some file structures and CMake configs so have perhaps missed something which should have been comitted. One thing to note as well is that I still never managed to resolve this https://github.com/pshriwise/xdg/pull/94#issuecomment-2796476896 so I will create a separate issue for it. |
This issue has been resolved with commit pshriwise@9881e08 which updates the test_files subproject commit to check out. Presumably I was still on a version which did not have volumetric elements in the models. |
…before returning to host
…can be used everywhere
Added linker option to ignore unresolved references in shared libs Ensure GPRT Install targets are installed now that we are using a shared library
…orting in skipped tests
| - name: Build | ||
| shell: bash | ||
| run: | | ||
| export LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH |
There was a problem hiding this comment.
I understand that this isn't straightfoward to figure out, but these days we really shouldn't need to set this environment variable for a CMake project. For now I'll create an issue so we don't lose track of it.
There was a problem hiding this comment.
I previously assumed this wasn't too much of an issue, more so from a place of ignorance in not really being familiar with RPATHs. But after having done some reading, I agree we should hold off on merging until I figure this one out too.
pshriwise
left a comment
There was a problem hiding this comment.
@Waqar-ukaea Thanks so much for all your effort in this PR. It's really cool to see DAGMC geometry running on GPU, even as the first cut. Plenty of room to grow from here!

This will be a large PR which will likely consist of many smaller PRs in the hopes of bringing the General Purpose Raytracing Toolkit (GPRT) into XDG to enable GPU the capability to work with GPUs. The idea will be that GPRT could be specified as an optional to build the XDG library with at compile time. This PR will aim to close out a number of existing issues and will probably inform a bunch of new ones too.
TODO
I'm sure there are more tasks which I haven't captured yet and will have to have a think about which ones map to their own PRs/issues.
14/05/2025
XDG-GPRTinterface in a new classGPRTRayTracerwhich inherits our generic ray tracer interface base class.gprt-particle-simwhich is essentially theparticle-simtool but making use ofGPRTinstead ofEmbreefor ray tracing operations. If this becomes a fully featured tool it can probably be merged into the otherparticle-simtool with the options to choose ray tracing back-end properly exposed.30/04/2025
gprt-testtool to ray trace against a h5m mesh in single precision.07/04/2025
31/03/2025
gprt-test. This program creates an XDG instance from ah5mmesh passed as a command line argument at runtime and then goes on to create a GPRT context where theS_2_0_TriangleHitssample program from GPRT is loaded.