-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.h
More file actions
56 lines (48 loc) · 1.03 KB
/
utils.h
File metadata and controls
56 lines (48 loc) · 1.03 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
#ifndef UTILS_H
#define UTILS_H
#include "common.h"
#include <sys/time.h>
#include <sys/types.h>
#include <dirent.h>
template<typename iT, typename vT>
double getB(const iT m, const iT nnz)
{
return (double)((m + 1 + nnz) * sizeof(iT) + (2 * nnz + m) * sizeof(vT));
}
template<typename iT>
double getFLOP(const iT nnz)
{
return (double)(2 * nnz);
}
template<typename T>
void print_tile_t(T *input, int m, int n)
{
for (int i = 0; i < n; i++)
{
for (int local_id = 0; local_id < m; local_id++)
{
cout << input[local_id * n + i] << ", ";
}
cout << endl;
}
}
template<typename T>
void print_tile(T *input, int m, int n)
{
for (int i = 0; i < m; i++)
{
for (int local_id = 0; local_id < n; local_id++)
{
cout << input[i * n + local_id] << ", ";
}
cout << endl;
}
}
template<typename T>
void print_1darray(T *input, int l)
{
for (int i = 0; i < l; i++)
cout << input[i] << ", ";
cout << endl;
}
#endif // UTILS_H