[Sidefx-houdini-list] Python in Houdini 9
lutz_p at gmx.net
Thu Nov 2 08:21:04 EST 2006
Dante Allegria schrieb:
> On Tue, October 31, 2006 13:31, Lutz Paelike said:
>> A saner and more stable approach (for the host environment, houdini
>> this case)
>> would be to run your custom simulation in a separate process
>> on a another processor (core or computer) and bridge it with a
> Can't you do that already now in Houdini 8.1?
That's true, but you have to transfer all your data as text data which is annoying and also a performance killer.
If python is integrated you could do something like the example below (little pseudo code)
The network handling code is omitted here.
You could use a simple socket connection, some ORB library like pyro (http://pyro.sourceforge.net/)
or the really cool twisted python library (http://www.twistedmatrix.com).
it's up to you.
Twisted Python is really fast and powerful but has it's own event loop which makes it a little difficult
to integrate if houdini doesn't call the event processing on a regular basis (see my last post).
if the simulation is running on the same computer you might even consider using shared memory via posh
http://poshmodule.sourceforge.net instead of a network connection and avoid a lot of speed penalty caused
by data transfer.
your class definition here
# on the houdini side
result = simulator_connection.get_result()
# got the MySimulation instance here
mysimulation = pickle.loads(result)
# do something with the result ...
# you got a MySimulation instance here !
# on the simulator side
your network handling boilerplate
code here ...
self.networkconnection = MyNetworkConnection()
self.simulation = MySimulation()
result = pickle.dumps(self.simulation)
More information about the Sidefx-houdini-list