-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (42 loc) · 1.65 KB
/
main.cpp
File metadata and controls
49 lines (42 loc) · 1.65 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
#include <iostream>
#include "ConcurrentPartition.h"
#include "IndependentPartition.h"
#include <math.h>
#include <fstream>
using namespace std;
int main() {
//set of threads
int threads[] = {1, 2, 4, 8, 16, 32};
//set of hashbits
int hashBits[] = {1, 2, 3, 4,5,6,7,8,9,10,11,12,13,14,15,16,17, 18,19, 20};
//for each thread
//get length of threads
int numberOfRuns = 10;
for (int i = 0; i < 6; i++) {
//for each hashbits
for (int j = 0; j < 20; j++) {
int numberOfMilis = 0;
for (int k = 0; k < numberOfRuns; k++) {
numberOfMilis += round(independentPartition(threads[i], pow(2, hashBits[j])) * 1000);
}
std::ofstream outfile;
outfile.open("independentPartition.csv", std::ios_base::app); // append instead of overwrite
outfile << to_string(threads[i]) + "," + to_string(hashBits[j]) + "," + to_string(numberOfMilis) + "," + to_string(16777216) << endl;
outfile.close();
}
}
for (int i = 0; i < 6; i++) {
//for each hashbits
for (int j = 0; j < 20; j++) {
int numberOfMilis = 0;
for (int k = 0; k < numberOfRuns; k++) {
numberOfMilis += round(concurrentPartition(threads[i], pow(2, hashBits[j])) * 1000);
}
std::ofstream outfile;
outfile.open("concurrentPartition.csv", std::ios_base::app); // append instead of overwrite
outfile << to_string(threads[i]) + "," + to_string(hashBits[j]) + "," + to_string(numberOfMilis) + "," + to_string(16777216) << endl;
outfile.close();
}
}
return 0;
}