00001 // Copyright 2009-2015 Sandia Corporation. Under the terms 00002 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. 00003 // Government retains certain rights in this software. 00004 // 00005 // Copyright (c) 2009-2015, Sandia Corporation 00006 // All rights reserved. 00007 // 00008 // This file is part of the SST software package. For license 00009 // information, see the LICENSE file in the top level directory of the 00010 // distribution. 00011 00012 00013 #ifndef SST_CORE_PART_LINEAR 00014 #define SST_CORE_PART_LINEAR 00015 00016 #include <sst/core/part/sstpart.h> 00017 #include <sst/core/output.h> 00018 00019 using namespace SST; 00020 using namespace SST::Partition; 00021 00022 namespace SST { 00023 namespace Partition { 00024 00025 00026 00027 /** 00028 Performs a linear partition scheme of an SST simulation configuration. In this 00029 scheme a list of components (supplied as a graph) are grouped by slicing the list 00030 into approximately equal parts. A "part" is generated for each MPI rank performing 00031 the simulation. This means Components with sequential ids will be placed close together. 00032 In general this scheme provides a very effective partition for most parallel 00033 simulations which generate man similar components of interest close together in the input 00034 Python configuration. It is also very fast to compute a linear partiton scheme. For 00035 more aggressive partition schemes users should try either a simple or Zoltan-based 00036 partitioner. 00037 */ 00038 class SSTLinearPartition : public SST::Partition::SSTPartitioner { 00039 00040 public: 00041 /** 00042 Creates a new linear partition scheme. 00043 \param mpiRankCount Number of MPI ranks in the simulation 00044 \param verbosity The level of information to output 00045 */ 00046 SSTLinearPartition(int mpiRankCount, int verbosity); 00047 00048 /** 00049 Performs a partition of an SST simulation configuration 00050 \param graph The simulation configuration to partition 00051 */ 00052 void performPartition(PartitionGraph* graph); 00053 00054 bool requiresConfigGraph() { return false; } 00055 bool spawnOnAllRanks() { return false; } 00056 00057 static SSTPartitioner* allocate(int total_ranks, int my_rank, int verbosity) { 00058 return new SSTLinearPartition(total_ranks, verbosity); 00059 } 00060 00061 protected: 00062 /** Number of ranks in the simulation */ 00063 int rankcount; 00064 /** Output object to print partitioning information */ 00065 Output* partOutput; 00066 00067 static bool initialized; 00068 }; 00069 00070 } 00071 } 00072 00073 #endif