WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Multiprocessing Process (

sleiN13 07-28-2011 04:55 AM

Multiprocessing Process
To get the Multiprocessing.Process functionality working with the vizard python you have to change

on line 184: if sys.executable.lower().endswith('pythonservice.exe '):
in to
if sys.executable.lower().endswith('winviz.exe'):

or use these lines in the .py file with the Process call and classes:
import sys
sys.executable = "pythonservice.exe"

Both are a bit of a hacky way to get things working. Is there a better way supported by vizard to launch process that run on other cores in your PC?

Another problem is that the launced processes can't import viz. this limits the objects you can access in the other processes. I would understand that you might want to avoid that because vizard classes are not thread-safe but reading out some values like .getPosition(viz.ABS_GLOBAL) would be nice for the other threads.

Is there a way to get the viz functionality working in the other threads?

farshizzo 07-29-2011 09:05 AM

It is possible to get the multiprocessing module working with Vizard, but it does have a few limitations. You will not be able to use any Vizard modules within the spawned processes. The multiprocessing module is generally used when you want to perform pure Python computational processing in parallel.

Can you describe specifically what you are trying to accomplish? I might be able to suggest a better method if I know what you are trying to do.

sleiN13 08-01-2011 04:47 AM

I'm trying to do a "rough" collision detection / prediction for all avatars in the scene and the MainView. I want to offload this to a new process to avoid decreasing the frame update time. I know that Vizard has a collision detection but as I understand it its checks all scene objects and also enables gravity. It also doesn't predict possible collision so that a avoidance technique can be employed.

I've also have a network thread running off the side as a subprocess just as a check if subprocesses works as expected. This already seems to have a positive effect on the framerates especially the frame drop downs that sometimes occurred with heavy network traffic. I hope in the future to also switch to TCP instead of UDP employed by Vizard because I have some problems with disappearing network messages.

Subprocess seems to be a very interesting solution because Python only loades one processor core and subprocesses allows me to use more power from a modern day pc.

All times are GMT -7. The time now is 12:23 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC