-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_experiment.cpp
More file actions
94 lines (80 loc) · 2.33 KB
/
run_experiment.cpp
File metadata and controls
94 lines (80 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include"graph.h"
#include"loaders.h"
#include"partition.h"
#include"partitioners.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#define MAX_PARTITIONS 10000
#define N_EXPERIMENTS 10
void run_heuristic(const char* heuristic_name,
int partitions_number,
const char* dataset,
const Graph& graph)
{
Partition partition;
}
int main(int argc, char** argv)
{
Graph graph;
if (argc != 2)
{
printf("Invalid number of parameters\n");
printf("Usage: %s <dataset file>\n",
argv[0]);
exit(1);
}
if (strstr(argv[1],"twitter") != NULL)
twitter_loader(&graph);
else if (strstr(argv[1],"4elt") != NULL)
elt_loader(&graph);
else
snap_loader(&graph, argv[1]);
//printf("Dataset;Experiment #;Heuristic;K;Edge cut;"
// "Communication Volume; Normalized Maximum Load;Runtime\n");
for (int experiment = 1; experiment<=N_EXPERIMENTS; experiment++)
{
for (int heuristic = 0; heuristic<3; heuristic++)
{
for (int partitions_number = 2;
partitions_number<=1024;
partitions_number *= 2)
{
Partition partition;
time_t start = time(0);
const char* h_name;
if (heuristic == 0)
{
linear_deterministic_greedy(graph,
partitions_number,
&partition);
h_name = "LDG";
}
else if (heuristic == 1)
{
fennel(graph,
partitions_number,
&partition);
h_name = "FENNEL";
}
else
{
non_neighbors_greedy(graph,
partitions_number,
&partition);
h_name = "NNEIGHBORS";
}
time_t end = time(0);
int time = difftime(end, start);
double fraction_edges_cut = graph.get_fraction_edges_cut(partition);
double communication_volume = graph.get_communication_volume(partition);
double maximum_load = graph.get_normalized_maximum_load(partition);
printf("%s;%d;%s;%d;%lf;%lf;%lf;%d\n",
argv[1], experiment, h_name, partitions_number,
fraction_edges_cut, communication_volume, maximum_load, time);
}
}
}
return 0;
}