SST  10.0.0
StructuralSimulationToolkit
zoltpart.h
1 // Copyright 2009-2020 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2020, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 
13 #ifndef SST_CORE_IMPL_PARTITONERS_ZOLTPART_H
14 #define SST_CORE_IMPL_PARTITONERS_ZOLTPART_H
15 
16 
17 #ifdef HAVE_ZOLTAN
18 
19 #include "sst/core/sstpart.h"
20 #include "sst/core/output.h"
21 #include "sst/core/eli/elementinfo.h"
22 
23 // SST and ZOLTAN�s configurations are conflicting on the SST_CONFIG_HAVE_MPI definition.
24 // So temporarily shut down SST�s SST_CONFIG_HAVE_MPI, then allow ZOLTAN�s SST_CONFIG_HAVE_MPI to
25 //be defined, then reset SST�s SST_CONFIG_HAVE_MPI.
26 #ifdef SST_CONFIG_HAVE_MPI
27 #undef SST_CONFIG_HAVE_MPI
28 #include <zoltan.h>
29 #include <mpi.h>
30 #define SST_CONFIG_HAVE_MPI
31 #endif
32 
33 namespace SST {
34 namespace IMPL {
35 namespace Partition {
36 
37 /**
38  \class SSTZoltanPartition creates a partitioner interface to the
39  Zoltan partitioner library developed by Sandia National Labs. This is
40  an option to partition simulations if the user has configured SST
41  to find and compile with the Zoltan external dependency.
42 */
43 class SSTZoltanPartition : public SST::Partition::SSTPartitioner {
44 
45 public:
46 
47  SST_ELI_REGISTER_PARTITIONER(
48  SSTZoltanPartition,
49  "sst",
50  "zoltan",
51  SST_ELI_ELEMENT_VERSION(1,0,0),
52  "zoltan parallel partitioner")
53 
54 protected:
55  void initZoltan();
56  RankInfo rankcount;
57  struct Zoltan_Struct * zolt_config;
58  RankInfo rank;
59 
60 public:
61  /**
62  Create a Zoltan-based partition scheme
63  \param verbosity Verbosity level with which messages and information are generated
64  */
65  SSTZoltanPartition(RankInfo world_size, RankInfo my_rank, int verbosity);
66  ~SSTZoltanPartition();
67 
68  /**
69  Performs a partition of an SST partition graph. Components in the graph
70  have their setRank() attribute set based on the partition scheme computed
71  by Zoltan.
72  \param graph An SST partition graph
73  */
74  void performPartition(PartitionGraph* graph) override;
75 
76  void performPartition(ConfigGraph* graph) override {
78  }
79 
80  bool requiresConfigGraph() override { return false; }
81 
82  bool spawnOnAllRanks() override { return true; }
83 
84 };
85 
86 }
87 }
88 }
89 #endif // End of HAVE_ZOLTAN
90 
91 #endif
virtual void performPartition(PartitionGraph *UNUSED(graph))
Function to be overridden by subclasses.
Definition: sstpart.h:50
Base class for Partitioning graphs.
Definition: sstpart.h:32