rdiankov / openrave

Open Robotics Automation Virtual Environment: An environment for testing, developing, and deploying robotics motion planning algorithms.
http://www.openrave.org
Other
687 stars 340 forks source link

release GIL before potentially heavy computations #1347

Closed yoshikikanemoto closed 5 months ago

yoshikikanemoto commented 6 months ago

so that other python threads can make progresses

yoshikikanemoto commented 6 months ago

tested on one actual system and AutoTester Pipeline #727062

rdiankov commented 6 months ago

One concern is that unlocking Gil for small operations might waste more CPU cycles. For example, are you sure Init function does enough computation?

yoshikikanemoto commented 6 months ago

One concern is that unlocking Gil for small operations might waste more CPU cycles. For example, are you sure Init function does enough computation?

I checked my profiling result again. KinBody::InitFromTriMesh was indeed taking time so I am sure. But I think we can assume InitFromBoxes / InitFromSpheres would finish fast. so i removed GIL unlock from there.

yoshikikanemoto commented 6 months ago

One concern is that unlocking Gil for small operations might waste more CPU cycles. For example, are you sure Init function does enough computation?

I checked my profiling result again. KinBody::InitFromTriMesh was indeed taking time so I am sure. But I think we can assume InitFromBoxes / InitFromSpheres would finish fast. so i removed GIL unlock from there.

Actually, KinBody::InitFromTriMesh was taking time on converting Python type to C++ type so unlocking GIL won't make a difference. I'll make another change.

yoshikikanemoto commented 6 months ago

Actually, KinBody::InitFromTriMesh was taking time on converting Python type to C++ type so unlocking GIL won't make a difference. I'll make another change.

done @rdiankov

rdiankov commented 5 months ago

thanks~