-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
76 lines (69 loc) · 1.7 KB
/
main.cpp
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
#include "Config.h"
#include <assert.h>
#include "DiscordsRun.h"
#include <cstdio>
#include <stdlib.h>
#include <iostream>
#include <cmath>
#include "FileUtils.h"
using namespace std;
int n;
int m;
char* path;
int threadsNum;
series_t series;
char* DEFAULT_PATH = "default";
char* GENERATE_PATH = "generate";
/**
* Command line args:
* 1. m
* 2. path to time series [default, generate or URI]
* 3. n
* 4. threadNum êîëè÷åñòâî íèòåé
*/
void parseCommandLineArgs(int argc, char *argv[]);
int main(int argc, char *argv[])
{
parseCommandLineArgs(argc, argv);
if (path == DEFAULT_PATH || path == GENERATE_PATH)
{
// todo for testing
}
else
{
series = readTimeSeries(path, m);
}
int nums[] = {1, 2, 4, 8, 16, 32 };
for (int i = 0; i < 6; i++)
{
item_t dist_matrix_bsf_dist = 0;
double time = 0;
threadsNum = nums[i];
int dist_matrix_loc = findDiscord(series, m, n, &dist_matrix_bsf_dist, threadsNum, &time);
writeResult(dist_matrix_loc, dist_matrix_bsf_dist, time, threadsNum);
printf("%f", time);
}
//printf("%d %f %f", dist_matrix_loc, dist_matrix_bsf_dist, time);
}
void parseCommandLineArgs(int argc, char *argv[])
{
//std::cout << "There are " << argc << " arguments:\n";
// todo: different combinations of args
assert(argc == 4 || argc == 5);
if (argc == 4)
{
//cout << "m = " << argv[0] << "; path = " << argv[1] << "; n = " << argv[2] << "; threadsNum = " << argv[3] << ";\n";
m = atoi(argv[0]);
path = argv[1];
n = atoi(argv[2]);
threadsNum = atoi(argv[3]);
}
else
{
//cout << "m = " << argv[1] << "; path = " << argv[2] << "; n = " << argv[3] << "; threadsNum = " << argv[4] << ";\n";
m = atoi(argv[1]);
path = argv[2];
n = atoi(argv[3]);
threadsNum = atoi(argv[4]);
}
}