SENSEI
A frame work for generic in situ analytics
MappedPartitioner.h
1 #ifndef sensei_MappedPartitioner_h
2 #define sensei_MappedPartitioner_h
3 
4 #include "Partitioner.h"
5 #include <vector>
6 
7 namespace sensei
8 {
9 
10 class MappedPartitioner;
11 using MappedPartitionerPtr = std::shared_ptr<sensei::MappedPartitioner>;
12 
13 /// @class MappedPartitioner
14 /// @brief represents the mapped partitioning mode for in-transit operation.
15 ///
16 /// The mapped partitioner enables one to explicitly control a block based
17 /// paritioning of the data. The poarallel vectors 'BlockIds' and 'BlockOwner'
18 /// contain the block id of each data block and the rank which should own it.
19 /// These may be set programatically or through XML.
20 class SENSEI_EXPORT MappedPartitioner : public sensei::Partitioner
21 {
22 public:
23  static sensei::MappedPartitionerPtr New()
24  { return MappedPartitionerPtr(new MappedPartitioner); }
25 
26  const char *GetClassName() override { return "MappedPartitioner"; }
27 
28  // construct initialzed from vectors of owner and block ids.
29  MappedPartitioner(const std::vector<int> &blkOwner,
30  const std::vector<int> &blkIds);
31 
32  // Initialize the partitioner from the 'block_owner' and 'block_id' XML
33  // elements nested below the current node.
34  int Initialize(pugi::xml_node &node) override;
35 
36  // Set the block onwer list
37  void SetBlockOwner(const std::vector<int> &blkOwner);
38 
39  // Set the block id list
40  void SetBlockIds(const std::vector<int> &blkIds);
41 
42  // given an existing partitioning of data passed in the first MeshMetadata
43  // argument,return a new partittioning in the second MeshMetadata argument.
44  // distributes blocks to a rank such that consecutive blocks share a rank.
45  int GetPartition(MPI_Comm comm, const sensei::MeshMetadataPtr &in,
46  sensei::MeshMetadataPtr &out) override;
47 
48 protected:
49  MappedPartitioner() = default;
50  MappedPartitioner(const MappedPartitioner &) = default;
51 
52 private:
53  std::vector<int> BlockOwner;
54  std::vector<int> BlockIds;
55 };
56 
57 }
58 
59 #endif
int Initialize(MPI_Comm comm, const std::string &fileName, InTransitDataAdaptor *&dataAdaptor)
Creates a sensei::ConfigurableAnalysis adaptor and sensei::InTransitDataAdaptor based on a SENSEI XML...
represents the way data is partitioned for in-transit operation mode.
Definition: Partitioner.h:25
SENSEI.
Definition: ADIOS2AnalysisAdaptor.h:27
represents the mapped partitioning mode for in-transit operation.
Definition: MappedPartitioner.h:20