SST  11.1.0
StructuralSimulationToolkit
zoltpart.h
1 // Copyright 2009-2021 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-2021, 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 #ifndef SST_CORE_IMPL_PARTITONERS_ZOLTPART_H
13 #define SST_CORE_IMPL_PARTITONERS_ZOLTPART_H
14 
15 #ifdef HAVE_ZOLTAN
16 
17 #include "sst/core/eli/elementinfo.h"
18 #include "sst/core/output.h"
19 #include "sst/core/sstpart.h"
20 
21 // SST and ZOLTAN's configurations are conflicting on the SST_CONFIG_HAVE_MPI definition.
22 // So temporarily shut down SST's SST_CONFIG_HAVE_MPI, then allow ZOLTAN's SST_CONFIG_HAVE_MPI to
23 // be defined, then reset SST�s SST_CONFIG_HAVE_MPI.
24 #ifdef SST_CONFIG_HAVE_MPI
25 #undef SST_CONFIG_HAVE_MPI
26 #include <mpi.h>
27 #include <zoltan.h>
28 #define SST_CONFIG_HAVE_MPI
29 #endif
30 
31 namespace SST {
32 namespace IMPL {
33 namespace Partition {
34 
35 /**
36  \class SSTZoltanPartition creates a partitioner interface to the
37  Zoltan partitioner library developed by Sandia National Labs. This is
38  an option to partition simulations if the user has configured SST
39  to find and compile with the Zoltan external dependency.
40 */
41 class SSTZoltanPartition : public SST::Partition::SSTPartitioner
42 {
43 
44 public:
45  SST_ELI_REGISTER_PARTITIONER(
46  SSTZoltanPartition,
47  "sst",
48  "zoltan",
49  SST_ELI_ELEMENT_VERSION(1,0,0),
50  "zoltan parallel partitioner")
51 
52 protected:
53  void initZoltan();
54  RankInfo rankcount;
55  struct Zoltan_Struct* zolt_config;
56  RankInfo rank;
57 
58 public:
59  /**
60  Create a Zoltan-based partition scheme
61  \param verbosity Verbosity level with which messages and information are generated
62  */
63  SSTZoltanPartition(RankInfo world_size, RankInfo my_rank, int verbosity);
64  ~SSTZoltanPartition();
65 
66  /**
67  Performs a partition of an SST partition graph. Components in the graph
68  have their setRank() attribute set based on the partition scheme computed
69  by Zoltan.
70  \param graph An SST partition graph
71  */
72  void performPartition(PartitionGraph* graph) override;
73 
74  bool requiresConfigGraph() override { return false; }
75 
76  bool spawnOnAllRanks() override { return true; }
77 };
78 
79 } // namespace Partition
80 } // namespace IMPL
81 } // namespace SST
82 #endif // End of HAVE_ZOLTAN
83 
84 #endif
Base class for Partitioning graphs.
Definition: sstpart.h:31