openxrlab / xrfeitoria

OpenXRLab Synthetic Data Rendering Toolbox
https://xrfeitoria.readthedocs.io
Apache License 2.0
244 stars 19 forks source link

Multiprocessing support? #21

Closed doctorwho479 closed 2 months ago

doctorwho479 commented 10 months ago

Thank you for your open-source work! May I ask if this tool supports multiprocessing? I would like to render a large number of 3D models in multiprocessing. In each process, I use xf.init_blender to create a scene, and then import a model for rendering. However, I have some confusion regarding xf.init_blider(exec_path=engine_exec_path, new_process=True). If I use new_process=True, the error is RuntimeError: RPC server in RPC_PORT=9997 already started! This is raised when calling init_blender or init_unreal with new_progress=True when an existing server (blender or unreal) is already running. If I use new_process=False, the error is ValueError: Invalid name, '[XF]actor-001' already exists in scene. or KeyError: '\'\\\'bpy_prop_collection[key]: key "[XF]actor-001" not found\\\. There seems to be a conflict between different processes. Could you help me? Or whether multiprocess is useful, I want to use it because I find gpu utilization is very low.

HaiyiMei commented 10 months ago

Yes, you can do it, please refer to this part. As for if it's useful in multiprocessing, that depends. Usually, 2 threads would help.