Improve performance of Tensorflow and PyTorch modules #3550
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Retrieving properties from Tensorflow and Pytorch in our find modules is expensive because calling Python and importing either of them comes with a significant cost. Improve the performance by fetching all required properties in a single pass instead of 1 property per pass:
time cmake -DCMAKE_INSTALL_PREFIX=../bin -DBUILD_CUDA_MODULE=ON -DBUILD_UNIT_TESTS=ON -DBUILD_BENCHMARKS=ON -DBUILD_PYTORCH_OPS=ON -DBUILD_TENSORFLOW_OPS=ON -DBUNDLE_OPEN3D_ML=ON -DOPEN3D_ML_ROOT=../../Open3D-ML -DOPEN3D_THIRD_PARTY_DOWNLOAD_DIR=~/workspace/open3d-downloads -DBUILD_JUPYTER_EXTENSION=ON -DBUILD_RPC_INTERFACE=ON -DBUILD_LIBREALSENSE=ON -DBUILD_AZURE_KINECT=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
Before
real 0m19,039s
user 0m21,909s
sys 0m22,577s
After
real 0m9,561s
user 0m8,882s
sys 0m6,575s
In a future PR, the performance could be improved even further by only calling the find modules once instead of twice.
This change is