dgemmmop2GHz.cpp
2.43 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
95
96
97
98
99
100
101
102
103
104
/*--------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
/*--------------------------------------------------------*/
#include <ephomo.h>
#include <eperr.h>
/*--------------------------------------------------------*/
#include "helpers.h"
#include "dgemmparams2GHz.h"
/*--------------------------------------------------------*/
int main(int argc, char** argv)
{
if (argc != 5)
{
fprintf(
stderr,
"Usage: %s <n in granularity> <p> <verbosity> <objType>.\n"
"if p is 0, then 2 to 64 values are evaluated.\n"
"objtype: [0-5]\n"
"0 - ENERGY\n"
"1 - PERFORMANCE\n"
"2 - MOPEP\n"
"3 - EDP\n"
"4 - EDDP\n"
"5 - EDDDP.\n",
argv[0]);
exit(EXIT_FAILURE);
}
size_t n = strtoul(argv[1], NULL, 10) * deltaX;
size_t p = strtoul(argv[2], NULL, 10);
unsigned int verbosity = strtoul(argv[3], NULL, 10);
HclOptObjective objType = (HclOptObjective)strtoul(argv[4], NULL, 10);
size_t npoints = sizeof(etimes)/sizeof(size_t);
size_t point, *psizes = (size_t*)malloc(sizeof(size_t)*npoints);
for (point = 0; point < npoints; point++)
{
psizes[point] = (point + 1) * deltaX;
}
printf(
"MOP for n:%zu, dX:%u, Num points in S:%zu.\n",
n, deltaX, npoints);
size_t nSolutions, nParetoSolutions;
double* path, *paretoFront;
int rc = hcl_mop(
verbosity,
objType,
n, p, deltaX,
npoints, psizes, etimes, energies,
&nSolutions, &path,
1,
&nParetoSolutions, &paretoFront);
if (rc != HCL_SUCCESS)
{
fprintf(
stderr,
"%s\n",
hcl_get_error_message(rc)
);
exit(EXIT_FAILURE);
}
free(psizes);
printf("Objective %s path.\n", hcl_get_objective_type(objType));
printf("===============================================\n");
printPESolutions(
nSolutions, path
);
printf("Pareto Optimal Front.\n");
printf("===============================================\n");
printPESolutions(
nParetoSolutions, paretoFront
);
if (nSolutions)
{
free(path);
}
if (nParetoSolutions)
{
free(paretoFront);
}
exit(EXIT_SUCCESS);
}
/*--------------------------------------------------------*/