-
Notifications
You must be signed in to change notification settings - Fork 582
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
pyembree ray casting acceleration #875
Comments
Hey, it could be the locatation calculation that's slow (happy to take speedup PR's!). I'd try running your code in a profiler like pyinstrument for details. Might also be worth checking to make sure it's actually using pyembree and not falling back to the native ray checks:
|
@mikedh thanks for the prompt response. Hhmm, it seems that in my case it uses the
Any idea though why? Can I somehow force it to use the |
It's probably wrapping an import error, what does this raise:
|
it gives me the following:
I guess something is wrong with my |
Yeah exactly. You can check the install with just |
no I installed it manually with Does it make any difference which version of embree I have installed? I know that it should be a v.2x thus in my case I installed the latest which is v2.17. |
Also upgrading to embree 2.17.7 also significantly sped up my ray-casting, and the results look to be identical. |
@aluo-x thanks for sharing this. Can you give some details how did you install embree v2.17.7 instead of v.2.14 on your conda environment (I guess you are using conda). In my case I managed to make my project to find pyembree by creating a conda environment (still though I could not figure out why it does not work with the pip installation). They way I've installed embree and pyembree in my conda environment is by following these steps scopatz/pyembree#14 (comment). |
just to mention that now with the embree (v2.14) acceleration the ray casting is by far much faster in comparison to the fallback native solution. However, I wouldn't mind getting some more based on what @aluo-x mentioned and using embree v.2.17.7. Also it seems that there is a new wrapper which tries to provide direct access to the embree v3 api (https://github.com/sampotter/python-embree). |
So basically, embree 2.17.7 is as far as I know the latest compatible version with the embree python package. To use it:
|
Thanks for sharing @aluo-x. In my case though using v2.17.7 instead of v2.14 did not provide any significant acceleration. |
Sorry to hear that. I have a very modern CPU with 20+ cores. I was also surprised to see a speed increase. |
I see, in my case I am applying this on a 6 core modern laptop :-p. In any case, in comparison to my previous situation now I am in a much better situation. I am curious to see though if using Embree v3 with the other linked wrapper I'll see any difference. |
Yeah if you're on linux x86_64 you could also use the bash script we use to install in docker which uses embree 2.17.7:
|
Hi @mikedh and thanks for the nice work with
trimesh
. I am quite new with it but it really gets in hand.My question now is related with the ray casting approach based on the
pyembree
acceleration. I need to ray cast quite a few rays in a 3D scene, approx. 18060108 rays and maybe even more. Imagine that I have a scene with 16676 faces and from each face center I need to cast 1083 rays (i.e. 16676x1083 = 18060108).As you understand I want to avoid
for
loops and I cast all the rays at once. Also I am using thepyembree
based solution, as it states to accelerate the casting procedure in comparison to normal version, as follows:but this seems to perform quite slow as well, even though I am using
pyembree
acceleration. Is this the best I can get or I am doing something wrong?The text was updated successfully, but these errors were encountered: