[vtk-developers] VTK/Python in Parallel

Andy Cedilnik andy.cedilnik at kitware.com
Fri Dec 13 13:40:56 EST 2002


Hi Prabhu,

I looked through pypar and what they do seems kind of hackish. The
problem is, when you doing MPI, here is what you should do. Your main
should look like this:

int main(int argc, char* argv)
{
  MPI_Init(&argc, &argv);
  // Your code
  MPI_Finalize();
  return 0;
}

If you do not do this, then you are on your own. Or if I quote MPI_Init
man page:

       The MPI standard does not say what a program can do before an 
       MPI_INIT or  after an MPI_FINALIZE. In the MPICH implementation,
       you should do as little as possible. In particular, avoid
       anything that changes  the external state of the program, such 
       as opening files, reading standard input or writing to standard
       output.

That said, In pypar, does things differently. It essentially calls
MPI_Init inside python script execution:

mpiext.init(sys.argv)

which is against the paragraph in the man page. So, no, the right way,
the way we see it, is to use hacked executable. 

The only thing pvtkpython does is it initializes MPI for you. 

Also, the reason why you cannot use python instead of vtkpython is
because of singletons inside VTK, which need to be initialized. Since
python is compiled with C and not C++ compiler, I don't think it does
things right.

				Andy


On Fri, 2002-12-13 at 12:14, Prabhu Ramachandran wrote:
> Cool!  Many thanks.  However I have a few questions.  I'm not a
> parallel guy so dont know much, pardon the ignorance.
> 
>   Does one _have_ to use pvtkpython?  Why not use vanilla python and
>   simply import libvtkParallelPython?  Looking at the code it looks
>   like the special thing in pvtkpython is that MPI init is called up
>   front and that initializes MPI.
> 
>   I have a wee bit of experience with pypar
>   http://datamining.anu.edu.au/~ole/pypar/ which does not require a
>   special python interpreter and still allows one to run parallel
>   Python scripts.  Whats the difference with pvtkpython and what does
>   it give us?
> 
>   Do I need to update the README.txt to mention this?  Do I also need
>   to update setup.py to handle the new code (vtkpython and
>   pvtkpython).





More information about the vtk-developers mailing list