Skip to content

Commit 1de76b8

Browse files
Merge branch 'master' of /org/centers/cdgc/repos/GaloisCpp
2 parents 1eba7f1 + bbb8b16 commit 1de76b8

7 files changed

Lines changed: 1167 additions & 29 deletions

File tree

lonestar/analytics/cpu/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ add_subdirectory(pointstoanalysis)
1515
add_subdirectory(preflowpush)
1616
add_subdirectory(sssp)
1717
add_subdirectory(triangle-counting)
18+
19+
add_subdirectory(louvain-partitioning)

lonestar/analytics/cpu/bipart/bipart.cpp

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040

4141
namespace cll = llvm::cl;
4242

43-
static const char* name = "HYPAR";
43+
static const char* name = "BIPART";
4444
static const char* desc =
4545
"Partitions a hypergraph into K parts and minimizing the graph cut";
46-
static const char* url = "HyPar";
46+
static const char* url = "BiPart";
4747

4848
static cll::opt<std::string>
4949
inputFile(cll::Positional, cll::desc("<input file>"), cll::Required);
@@ -98,29 +98,6 @@ static cll::opt<bool>
9898
output("output", cll::desc("Specify if partitions need to be written"),
9999
cll::init(false));
100100

101-
// const double COARSEN_FRACTION = 0.9;
102-
103-
/*int cutsize(GGraph& g) {
104-
unsigned size = std::distance(g.cellList().begin(), g.cellList().end());
105-
unsigned sizen = std::distance(g.getNets().begin(), g.getNets().end());
106-
int cutsize = 0;
107-
std::vector<int> cells;
108-
for (auto n : g.getNets()) {
109-
bool cut_status = false;
110-
for (auto e : g.edges(n)) {
111-
auto cell1 = g.getEdgeDst(e);
112-
for (auto c : g.edges(n)) {
113-
auto cell2 = g.getEdgeDst(c);
114-
if(g.getData(cell1).getPart() != g.getData(cell2).getPart() && cell1 !=
115-
cell2) { cutsize++; cut_status = true; break;
116-
}
117-
}
118-
if (cut_status == true)
119-
break;
120-
}
121-
}
122-
return cutsize;
123-
}*/
124101
/**
125102
* Partitioning
126103
*/
@@ -391,7 +368,7 @@ int main(int argc, char** argv) {
391368
galois::iterate(uint32_t{0}, totalnodes),
392369
[&](uint32_t c) {
393370
pre_edges[c] = edges_ids[c].size();
394-
num_edges_acc += prefix_edges[c];
371+
num_edges_acc += pre_edges[c];
395372
},
396373
galois::steal());
397374
edges = num_edges_acc.reduce();
@@ -410,7 +387,7 @@ int main(int argc, char** argv) {
410387
gr.getData(n).netval = INT_MAX;
411388
gr.getData(n).nodeid = n + 1;
412389
});
413-
Partition(&metisG, 25, kValue[i]);
390+
Partition(&metisG, csize, kValue[i]);
414391
MetisGraph* mcg = &metisG;
415392

416393
while (mcg->getCoarserGraph() != NULL) {
@@ -445,8 +422,8 @@ int main(int argc, char** argv) {
445422
toProcessNew.clear();
446423
}
447424
// std::cout<<"Total Edge Cut: "<<computingCut(graph)<<"\n";
448-
galois::runtime::reportStat_Single("HyPar", "Edge Cut", computingCut(graph));
449-
galois::runtime::reportStat_Single("HyParzo", "zero-one",
425+
galois::runtime::reportStat_Single("BiPart", "Edge Cut", computingCut(graph));
426+
galois::runtime::reportStat_Single("BiPart", "zero-one",
450427
computingBalance(graph));
451428
// galois::reportPageAlloc("MeminfoPost");
452429

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
add_executable(louvain-partitioning-cpu louvain-partitioning.cpp serial-partitioning.cpp)
2+
add_dependencies(apps louvain-partitioning-cpu)
3+
target_link_libraries(louvain-partitioning-cpu PRIVATE Galois::shmem lonestar)
4+
install(TARGETS louvain-partitioning-cpu DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT apps EXCLUDE_FROM_ALL)
5+
add_test_scale(small1 louvain-partitioning-cpu -symmetricGraph "${BASEINPUT}/scalefree/symmetric/rmat10.sgr")
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Partitioning using Louvain
2+
================================================================================
3+
4+
DESCRIPTION
5+
--------------------------------------------------------------------------------
6+
7+
This directory contains a graph partitioning algorithm that uses a hierarchical community detection algorithm for coarsening. The algorithm uses the well-known multi-level partitioning approach, similar to GMetis.
8+
9+
INPUT
10+
--------------------------------------------------------------------------------
11+
12+
This application takes in symmetric Galois .gr graphs.
13+
You must specify the -symmetricGraph flag when running this benchmark.
14+
15+
BUILD
16+
--------------------------------------------------------------------------------
17+
18+
1. Run cmake at BUILD directory (refer to top-level README for cmake instructions).
19+
20+
2. Run `cd <BUILD>/lonestar/analytics/cpu/louvain_partitioning; make -j`
21+
22+
RUN
23+
--------------------------------------------------------------------------------
24+
25+
The following is an example command line.
26+
27+
-`$ ./louvain-partitioning-cpu -input <path-to-graph> -t 4 -tolerance=15 -threshold=0.000001 -max_iter 1000 -symmetricGraph`
28+

0 commit comments

Comments
 (0)