2
2
3
3
#define min (a , b ) ((b) < (a) ? (b) : (a))
4
4
5
- static void GenmapFindNeighbors (struct array * nbrs , genmap_handle h ,
6
- struct comm * cc ) {
5
+ static void genmap_find_neighbors (struct array * nbrs , genmap_handle h ,
6
+ struct comm * cc ) {
7
7
sint lelt = genmap_get_nel (h );
8
8
sint nv = genmap_get_nvertices (h );
9
9
@@ -38,9 +38,7 @@ static void GenmapFindNeighbors(struct array *nbrs, genmap_handle h,
38
38
size = vertices .n ;
39
39
vertex * vPtr = vertices .ptr ;
40
40
41
- buffer buf ;
42
- buffer_init (& buf , 1024 );
43
- sarray_sort (vertex , vPtr , size , vertexId , 1 , & buf );
41
+ sarray_sort (vertex , vPtr , size , vertexId , 1 , & h -> buf );
44
42
45
43
struct array a ;
46
44
array_init (csr_entry , & a , 10 );
@@ -67,14 +65,13 @@ static void GenmapFindNeighbors(struct array *nbrs, genmap_handle h,
67
65
68
66
sarray_transfer (csr_entry , & a , proc , 1 , & cr );
69
67
// TODO: Check if the last line is redundant
70
- sarray_sort_2 (csr_entry , a .ptr , a .n , r , 1 , c , 1 , & buf );
71
- sarray_sort (csr_entry , a .ptr , a .n , r , 1 , & buf );
68
+ sarray_sort_2 (csr_entry , a .ptr , a .n , r , 1 , c , 1 , & h -> buf );
69
+ // sarray_sort(csr_entry, a.ptr, a.n, r, 1, &h-> buf);
72
70
73
71
array_init (entry , nbrs , lelt );
74
72
75
73
if (a .n == 0 ) {
76
74
crystal_free (& cr );
77
- buffer_free (& buf );
78
75
array_free (& vertices );
79
76
array_free (& a );
80
77
}
@@ -96,21 +93,30 @@ static void GenmapFindNeighbors(struct array *nbrs, genmap_handle h,
96
93
}
97
94
}
98
95
99
- sarray_sort_2 (entry , nbrs -> ptr , nbrs -> n , r , 1 , c , 1 , & buf );
96
+ sarray_sort_2 (entry , nbrs -> ptr , nbrs -> n , r , 1 , c , 1 , & h -> buf );
100
97
101
98
crystal_free (& cr );
102
- buffer_free (& buf );
103
99
array_free (& vertices );
104
100
array_free (& a );
105
101
}
106
102
107
103
int GenmapInitLaplacian (genmap_handle h , struct comm * c ) {
108
104
struct array entries ;
109
- GenmapFindNeighbors (& entries , h , c );
105
+
106
+ metric_tic (c , FINDNBRS );
107
+ genmap_find_neighbors (& entries , h , c );
108
+ metric_toc (c , FINDNBRS );
109
+
110
+ metric_tic (c , CSRMATSETUP );
110
111
csr_mat_setup (& entries , c , & h -> M );
112
+ metric_toc (c , CSRMATSETUP );
113
+
111
114
array_free (& entries );
112
115
116
+ metric_toc (c , CSRTOPSETUP );
113
117
h -> gsh = get_csr_top (h -> M , c );
118
+ metric_toc (c , CSRTOPSETUP );
119
+
114
120
GenmapRealloc (h -> M -> row_off [h -> M -> rn ], & h -> b );
115
121
116
122
#if defined(GENMAP_DEBUG )
0 commit comments