forked from Dilafdo/Multiproc-openCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
80 lines (69 loc) · 2.1 KB
/
main.c
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
#include <driver.h>
#include <opencl_flow_ex3.h>
#include <opencl_flow_ex5.h>
#include <opencl_flow_ex6.h>
#include <stdio.h>
#include <stdlib.h>
#include <util.h>
#include "config.h"
#include <logger.h>
#include <string.h>
#include <time.h>
int main(int argc, char *argv[])
{
printf("-----------------------------------printHeader---------------------------------------------------\n");
printHeader();
BENCHMARK_MODE benchmark = DO_NOT_BENCHMARK;
if (argc < 2)
{
logger("Incorrect number of arguments. Expected atleast 1, got %d. Running `mp - multithreaded` mode", argc - 1);
printHelp();
return 1;
}
if (argc > 2 && strcmp(argv[2], "-benchmark") == 0)
{
benchmark = BENCHMARK;
}
logger("Data folder %s", PROJECT_DATA_DIR);
time_t t;
srand((unsigned)time(&t));
struct timespec t0, t1;
unsigned long sec, nsec;
// get starting time
GET_TIME(t0)
if (strcmp(argv[1], "mp") == 0)
{
fullFlow(benchmark, true);
} else if ((strcmp(argv[1], "help") == 0) || (strcmp(argv[1], "help") == 0) || (strcmp(argv[1], "-h") == 0))
{
printHelp();
}
else if (strcmp(argv[1], "opencl") == 0)
{
openclFlowEx5(benchmark);
} else if (strcmp(argv[1], "opencl_opt") == 0)
{
openclFlowEx6(benchmark);
} else if (strcmp(argv[1], "opencl_old") == 0)
{
openclFlowEx3(benchmark);
} else if (strcmp(argv[1], "single") == 0)
{
fullFlow(benchmark, false);
} else if (strcmp(argv[1], "test") == 0)
{
openmpTestCode();
} else if (strcmp(argv[1], "opencl_platform") == 0)
{
printDeviceInformation();
} else
{
printHelp();
}
// get program end time
GET_TIME(t1)
logger("Total time of the main : %.3f ms", elapsed_time_microsec(&t0, &t1, &sec, &nsec));
logger("Multiprocessor project : Ran successfully!");
printf("--------------------------------------------------------------------------------------\n");
return 0;
}