[vtk-developers] VTK/Python in Parallel

Jeff Lee jeff at cdnorthamerica.com
Fri Dec 13 13:50:07 EST 2002


Why not let vtkMPIController::Initialize(...) and Finalize do the trick? 
 There is really no need for the wrapper languages to know about 
MPI_Init and MPI_Finalize, is there?  The only trick is allowing the 
wrapper languages to pass in argv, argc (which is why 
vtkMPICommunicator::Initialize(...) isn't wrapped).  Also, doesn't the 
vtk static initialization happen when the lib is loaded into the wrapper 
language?  Then you could just run your python or java code which loads 
the vtk libs (which triggers static initialization) and then just call 
vtkMPIController::Initialize(...).  Am I missing something (probably)?
-Jeff

Andy Cedilnik wrote:

>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).
>>    
>>
>
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
>  
>

-- 
Jeff Lee <jeff at cdnorthamerica.com>
Software Engineer
CD North America
21 Lafayette Street, Suite 230
Lebanon, NH 03766
Tel:    (603) 643-9993 ext. 109
Fax:    (603) 643-9994





More information about the vtk-developers mailing list