import hou from multiprocessing import Pool def create_geo(type): node = hou.node("/obj/geo1") def demo(): type = ["sphere", "tube", "box"] with Pool() as pool: pool.map(create_geo, type) def main(): demo() main()
Python Multiprocessing in Houdini
1278 2 1- TRex92
- Member
- 43 posts
- Joined: 12月 2012
- Offline
is it possible to run this code using a python node? Every time I try to run the code Houdini ends up freezing. Seems like you can't use the multiprocessing module does anyone know if this is the case?
- antc
- Member
- 327 posts
- Joined: 11月 2013
- Offline
No that's not going to work for a multitude of reasons. The multiprocessing module is spinning up a bunch of child processes to perform the work, and so the computed result has to be returnable to the parent process as a value. Your example tries to create a new node in the child process which (even if it worked via a correctly bootstrapped hython process) couldn't be passed back to Houdini as a value.
A python node is even further restricted - you're expected to only change the data local to the node. Exactly what that data is varies by context.
A python node is even further restricted - you're expected to only change the data local to the node. Exactly what that data is varies by context.
Edited by antc - 2022年8月18日 15:16:24
- TRex92
- Member
- 43 posts
- Joined: 12月 2012
- Offline
-
- Quick Links