[vtkusers] Really need help on Parallel vtk with/without MPI

Kevin H. Hobbs hobbsk at ohiou.edu
Thu Feb 8 09:57:24 EST 2007


On Wed, 2007-02-07 at 23:26 -0800, Wei Woo wrote:
> Thank u very much for kind response.I am trying to follow each step
> one by one,first by installing MPI.Actually    the   examples in
> parallel directory is a bit confusing.When I did program using simple
> C with MPI,I have complete control on how to divide the data to each
> processor.But those examples in parallel does not say about
> that.Suppose I have cut my 3D data to three pieces and distribute
> those to 3 different processors and those three processors manipulate
> the data and if necessary communicate other processors.Can anyone help
> me with such simple Hello type program so a novice like me can
> understand how MPI works with VTK?VTK with MPI is seems more
> complicated,abstract  than MPI with simple C.
> Thanks,
> Wei.

You're right using MPI with VTK is a bit more complicated than just
using MPI in simple C. The trade off is that you get access to some nice
features. 

A VTK MPI hello world might made by simplifying some of the examples
might look like this:

#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/20070208/e25330a5/attachment.pgp>


More information about the vtkusers mailing list