SST  6.0.0
StructuralSimulationToolkit
zoltpart.h
1 // Copyright 2009-2016 Sandia Corporation. Under the terms
2 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2016, Sandia Corporation
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_PART_ZOLT
14 #define SST_CORE_PART_ZOLT
15 
16 
17 #ifdef HAVE_ZOLTAN
18 
19 #include <sst/core/part/sstpart.h>
20 #include <sst/core/output.h>
21 
22 // SST and ZOLTANŐs configurations are conflicting on the SST_CONFIG_HAVE_MPI definition.
23 // So temporarily shut down SSTŐs SST_CONFIG_HAVE_MPI, then allow ZOLTANŐs SST_CONFIG_HAVE_MPI to
24 //be defined, then reset SSTŐs SST_CONFIG_HAVE_MPI.
25 #ifdef SST_CONFIG_HAVE_MPI
26 #undef SST_CONFIG_HAVE_MPI
27 #include <zoltan.h>
28 #include <mpi.h>
29 #define SST_CONFIG_HAVE_MPI
30 #endif
31 
32 using namespace SST;
33 using namespace SST::Partition;
34 
35 namespace SST {
36 namespace Partition {
37 
38 /**
39  \class SSTZoltanPartition creates a partitioner interface to the
40  Zoltan partioner library developed by Sandia National Labs. This is
41  an option to partition simulations if the user has configured SST
42  to find and compile with the Zoltan external dependency.
43 */
44 class SSTZoltanPartition : public SST::Partition::SSTPartitioner {
45 
46  public:
47  /**
48  Create a Zoltan-based partition scheme
49  \param verbosity Verbosity level with which messages and information are generated
50  */
51  SSTZoltanPartition(RankInfo world_size, RankInfo my_rank, int verbosity);
52  ~SSTZoltanPartition();
53 
54  /**
55  Performs a partition of an SST partition graph. Components in the graph
56  have their setRank() attribute set based on the partition scheme computed
57  by Zoltan.
58  \param graph An SST partition graph
59  */
60  void performPartition(PartitionGraph* graph);
61 
62  bool requiresConfigGraph() { return false; }
63 
64  bool spawnOnAllRanks() { return true; }
65 
66  static SSTPartitioner* allocate(RankInfo total_ranks, RankInfo my_rank, int verbosity) {
67  return new SSTZoltanPartition(total_ranks, my_rank, verbosity);
68  }
69 
70  protected:
71  void initZoltan();
72  RankInfo rankcount;
73  struct Zoltan_Struct * zolt_config;
74  RankInfo rank;
75 
76  static bool initialized;
77 };
78 
79 }
80 }
81 
82 #endif // End of HAVE_ZOLTAN
83 
84 #endif
Definition: configGraph.h:397
Definition: element.h:38
Definition: action.cc:17
Definition: rankInfo.h:21
Base class for Partitioning graphs.
Definition: sstpart.h:27