20 #ifndef __CXXGRAPH_PARTITIONING_PARTITIONER_H__
21 #define __CXXGRAPH_PARTITIONING_PARTITIONER_H__
25 #include "PartitionStrategy.hpp"
26 #include "Partitioning/Utility/Globals.hpp"
27 #include "Edge/Edge.hpp"
28 #include "CoordinatedPartitionState.hpp"
29 #include "Utility/Runnable.hpp"
30 #include "PartitionerThread.hpp"
31 #include "PartitionAlgorithm.hpp"
36 namespace PARTITIONING
42 std::list<const Edge<T> *> dataset;
59 this->dataset = dataset;
60 if (GLOBALS.partitionStategy == PartitionAlgorithm::HDRF_ALG)
62 algorithm =
new HDRF<T>(GLOBALS);
66 CoordinatedPartitionState<T> Partitioner<T>::startCoordinated()
68 CoordinatedPartitionState<T> state(GLOBALS);
69 int processors = GLOBALS.threads;
71 std::thread myThreads[processors];
73 int n = dataset.size();
74 int subSize = n / processors + 1;
75 for (
int t = 0; t < processors; t++)
77 int iStart = t * subSize;
78 int iEnd = std::min((t + 1) * subSize, n);
81 std::vector<const Edge<T>*> list(std::next(dataset.begin(), iStart), std::next(dataset.begin(), iEnd));
82 Runnable *x =
new PartitionerThread<T>(list, &state, algorithm,
new std::list<int>());
83 myThreads[t] = std::thread(&Runnable::run, x);
86 for (
int t = 0; t < processors; t++)
93 Partitioner<T>::~Partitioner()
97 CoordinatedPartitionState<T> Partitioner<T>::performCoordinatedPartition()
99 return startCoordinated();
Definition: CoordinatedPartitionState.hpp:40
Definition: Globals.hpp:32
Definition: PartitionStrategy.hpp:34
Definition: Partitioner.hpp:40