[Paraview-developers] Plugin client/server

Moreland, Kenneth kmorel at sandia.gov
Wed Jul 27 10:52:24 EDT 2011


That's the right idea, but a bit more complicated than necessary.  You don't have to mess with MPI.  The generic vtkMultiProcessController has reduce methods, so it's much easier to just use those.  Alan will also need to add a Controller ivar to his class (which is clearly in your code but not explained).  The code becomes something like this (I haven't actually compiled so sorry for typos).  First, in your header file add an ivar called Controller that is of type vtkMultiProcessController.

class vtkReplicateGeometry : public vtkAppropriateSuperclassAlgorithm
{
public:
  ...
  vtkGetObjectMacro(Controller, vtkMultiProcessController);
  virtual void SetController(vtkMultiProcessController *);
  ...
protected:
  ...
  vtkMultiProcessController *Controller;

And in your source file declare the SetController method and initialize the controller to the global controller.

vtkCxxSetObjectMacro(vtkReplicateGeometry, Controller, vtkMultiProcessController);
...
vtkReplicateGeometry::vtkReplicateGeometry()
{
  ...
  this->Controller = NULL;
  this->SetController(vtkMultiProcessController::GetGlobalController());

Now you are ready in your RequestData method to use the Reduce method of the communicator to find the global mins and maxes.

double bounds[6];
input->GetBounds(bounds);
if (this->Controller)
  {
  double mins[3] = {bounds[0], bounds[2], bounds[4]};
  double maxes[3] = {bounds[1], bounds[3], bounds[5]};
  double globalMins[3], globalMaxes[3];
  this->Controller->AllReduce(mins, globalMins, 3, vtkCommunicator::MIN_OP);
  this->Controller->AllReduce(maxes, globalMaxes, 3, vtkCommunicator::MAX_OP);
  bounds[0] = mins[0];  bounds[1] = maxes[0];
  bounds[2] = mins[1];  bounds[3] = maxes[1];
  bounds[4] = mins[2];  bounds[5] = maxes[2];
  }

That should be it.

-Ken

   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

From: "Biddiscombe, John A." <biddisco at cscs.ch<mailto:biddisco at cscs.ch>>
Date: Wed, 27 Jul 2011 05:11:30 +0000
To: "Scott, W Alan" <wascott at sandia.gov<mailto:wascott at sandia.gov>>, "paraview-developers at paraview.org<mailto:paraview-developers at paraview.org>" <paraview-developers at paraview.org<mailto:paraview-developers at paraview.org>>
Subject: Re: [Paraview-developers] Plugin client/server

I believe that the client does collect boxes from all nodes and generate the information you need, but on the servers ... if my filters require the global bounds, I use this.

#ifdefVTK_USE_MPI
  vtkMPICommunicator *communicator = vtkMPICommunicator::SafeDownCast(this->Controller->GetCommunicator());
  MPI_Comm mpiComm = MPI_COMM_NULL;
  if (communicator) {
    mpiComm = *(communicator->GetMPIComm()->GetHandle());
  }

...

  double bounds[6];
  input->GetBounds(bounds);
  double bmin[3], bmn[3] = {bounds[0], bounds[2], bounds[4]};
  double bmax[3], bmx[3] = {bounds[1], bounds[3], bounds[5]};
  MPI_Allreduce(bmn, bmin, 3, MPI_DOUBLE, MPI_MIN, mpiComm);
  MPI_Allreduce(bmx, bmax, 3, MPI_DOUBLE, MPI_MAX, mpiComm);

Cut’n’pasted with some extra code removed. Apologies if I deleted the wrong lines

JB



From: paraview-developers-bounces at paraview.org<mailto:paraview-developers-bounces at paraview.org> [mailto:paraview-developers-bounces at paraview.org] On Behalf Of Scott, W Alan
Sent: 27 July 2011 03:56
To: paraview-developers at paraview.org<mailto:paraview-developers at paraview.org>
Subject: [Paraview-developers] Plugin client/server

I have written a filter that runs client/ multiple remote server.  This filter works correctly, from what I can see.  (It just replicates a dataset, in order to create a larger dataset in memory for testing and benching.)

I am trying to convert this filter to a plugin.  It works local server, but fails client/ remote server.  I believe that my problem is that I am trying to calculate the geometric bounds of the dataset, and each of the processors is returning a different bounding box – representing the bounding box of this server’s data.  What I want is the bounding box of all server’s data.  I am using a vtkDataSet function called GetBounds.

My questions are as follows:
·         Is there an example of how to make plugins that work for remote servers, that calculate the bounds of all of the data, for all processors?
·         If not, is there anywhere that I should look for ldeas?
·         If not, is there someone I should talk to?

Thanks,

Alan


--------------------------------------------------------
W. Alan Scott
ParaView Support Manager

GAITS
Sandia National Laboratories, MS 0822
Org 9326 - Building 880 A1-C
(505) 284-0932   FAX (505) 845-0833
---------------------------------------------------------



_______________________________________________ Paraview-developers mailing list Paraview-developers at paraview.org<mailto:Paraview-developers at paraview.org> http://public.kitware.com/mailman/listinfo/paraview-developers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20110727/4aed257f/attachment-0001.htm>


More information about the Paraview-developers mailing list