Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
69 Views

Ray packets performance

Jump to solution

Hi!

I'm using Embree for solving some collision-related tasks within my project. The average vertex count for the meshes within my working scene is ~5K. So, I'm determining the distance between 2 meshes along some direction by just iteratively calling rtcIntersect1() for rays segments with origin set to current vertex and the direction set to the mentioned above. All the rays are coherent as they use the direction.

Can I benefit from using the ray packet versions of rtcIntersect to get the total amount of queries N times less (N = 4,8,16) by just switching from the loop of single-ray queries to a N times shorter loop with packet queries? Or do I need some tricky ray packet setting with rays being set very close to each other within the single packet?

Also the minor question: can I safely use single ray intersection query for the same scene from several threads (each thread is supposed to run its own set of intersection queries from different origins in the same scene)?

Thank you in advance for answering.

Tags (2)
0 Kudos

Accepted Solutions
Highlighted
Employee
46 Views

Hi,

yes you can call rtcIntersect from multiple threads as there's NO synchronization mechanism within rtcIntersect. If you have multiple CPU cores in your system and each thread is running on a separate core you should observe a linear speedup, e.g. with 4 cores you should see 4 times reduction in run-time.

View solution in original post

3 Replies
Highlighted
Employee
60 Views

From your description it seems the rays inside the packet could have enough coherence so that ray packet traversal (rtcIntersect4/8/16) would provide a benefit. The rays inside the packet do not have to share a common origin. Just give it a try and simply use a N times shorter loop. Also you can safely use rtcIntersect from multiple threads at the same time.

Highlighted
Novice
51 Views

Hi BenthinC!

Could you please clarify on calling rtcIntersect from multiple threads, please?

Is there any data synchronization mechanism used within rtcIntersect (like, mutex)?

Say, I have M (~2-3k) single ray tracing queries. What exact benefit (measured in times) is expected from splitting this amount to N threads (each will execute the M/N queries) for N =10?

Thanks

0 Kudos
Highlighted
Employee
47 Views

Hi,

yes you can call rtcIntersect from multiple threads as there's NO synchronization mechanism within rtcIntersect. If you have multiple CPU cores in your system and each thread is running on a separate core you should observe a linear speedup, e.g. with 4 cores you should see 4 times reduction in run-time.

View solution in original post