-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathompss_main.cpp
More file actions
59 lines (51 loc) · 1.33 KB
/
ompss_main.cpp
File metadata and controls
59 lines (51 loc) · 1.33 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
/*
* @file main.cpp
* @brief Gather-Scatter Mini-App
* @author Pavanakumar Mohanamuraly
*/
#include "backend.h"
#include "kernel_ompss.h"
#include <iostream>
/**
*
* @param data
* @param n
*/
void ZeroOutArray(const unsigned n, double *data) {
for (unsigned i = 0; i < n; ++i)
data[i] = 0.0;
}
/**
*
* @param nargs
* @param args
* @return
*/
int main(int nargs, char *args[]) {
if (nargs != 2) {
std::cout << "Need just one argument <input-hip-hdf5-mesh-file>\n";
return -100;
}
// Read mesh data using C API call
read_data(args[1], 1000, true);
int nnodes, ncells, npedges, ncolours, maxgsize;
int *cgroup_offset, *cgroup, *triangles, *pedges;
int *group_offset;
double *x, *y;
get_data_ptr(&nnodes, &ncells, &npedges, &ncolours, &maxgsize, &x, &y,
&group_offset, &cgroup_offset, &cgroup, &triangles, &pedges);
// Allocate data for kernel
double *vol_e = new double[ncells];
double *vol_n = new double[nnodes];
element_volumes_cgroup(nnodes, ncolours, maxgsize, group_offset, cgroup_offset,
cgroup, x, y, triangles, vol_e, vol_n);
#if 1
for (size_t i = 0; i < nnodes; ++i)
std::cout << " (" << i << "): " << get_node_perm_value(i, vol_n) << ",\n";
#endif
// // Clean up the memory
free_data();
delete[] vol_n;
delete[] vol_e;
return 0;
}