1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
/*=========================================================================
Program: ParaView
Module: $RCSfile: vtkSubGroup.h,v $
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*----------------------------------------------------------------------------
Copyright (c) Sandia Corporation
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
// .NAME vtkSubGroup - scalable collective communication for a
// subset of members of a parallel VTK application
//
// .SECTION Description
// This class provides scalable broadcast, reduce, etc. using
// only a vtkMultiProcessController. It does not require MPI.
// Users are vtkPKdTree and vtkDistributedDataFilter.
//
// .SECTION See Also
// vtkPKdTree vtkDistributedDataFilter
#ifndef __vtkSubGroup_h
#define __vtkSubGroup_h
#include "vtkObject.h"
class vtkMultiProcessController;
class vtkCommunicator;
class VTK_PARALLEL_EXPORT vtkSubGroup : public vtkObject
{
public:
vtkTypeRevisionMacro(vtkSubGroup, vtkObject);
virtual void PrintSelf(ostream &os, vtkIndent indent);
static vtkSubGroup *New();
//BTX
// The wrapper gets confused here and falls down.
enum {MINOP = 1, MAXOP = 2, SUMOP = 3};
//ETX
// Description:
// Initialize a communication subgroup for the processes
// with rank p0 through p1 of the given communicator. (So
// vtkSubGroup is limited to working with subgroups that
// are identified by a contiguous set of rank IDs.)
// The third argument is the callers rank, which must
// in the range from p0 through p1.
int Initialize(int p0, int p1, int me, int tag, vtkCommunicator *c);
int Gather(int *data, int *to, int length, int root);
int Gather(char *data, char *to, int length, int root);
int Gather(float *data, float *to, int length, int root);
int Broadcast(float *data, int length, int root);
int Broadcast(double *data, int length, int root);
int Broadcast(int *data, int length, int root);
int Broadcast(char *data, int length, int root);
int ReduceSum(int *data, int *to, int length, int root);
int ReduceMax(float *data, float *to, int length, int root);
int ReduceMax(double *data, double *to, int length, int root);
int ReduceMax(int *data, int *to, int length, int root);
int ReduceMin(float *data, float *to, int length, int root);
int ReduceMin(double *data, double *to, int length, int root);
int ReduceMin(int *data, int *to, int length, int root);
int AllReduceUniqueList(int *list, int len, int **newList);
int MergeSortedUnique(int *list1, int len1, int *list2, int len2, int **newList);
void setGatherPattern(int root, int length);
int getLocalRank(int processID);
int Barrier();
void PrintSubGroup() const;
static int MakeSortedUnique(int *list, int len, int **newList);
int tag;
protected:
vtkSubGroup();
~vtkSubGroup();
private:
int computeFanInTargets();
void restoreRoot(int rootLoc);
void moveRoot(int rootLoc);
void setUpRoot(int root);
int nFrom;
int nTo;
int sendId; // gather
int sendOffset;
int sendLength;
int recvId[20];
int recvOffset[20];
int recvLength[20];
int fanInFrom[20]; // reduce, broadcast
int fanInTo;
int nSend;
int nRecv;
int gatherRoot;
int gatherLength;
int *members;
int nmembers;
int myLocalRank;
vtkCommunicator *comm;
vtkSubGroup(const vtkSubGroup&); // Not implemented
void operator=(const vtkSubGroup&); // Not implemented
};
#endif
|