[vtkusers] VTK & MPI

Kevin H. Hobbs hobbsk at ohiou.edu
Thu Jul 27 07:59:29 EDT 2006


On Thu, 2006-07-27 at 14:37 +0300, Hanan Hassanein wrote:
> Dear all,
>      
>       I tried first using VTKMPI functions, but i couldn't find good
> online support like functions or so, i just found 1 example on the vtk
> site named MPIgroups.cxx ( i am using c++ by the way), it wasn't
> helpful at all, not commented or so.. 
>  

Well there are other examples in
VTK/Examples/ParallelProcessing/Generic/Cxx . You can browse to them on
the web from the Doxygen documentation by seraching for MPI in the page
http://www.vtk.org/doc/nightly/html/annotated.html and following the
"Tests" and "Examples" sections.

>       so, i started to try another way, although i know i am trying to
> reinvent the wheel, coz i am trying to use both vtk & MPI separately,
> but i got stuck now in sending vtk objects between processors like
> vtkactors, coz as u know MPI communication function send/receive
> objects of type MPI_datatype, eith it's primitive like MPI_Double, or
> user defined datatype which must be also some combination of MPI
> primitive datatypes. 
>  
>         

I think this is a very wrong path. VTK objects contain pointers to other
objects, which would not make sense when sent to another machine.

Here is a VTK MPI hello world.

#include "vtkMPIController.h"

void process(vtkMultiProcessController* controller, void*
vtkNotUsed(arg))
{
	int myId = controller->GetLocalProcessId();
	
	std::cout << "My process id is ";
	std::cout << myId << "." << std::endl;
}

int main( int argc, char* argv[] )
{
	vtkMPIController* controller = vtkMPIController::New();
	controller->Initialize(&argc, &argv);


	controller->SetSingleMethod(process, 0);
	controller->SingleMethodExecute();


	controller->Finalize();
      	controller->Delete();
      	
      	return 0;
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060727/704fa9eb/attachment.pgp>


More information about the vtkusers mailing list