Bug Summary

File:mat/partition/impls/hierarchical/hierarchical.c
Warning:line 159, column 12
2nd function call argument is an uninitialized value

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1
2#include <../src/mat/impls/adj/mpi/mpiadj.h> /*I "petscmat.h" I*/
3#include <petscsf.h>
4#include <petsc/private/matimpl.h>
5
6/*
7 It is a hierarchical partitioning. The partitioner has two goals:
8 (1) Most of current partitioners fail at a large scale. The hierarchical partitioning
9 strategy is trying to produce large number of subdomains when number of processor cores is large.
10 (2) PCGASM needs one 'big' subdomain across multi-cores. The partitioner provides two
11 consistent partitions, coarse parts and fine parts. A coarse part is a 'big' subdomain consisting
12 of several small subdomains.
13*/
14
15PetscErrorCode MatPartitioningHierarchical_DetermineDestination(MatPartitioning,IS,PetscInt,PetscInt,IS*);
16PetscErrorCode MatPartitioningHierarchical_AssembleSubdomain(Mat,IS,IS,IS*,Mat*,ISLocalToGlobalMapping*);
17PetscErrorCode MatPartitioningHierarchical_ReassembleFineparts(Mat,IS,ISLocalToGlobalMapping,IS*);
18
19typedef struct {
20 char* fineparttype; /* partitioner on fine level */
21 char* coarseparttype; /* partitioner on coarse level */
22 PetscInt nfineparts; /* number of fine parts on each coarse subdomain */
23 PetscInt ncoarseparts; /* number of coarse parts */
24 IS coarseparts; /* partitioning on coarse level */
25 IS fineparts; /* partitioning on fine level */
26 MatPartitioning coarseMatPart; /* MatPartititioning on coarse level (first level) */
27 MatPartitioning fineMatPart; /* MatPartitioning on fine level (second level) */
28 MatPartitioning improver; /* Improve the quality of a partition */
29} MatPartitioning_Hierarchical;
30
31/*
32 Uses a hierarchical partitioning strategy to partition the matrix in parallel.
33 Use this interface to make the partitioner consistent with others
34*/
35static PetscErrorCode MatPartitioningApply_Hierarchical(MatPartitioning part,IS *partitioning)
36{
37 MatPartitioning_Hierarchical *hpart = (MatPartitioning_Hierarchical*)part->data;
38 const PetscInt *fineparts_indices, *coarseparts_indices;
39 PetscInt *fineparts_indices_tmp;
40 PetscInt *parts_indices,i,j,mat_localsize, *offsets;
41 Mat mat = part->adj,adj,sadj;
42 PetscReal *part_weights;
43 PetscBool flg;
44 PetscInt bs = 1;
45 PetscInt *coarse_vertex_weights = 0;
46 PetscMPIInt size,rank;
47 MPI_Comm comm,scomm;
48 IS destination,fineparts_temp, vweights, svweights;
1
'vweights' declared without an initial value
49 PetscInt nsvwegihts,*fp_vweights;
50 const PetscInt *svweights_indices;
51 ISLocalToGlobalMapping mapping;
52 const char *prefix;
53 PetscErrorCode ierr;
54
55 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 55; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
56 ierr = PetscObjectGetComm((PetscObject)part,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),56,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
57 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),57,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
58 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),58,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
59 ierr = PetscObjectTypeCompare((PetscObject)mat,MATMPIADJ"mpiadj",&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),59,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
60 if (flg) {
2
Assuming 'flg' is 0
3
Taking false branch
61 adj = mat;
62 ierr = PetscObjectReference((PetscObject)adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
63 }else {
64 /* bs indicates if the converted matrix is "reduced" from the original and hence the
65 resulting partition results need to be stretched to match the original matrix */
66 ierr = MatConvert(mat,MATMPIADJ"mpiadj",MAT_INITIAL_MATRIX,&adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),66,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
67 if (adj->rmap->n > 0) bs = mat->rmap->n/adj->rmap->n;
4
Assuming the condition is false
5
Taking false branch
68 }
69 /* local size of mat */
70 mat_localsize = adj->rmap->n;
71 /* check parameters */
72 /* how many small subdomains we want from a given 'big' suddomain */
73 if(!hpart->nfineparts) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG," must set number of small subdomains for each big subdomain \n")return PetscError(((MPI_Comm)0x44000001),73,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,62,PETSC_ERROR_INITIAL," must set number of small subdomains for each big subdomain \n"
)
;
6
Assuming the condition is false
7
Taking false branch
74 if(!hpart->ncoarseparts && !part->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE," did not either set number of coarse parts or total number of parts \n")return PetscError(((MPI_Comm)0x44000001),74,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,73,PETSC_ERROR_INITIAL," did not either set number of coarse parts or total number of parts \n"
)
;
8
Assuming the condition is false
75
76 /* Partitioning the domain into one single subdomain is a trivial case, and we should just return */
77 if (part->n==1) {
9
Assuming the condition is false
10
Taking false branch
78 ierr = PetscCalloc1(bs*adj->rmap->n,&parts_indices)PetscMallocA(1,PETSC_TRUE,78,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(bs*adj->rmap->n)*sizeof(**(&parts_indices
)),(&parts_indices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),78,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
79 ierr = ISCreateGeneral(comm,bs*adj->rmap->n,parts_indices,PETSC_OWN_POINTER,partitioning);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),79,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
80 hpart->ncoarseparts = 1;
81 hpart->nfineparts = 1;
82 ierr = PetscStrallocpy("NONE",&hpart->coarseparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),82,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
83 ierr = PetscStrallocpy("NONE",&hpart->fineparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),83,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
84 ierr = MatDestroy(&adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),84,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
85 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
86 }
87
88 if(part->n){
11
Assuming the condition is false
12
Taking false branch
89 hpart->ncoarseparts = part->n/hpart->nfineparts;
90
91 if (part->n%hpart->nfineparts != 0) hpart->ncoarseparts++;
92 }else{
93 part->n = hpart->ncoarseparts*hpart->nfineparts;
94 }
95
96 ierr = PetscCalloc1(hpart->ncoarseparts+1, &offsets)PetscMallocA(1,PETSC_TRUE,96,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(hpart->ncoarseparts+1)*sizeof(**(&offsets)),
(&offsets))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),96,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
97 ierr = PetscCalloc1(hpart->ncoarseparts, &part_weights)PetscMallocA(1,PETSC_TRUE,97,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(hpart->ncoarseparts)*sizeof(**(&part_weights
)),(&part_weights))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),97,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
98
99
100 if (part->n%hpart->nfineparts != 0) offsets[1] = part->n%hpart->nfineparts;
13
Taking false branch
101 else offsets[1] = hpart->nfineparts;
102
103 part_weights[0] = ((PetscReal)offsets[1])/part->n;
104
105 for (i=2; i<=hpart->ncoarseparts; i++) {
14
Assuming the condition is false
15
Loop condition is false. Execution continues on line 110
106 offsets[i] = hpart->nfineparts;
107 part_weights[i-1] = ((PetscReal)offsets[i])/part->n;
108 }
109
110 offsets[0] = 0;
111 for (i=1;i<=hpart->ncoarseparts; i++)
16
Assuming the condition is false
17
Loop condition is false. Execution continues on line 115
112 offsets[i] += offsets[i-1];
113
114 /* If these exists a mat partitioner, we should delete it */
115 ierr = MatPartitioningDestroy(&hpart->coarseMatPart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),115,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
116 ierr = MatPartitioningCreate(comm,&hpart->coarseMatPart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),116,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
117 ierr = PetscObjectGetOptionsPrefix((PetscObject)part,&prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),117,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
118 ierr = PetscObjectSetOptionsPrefix((PetscObject)hpart->coarseMatPart,prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),118,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
119 ierr = PetscObjectAppendOptionsPrefix((PetscObject)hpart->coarseMatPart,"hierarch_coarse_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),119,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
120 /* if did not set partitioning type yet, use parmetis by default */
121 if (!hpart->coarseparttype){
18
Assuming the condition is false
19
Taking false branch
122#if defined(PETSC_HAVE_PARMETIS1)
123 ierr = MatPartitioningSetType(hpart->coarseMatPart,MATPARTITIONINGPARMETIS"parmetis");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),123,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
124 ierr = PetscStrallocpy(MATPARTITIONINGPARMETIS"parmetis",&hpart->coarseparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),124,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
125#elif defined(PETSC_HAVE_PTSCOTCH1)
126 ierr = MatPartitioningSetType(hpart->coarseMatPart,MATPARTITIONINGPTSCOTCH"ptscotch");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
127 ierr = PetscStrallocpy(MATPARTITIONINGPTSCOTCH"ptscotch",&hpart->coarseparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
128#else
129 SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Requires PETSc be installed with ParMetis or run with -mat_partitioning_hierarchical_coarseparttype partitiontype")return PetscError(PetscObjectComm((PetscObject)mat),129,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,56,PETSC_ERROR_INITIAL,"Requires PETSc be installed with ParMetis or run with -mat_partitioning_hierarchical_coarseparttype partitiontype"
)
;
130#endif
131 } else {
132 ierr = MatPartitioningSetType(hpart->coarseMatPart,hpart->coarseparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),132,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
133 }
134 ierr = MatPartitioningSetAdjacency(hpart->coarseMatPart,adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),134,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
135 ierr = MatPartitioningSetNParts(hpart->coarseMatPart, hpart->ncoarseparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),135,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
136 /* copy over vertex weights */
137 if(part->vertex_weights){
20
Assuming the condition is false
21
Taking false branch
138 ierr = PetscMalloc1(mat_localsize,&coarse_vertex_weights)PetscMallocA(1,PETSC_FALSE,138,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(mat_localsize)*sizeof(**(&coarse_vertex_weights
)),(&coarse_vertex_weights))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),138,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
139 ierr = PetscMemcpy(coarse_vertex_weights,part->vertex_weights,sizeof(PetscInt)*mat_localsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
140 ierr = MatPartitioningSetVertexWeights(hpart->coarseMatPart,coarse_vertex_weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),140,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
141 }
142
143 ierr = MatPartitioningSetPartitionWeights(hpart->coarseMatPart, part_weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),143,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
144 ierr = MatPartitioningApply(hpart->coarseMatPart,&hpart->coarseparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
145
146 ierr = PetscCalloc1(mat_localsize, &fineparts_indices_tmp)PetscMallocA(1,PETSC_TRUE,146,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(mat_localsize)*sizeof(**(&fineparts_indices_tmp
)),(&fineparts_indices_tmp))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),146,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
147
148 /* Wrap the original vertex weights into an index set so that we can extract the corresponding
149 * vertex weights for each big subdomain using ISCreateSubIS().
150 * */
151 if (part->vertex_weights) {
22
Taking false branch
152 ierr = ISCreateGeneral(comm,mat_localsize,part->vertex_weights,PETSC_COPY_VALUES,&vweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
153 }
154
155 for(i=0; i<hpart->ncoarseparts; i+=size){
23
Assuming the condition is true
24
Loop condition is true. Entering loop body
156 /* Determine where we want to send big subdomains */
157 ierr = MatPartitioningHierarchical_DetermineDestination(part,hpart->coarseparts,i,i+size,&destination);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
158 /* Assemble a submatrix and its vertex weights for partitioning subdomains */
159 ierr = MatPartitioningHierarchical_AssembleSubdomain(adj,part->vertex_weights? vweights:NULL((void*)0),destination,part->vertex_weights? &svweights:NULL((void*)0),&sadj,&mapping);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
25
Assuming the condition is true
26
'?' condition is true
27
'?' condition is true
28
2nd function call argument is an uninitialized value
160 /* We have to create a new array to hold vertex weights since coarse partitioner needs to own the vertex-weights array */
161 if (part->vertex_weights) {
162 ierr = ISGetLocalSize(svweights,&nsvwegihts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
163 ierr = PetscMalloc1(nsvwegihts,&fp_vweights)PetscMallocA(1,PETSC_FALSE,163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(nsvwegihts)*sizeof(**(&fp_vweights)),(&fp_vweights
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
164 ierr = ISGetIndices(svweights,&svweights_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
165 ierr = PetscMemcpy(fp_vweights,svweights_indices,nsvwegihts*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
166 ierr = ISRestoreIndices(svweights,&svweights_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),166,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
167 ierr = ISDestroy(&svweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),167,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
168 }
169
170 ierr = ISDestroy(&destination);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),170,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
171 ierr = PetscObjectGetComm((PetscObject)sadj,&scomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),171,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
172
173 /*
174 * If the number of big subdomains is smaller than the number of processor cores, the higher ranks do not
175 * need to do partitioning
176 * */
177 if((i+rank)<hpart->ncoarseparts) {
178 ierr = MatPartitioningDestroy(&hpart->fineMatPart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
179 /* create a fine partitioner */
180 ierr = MatPartitioningCreate(scomm,&hpart->fineMatPart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
181 ierr = PetscObjectSetOptionsPrefix((PetscObject)hpart->fineMatPart,prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),181,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
182 ierr = PetscObjectAppendOptionsPrefix((PetscObject)hpart->fineMatPart,"hierarch_fine_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),182,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
183 /* if do not set partitioning type, use parmetis by default */
184 if(!hpart->fineparttype){
185#if defined(PETSC_HAVE_PARMETIS1)
186 ierr = MatPartitioningSetType(hpart->fineMatPart,MATPARTITIONINGPARMETIS"parmetis");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),186,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
187 ierr = PetscStrallocpy(MATPARTITIONINGPARMETIS"parmetis",&hpart->fineparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),187,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
188#elif defined(PETSC_HAVE_PTSCOTCH1)
189 ierr = MatPartitioningSetType(hpart->fineMatPart,MATPARTITIONINGPTSCOTCH"ptscotch");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),189,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
190 ierr = PetscStrallocpy(MATPARTITIONINGPTSCOTCH"ptscotch",&hpart->fineparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),190,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
191#elif defined(PETSC_HAVE_CHACO)
192 ierr = MatPartitioningSetType(hpart->fineMatPart,MATPARTITIONINGCHACO"chaco");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),192,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
193 ierr = PetscStrallocpy(MATPARTITIONINGCHACO"chaco",&hpart->fineparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
194#elif defined(PETSC_HAVE_PARTY)
195 ierr = MatPartitioningSetType(hpart->fineMatPart,MATPARTITIONINGPARTY"party");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),195,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
196 ierr = PetscStrallocpy(PETSC_HAVE_PARTY,&hpart->fineparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
197#else
198 SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Requires PETSc be installed with ParMetis or run with -mat_partitioning_hierarchical_coarseparttype partitiontype")return PetscError(PetscObjectComm((PetscObject)mat),198,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,56,PETSC_ERROR_INITIAL,"Requires PETSc be installed with ParMetis or run with -mat_partitioning_hierarchical_coarseparttype partitiontype"
)
;
199#endif
200 } else {
201 ierr = MatPartitioningSetType(hpart->fineMatPart,hpart->fineparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
202 }
203 ierr = MatPartitioningSetAdjacency(hpart->fineMatPart,sadj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
204 ierr = MatPartitioningSetNParts(hpart->fineMatPart, offsets[rank+1+i]-offsets[rank+i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
205 if (part->vertex_weights) {
206 ierr = MatPartitioningSetVertexWeights(hpart->fineMatPart,fp_vweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
207 }
208 ierr = MatPartitioningApply(hpart->fineMatPart,&fineparts_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
209 } else {
210 ierr = ISCreateGeneral(scomm,0,NULL((void*)0),PETSC_OWN_POINTER,&fineparts_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),210,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
211 }
212
213 ierr = MatDestroy(&sadj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
214
215 /* Send partition back to the original owners */
216 ierr = MatPartitioningHierarchical_ReassembleFineparts(adj,fineparts_temp,mapping,&hpart->fineparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
217 ierr = ISGetIndices(hpart->fineparts,&fineparts_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),217,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
218 for (j=0;j<mat_localsize;j++)
219 if (fineparts_indices[j] >=0) fineparts_indices_tmp[j] = fineparts_indices[j];
220
221 ierr = ISRestoreIndices(hpart->fineparts,&fineparts_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
222 ierr = ISDestroy(&hpart->fineparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),222,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
223 ierr = ISDestroy(&fineparts_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
224 ierr = ISLocalToGlobalMappingDestroy(&mapping);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),224,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
225 }
226
227 if (part->vertex_weights) {
228 ierr = ISDestroy(&vweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),228,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
229 }
230
231 ierr = ISCreateGeneral(comm,mat_localsize,fineparts_indices_tmp,PETSC_OWN_POINTER,&hpart->fineparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),231,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
232 ierr = ISGetIndices(hpart->fineparts,&fineparts_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),232,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
233 ierr = ISGetIndices(hpart->coarseparts,&coarseparts_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),233,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
234 ierr = PetscMalloc1(bs*adj->rmap->n,&parts_indices)PetscMallocA(1,PETSC_FALSE,234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(bs*adj->rmap->n)*sizeof(**(&parts_indices
)),(&parts_indices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
235 /* Modify the local indices to the global indices by combing the coarse partition and the fine partitions */
236 for(i=0; i<adj->rmap->n; i++){
237 for(j=0; j<bs; j++){
238 parts_indices[bs*i+j] = fineparts_indices[i]+offsets[coarseparts_indices[i]];
239 }
240 }
241 ierr = ISRestoreIndices(hpart->fineparts,&fineparts_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
242 ierr = ISRestoreIndices(hpart->coarseparts,&coarseparts_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
243 ierr = PetscFree(offsets)((*PetscTrFree)((void*)(offsets),243,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
) || ((offsets) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),243,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
244 ierr = ISCreateGeneral(comm,bs*adj->rmap->n,parts_indices,PETSC_OWN_POINTER,partitioning);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
245 ierr = MatDestroy(&adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),245,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
246 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
247}
248
249
250PetscErrorCode MatPartitioningHierarchical_ReassembleFineparts(Mat adj, IS fineparts, ISLocalToGlobalMapping mapping, IS *sfineparts)
251{
252 PetscInt *local_indices, *global_indices,*owners,*sfineparts_indices,localsize,i;
253 const PetscInt *ranges,*fineparts_indices;
254 PetscMPIInt rank;
255 MPI_Comm comm;
256 PetscLayout rmap;
257 PetscSFNode *remote;
258 PetscSF sf;
259 PetscErrorCode ierr;
260
261 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 261; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
262 PetscValidPointer(sfineparts, 4)do { if (!sfineparts) return PetscError(((MPI_Comm)0x44000001
),262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(sfineparts,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4);
} while (0)
;
263 ierr = PetscObjectGetComm((PetscObject)adj,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),263,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
264 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),264,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
265 ierr = MatGetLayouts(adj,&rmap,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),265,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
266 ierr = ISGetLocalSize(fineparts,&localsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),266,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
267 ierr = PetscCalloc2(localsize,&global_indices,localsize,&local_indices)PetscMallocA(2,PETSC_TRUE,267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(localsize)*sizeof(**(&global_indices)),(&global_indices
),(size_t)(localsize)*sizeof(**(&local_indices)),(&local_indices
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
268 for(i=0; i<localsize; i++){
269 local_indices[i] = i;
270 }
271 /* map local indices back to global so that we can permulate data globally */
272 ierr = ISLocalToGlobalMappingApply(mapping,localsize,local_indices,global_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
273 ierr = PetscCalloc1(localsize,&owners)PetscMallocA(1,PETSC_TRUE,273,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(localsize)*sizeof(**(&owners)),(&owners))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),273,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
274 /* find owners for global indices */
275 for(i=0; i<localsize; i++){
276 ierr = PetscLayoutFindOwner(rmap,global_indices[i],&owners[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),276,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
277 }
278 ierr = PetscLayoutGetRanges(rmap,&ranges);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),278,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
279 ierr = PetscCalloc1(ranges[rank+1]-ranges[rank],&sfineparts_indices)PetscMallocA(1,PETSC_TRUE,279,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(ranges[rank+1]-ranges[rank])*sizeof(**(&sfineparts_indices
)),(&sfineparts_indices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),279,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
280
281 for (i=0; i<(ranges[rank+1]-ranges[rank]); i++) {
282 sfineparts_indices[i] = -1;
283 }
284
285 ierr = ISGetIndices(fineparts,&fineparts_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),285,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
286 ierr = PetscSFCreate(comm,&sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
287 ierr = PetscCalloc1(localsize,&remote)PetscMallocA(1,PETSC_TRUE,287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(localsize)*sizeof(**(&remote)),(&remote))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
288 for(i=0; i<localsize; i++){
289 remote[i].rank = owners[i];
290 remote[i].index = global_indices[i]-ranges[owners[i]];
291 }
292 ierr = PetscSFSetType(sf,PETSCSFBASIC"basic");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),292,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
293 /* not sure how to add prefix to sf */
294 ierr = PetscSFSetFromOptions(sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
295 ierr = PetscSFSetGraph(sf,localsize,localsize,NULL((void*)0),PETSC_OWN_POINTER,remote,PETSC_OWN_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
296 ierr = PetscSFReduceBegin(sf,MPIU_INT((MPI_Datatype)0x4c000405),fineparts_indices,sfineparts_indices,MPIU_REPLACE(MPI_Op)(0x5800000d));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
297 ierr = PetscSFReduceEnd(sf,MPIU_INT((MPI_Datatype)0x4c000405),fineparts_indices,sfineparts_indices,MPIU_REPLACE(MPI_Op)(0x5800000d));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),297,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
298 ierr = PetscSFDestroy(&sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),298,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
299 ierr = ISRestoreIndices(fineparts,&fineparts_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),299,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
300 ierr = ISCreateGeneral(comm,ranges[rank+1]-ranges[rank],sfineparts_indices,PETSC_OWN_POINTER,sfineparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),300,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
301 ierr = PetscFree2(global_indices,local_indices)PetscFreeA(2,301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,&(global_indices),&(local_indices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
302 ierr = PetscFree(owners)((*PetscTrFree)((void*)(owners),302,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
) || ((owners) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),302,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
303 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
304}
305
306
307PetscErrorCode MatPartitioningHierarchical_AssembleSubdomain(Mat adj,IS vweights, IS destination,IS *svweights,Mat *sadj,ISLocalToGlobalMapping *mapping)
308{
309 IS irows,icols;
310 PetscInt irows_ln;
311 PetscMPIInt rank;
312 const PetscInt *irows_indices;
313 MPI_Comm comm;
314 PetscErrorCode ierr;
315
316 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 316; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
317 ierr = PetscObjectGetComm((PetscObject)adj,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
318 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
319 /* figure out where data comes from */
320 ierr = ISBuildTwoSided(destination,NULL((void*)0),&irows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),320,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
321 ierr = ISDuplicate(irows,&icols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),321,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
322 ierr = ISGetLocalSize(irows,&irows_ln);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),322,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
323 ierr = ISGetIndices(irows,&irows_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),323,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
324 ierr = ISLocalToGlobalMappingCreate(comm,1,irows_ln,irows_indices,PETSC_COPY_VALUES,mapping);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),324,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
325 ierr = ISRestoreIndices(irows,&irows_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),325,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
326 ierr = MatCreateSubMatrices(adj,1,&irows,&icols,MAT_INITIAL_MATRIX,&sadj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),326,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
327 if (vweights && svweights) {
328 ierr = ISCreateSubIS(vweights,irows,svweights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),328,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
329 }
330 ierr = ISDestroy(&irows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),330,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
331 ierr = ISDestroy(&icols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),331,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
332 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
333}
334
335
336PetscErrorCode MatPartitioningHierarchical_DetermineDestination(MatPartitioning part, IS partitioning, PetscInt pstart, PetscInt pend, IS *destination)
337{
338 MPI_Comm comm;
339 PetscMPIInt rank,size,target;
340 PetscInt plocalsize,*dest_indices,i;
341 const PetscInt *part_indices;
342 PetscErrorCode ierr;
343
344 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 344; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
345 ierr = PetscObjectGetComm((PetscObject)part,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),345,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
346 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),346,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
347 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
348 if((pend-pstart)>size) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"range [%D, %D] should be smaller than or equal to size %D",pstart,pend,size)return PetscError(((MPI_Comm)0x44000001),348,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,75,PETSC_ERROR_INITIAL,"range [%D, %D] should be smaller than or equal to size %D"
,pstart,pend,size)
;
349 if(pstart>pend) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP," pstart %D should be smaller than pend %D",pstart,pend)return PetscError(((MPI_Comm)0x44000001),349,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,75,PETSC_ERROR_INITIAL," pstart %D should be smaller than pend %D"
,pstart,pend)
;
350 ierr = ISGetLocalSize(partitioning,&plocalsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
351 ierr = PetscCalloc1(plocalsize,&dest_indices)PetscMallocA(1,PETSC_TRUE,351,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(plocalsize)*sizeof(**(&dest_indices)),(&dest_indices
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),351,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
352 ierr = ISGetIndices(partitioning,&part_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),352,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
353 for(i=0; i<plocalsize; i++){
354 /* compute target */
355 target = part_indices[i]-pstart;
356 /* mark out of range entity as -1 */
357 if(part_indices[i]<pstart || part_indices[i]>=pend) target = -1;
358 dest_indices[i] = target;
359 }
360 ierr = ISCreateGeneral(comm,plocalsize,dest_indices,PETSC_OWN_POINTER,destination);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),360,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
361 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
362}
363
364
365PetscErrorCode MatPartitioningView_Hierarchical(MatPartitioning part,PetscViewer viewer)
366{
367 MatPartitioning_Hierarchical *hpart = (MatPartitioning_Hierarchical*)part->data;
368 PetscErrorCode ierr;
369 PetscMPIInt rank;
370 PetscBool iascii;
371 PetscViewer sviewer;
372
373 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 373; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
374 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)part),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),374,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
375 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),375,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
376 if(iascii){
377 ierr = PetscViewerASCIIPrintf(viewer," Number of coarse parts: %D\n",hpart->ncoarseparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),377,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
378 ierr = PetscViewerASCIIPrintf(viewer," Coarse partitioner: %s\n",hpart->coarseparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),378,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
379 if (hpart->coarseMatPart) {
380 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),380,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
381 ierr = MatPartitioningView(hpart->coarseMatPart,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),381,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
382 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),382,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
383 }
384 ierr = PetscViewerASCIIPrintf(viewer," Number of fine parts: %D\n",hpart->nfineparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),384,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
385 ierr = PetscViewerASCIIPrintf(viewer," Fine partitioner: %s\n",hpart->fineparttype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),385,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
386 ierr = PetscViewerGetSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),386,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
387 if (!rank && hpart->fineMatPart) {
388 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
389 ierr = MatPartitioningView(hpart->fineMatPart,sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
390 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),390,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
391 }
392 ierr = PetscViewerRestoreSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),392,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
393 }
394 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
395}
396
397
398PetscErrorCode MatPartitioningHierarchicalGetFineparts(MatPartitioning part,IS *fineparts)
399{
400 MatPartitioning_Hierarchical *hpart = (MatPartitioning_Hierarchical*)part->data;
401 PetscErrorCode ierr;
402
403 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 403; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
404 *fineparts = hpart->fineparts;
405 ierr = PetscObjectReference((PetscObject)hpart->fineparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),405,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
406 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
407}
408
409PetscErrorCode MatPartitioningHierarchicalGetCoarseparts(MatPartitioning part,IS *coarseparts)
410{
411 MatPartitioning_Hierarchical *hpart = (MatPartitioning_Hierarchical*)part->data;
412 PetscErrorCode ierr;
413
414 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 414; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
415 *coarseparts = hpart->coarseparts;
416 ierr = PetscObjectReference((PetscObject)hpart->coarseparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),416,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
417 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
418}
419
420PetscErrorCode MatPartitioningHierarchicalSetNcoarseparts(MatPartitioning part, PetscInt ncoarseparts)
421{
422 MatPartitioning_Hierarchical *hpart = (MatPartitioning_Hierarchical*)part->data;
423
424 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 424; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
425 hpart->ncoarseparts = ncoarseparts;
426 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
427}
428
429PetscErrorCode MatPartitioningHierarchicalSetNfineparts(MatPartitioning part, PetscInt nfineparts)
430{
431 MatPartitioning_Hierarchical *hpart = (MatPartitioning_Hierarchical*)part->data;
432
433 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 433; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
434 hpart->nfineparts = nfineparts;
435 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
436}
437
438PetscErrorCode MatPartitioningSetFromOptions_Hierarchical(PetscOptionItems *PetscOptionsObject,MatPartitioning part)
439{
440 MatPartitioning_Hierarchical *hpart = (MatPartitioning_Hierarchical*)part->data;
441 PetscErrorCode ierr;
442 char value[1024];
443 PetscBool flag = PETSC_FALSE;
444
445 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 445; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
446 ierr = PetscOptionsHead(PetscOptionsObject,"Set hierarchical partitioning options");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),446,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
447 ierr = PetscOptionsString("-mat_partitioning_hierarchical_coarseparttype","coarse part type",NULL,NULL,value,1024,&flag)PetscOptionsString_Private(PetscOptionsObject,"-mat_partitioning_hierarchical_coarseparttype"
,"coarse part type",((void*)0),((void*)0),value,1024,&flag
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),447,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
448 if(flag){
449 ierr = PetscCalloc1(1024,&hpart->coarseparttype)PetscMallocA(1,PETSC_TRUE,449,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(1024)*sizeof(**(&hpart->coarseparttype)),(&
hpart->coarseparttype))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),449,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
450 ierr = PetscStrcpy(hpart->coarseparttype,value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
451 }
452 ierr = PetscOptionsString("-mat_partitioning_hierarchical_fineparttype","fine part type",NULL,NULL,value,1024,&flag)PetscOptionsString_Private(PetscOptionsObject,"-mat_partitioning_hierarchical_fineparttype"
,"fine part type",((void*)0),((void*)0),value,1024,&flag)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),452,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
453 if(flag){
454 ierr = PetscCalloc1(1024,&hpart->fineparttype)PetscMallocA(1,PETSC_TRUE,454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(1024)*sizeof(**(&hpart->fineparttype)),(&
hpart->fineparttype))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
455 ierr = PetscStrcpy(hpart->fineparttype,value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),455,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
456 }
457 ierr = PetscOptionsInt("-mat_partitioning_hierarchical_ncoarseparts","number of coarse parts",NULL,hpart->ncoarseparts,&hpart->ncoarseparts,&flag)PetscOptionsInt_Private(PetscOptionsObject,"-mat_partitioning_hierarchical_ncoarseparts"
,"number of coarse parts",((void*)0),hpart->ncoarseparts,&
hpart->ncoarseparts,&flag)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),457,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
458 ierr = PetscOptionsInt("-mat_partitioning_hierarchical_nfineparts","number of fine parts",NULL,hpart->nfineparts,&hpart->nfineparts,&flag)PetscOptionsInt_Private(PetscOptionsObject,"-mat_partitioning_hierarchical_nfineparts"
,"number of fine parts",((void*)0),hpart->nfineparts,&
hpart->nfineparts,&flag)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),458,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
459 ierr = PetscOptionsTail()0; {if (PetscOptionsObject->count != 1) do { do { ; if (petscstack
&& petscstack->currentsize > 0) { petscstack->
currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0);}
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),459,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
460 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
461}
462
463
464PetscErrorCode MatPartitioningDestroy_Hierarchical(MatPartitioning part)
465{
466 MatPartitioning_Hierarchical *hpart = (MatPartitioning_Hierarchical*)part->data;
467 PetscErrorCode ierr;
468
469 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 469; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
470 if(hpart->coarseparttype) {ierr = PetscFree(hpart->coarseparttype)((*PetscTrFree)((void*)(hpart->coarseparttype),470,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
) || ((hpart->coarseparttype) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
471 if(hpart->fineparttype) {ierr = PetscFree(hpart->fineparttype)((*PetscTrFree)((void*)(hpart->fineparttype),471,__func__,
"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
) || ((hpart->fineparttype) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),471,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
472 ierr = ISDestroy(&hpart->fineparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),472,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
473 ierr = ISDestroy(&hpart->coarseparts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),473,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
474 ierr = MatPartitioningDestroy(&hpart->coarseMatPart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),474,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
475 ierr = MatPartitioningDestroy(&hpart->fineMatPart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
476 ierr = MatPartitioningDestroy(&hpart->improver);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),476,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
477 ierr = PetscFree(hpart)((*PetscTrFree)((void*)(hpart),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
) || ((hpart) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
478 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
479}
480
481/*
482 Improves the quality of a partition
483*/
484static PetscErrorCode MatPartitioningImprove_Hierarchical(MatPartitioning part, IS *partitioning)
485{
486 PetscErrorCode ierr;
487 MatPartitioning_Hierarchical *hpart = (MatPartitioning_Hierarchical*)part->data;
488 Mat mat = part->adj, adj;
489 PetscBool flg;
490 PetscInt *vertex_weights;
491 const char *prefix;
492
493 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 493; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
494 ierr = PetscObjectTypeCompare((PetscObject)mat,MATMPIADJ"mpiadj",&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),494,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
495 if (flg) {
496 adj = mat;
497 ierr = PetscObjectReference((PetscObject)adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),497,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
498 }else {
499 /* bs indicates if the converted matrix is "reduced" from the original and hence the
500 resulting partition results need to be stretched to match the original matrix */
501 ierr = MatConvert(mat,MATMPIADJ"mpiadj",MAT_INITIAL_MATRIX,&adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),501,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
502 }
503
504 /* If there exists a mat partitioner, we should delete it */
505 ierr = MatPartitioningDestroy(&hpart->improver);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),505,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
506 ierr = MatPartitioningCreate(PetscObjectComm((PetscObject)part),&hpart->improver);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),506,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
507 ierr = PetscObjectGetOptionsPrefix((PetscObject)part,&prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),507,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
508 ierr = PetscObjectSetOptionsPrefix((PetscObject)hpart->improver,prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),508,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
509 ierr = PetscObjectAppendOptionsPrefix((PetscObject)hpart->improver,"hierarch_improver_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),509,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
510 /* Only parmetis supports to refine a partition */
511#if defined(PETSC_HAVE_PARMETIS1)
512 ierr = MatPartitioningSetType(hpart->improver,MATPARTITIONINGPARMETIS"parmetis");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),512,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
513#else
514 SETERRQ(PetscObjectComm((PetscObject)adj),PETSC_ERR_SUP,"Requires PETSc be installed with ParMetis\n")return PetscError(PetscObjectComm((PetscObject)adj),514,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,56,PETSC_ERROR_INITIAL,"Requires PETSc be installed with ParMetis\n"
)
;
515#endif
516
517 ierr = MatPartitioningSetAdjacency(hpart->improver,adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),517,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
518 ierr = MatPartitioningSetNParts(hpart->improver, part->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),518,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
519 /* copy over vertex weights */
520 if(part->vertex_weights){
521 ierr = PetscMalloc1(adj->rmap->n,&vertex_weights)PetscMallocA(1,PETSC_FALSE,521,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(adj->rmap->n)*sizeof(**(&vertex_weights))
,(&vertex_weights))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),521,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
522 ierr = PetscMemcpy(vertex_weights,part->vertex_weights,sizeof(PetscInt)*adj->rmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),522,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
523 ierr = MatPartitioningSetVertexWeights(hpart->improver,vertex_weights);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),523,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
524 }
525 ierr = MatPartitioningImprove(hpart->improver,partitioning);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),525,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
526 ierr = MatDestroy(&adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),526,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
527 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
528}
529
530
531/*MC
532 MATPARTITIONINGHIERARCH - Creates a partitioning context via hierarchical partitioning strategy.
533 The graph is partitioned into a number of subgraphs, and each subgraph is further split into a few smaller
534 subgraphs. The idea can be applied in a recursive manner. It is useful when you want to partition the graph
535 into a large number of subgraphs (often more than 10K) since partitions obtained with existing partitioners
536 such as ParMETIS and PTScotch are far from ideal. The hierarchical partitioning also tries to avoid off-node
537 communication as much as possible for multi-core processor. Another user case for the hierarchical partitioning
538 is to improve PCGASM convergence by generating multi-rank connected subdomain.
539
540 Collective on MPI_Comm
541
542 Input Parameter:
543. part - the partitioning context
544
545 Options Database Keys:
546+ -mat_partitioning_hierarchical_coarseparttype - partitioner type at the first level and parmetis is used by default
547. -mat_partitioning_hierarchical_fineparttype - partitioner type at the second level and parmetis is used by default
548. -mat_partitioning_hierarchical_ncoarseparts - number of subgraphs is required at the first level, which is often the number of compute nodes
549- -mat_partitioning_hierarchical_nfineparts - number of smaller subgraphs for each subgraph, which is often the number of cores per compute node
550
551 Level: beginner
552
553 References:
554 1. Fande Kong, Xiao-Chuan Cai, A highly scalable multilevel Schwarz method with boundary geometry preserving coarse spaces for 3D elasticity
555 problems on domains with complex geometry, SIAM Journal on Scientific Computing 38 (2), C73-C95, 2016
556 2. Fande Kong, Roy H. Stogner, Derek Gaston, John W. Peterson, Cody J. Permann, Andrew E. Slaughter, and Richard C. Martineau,
557 A general-purpose hierarchical mesh partitioning method with node balancing strategies for large-scale numerical simulations,
558 arXiv preprint arXiv:1809.02666CoRR, 2018.
559
560.keywords: Partitioning, create, context
561
562.seealso: MatPartitioningSetType(), MatPartitioningType
563
564M*/
565
566PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatPartitioningCreate_Hierarchical(MatPartitioning part)
567{
568 PetscErrorCode ierr;
569 MatPartitioning_Hierarchical *hpart;
570
571 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
; petscstack->line[petscstack->currentsize] = 571; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
572 ierr = PetscNewLog(part,&hpart)(PetscMallocA(1,PETSC_TRUE,572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,(size_t)(1)*sizeof(**(((&hpart)))),(((&hpart)))) || PetscLogObjectMemory
((PetscObject)part,sizeof(**(&hpart))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/partition/impls/hierarchical/hierarchical.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
573 part->data = (void*)hpart;
574
575 hpart->fineparttype = 0; /* fine level (second) partitioner */
576 hpart->coarseparttype = 0; /* coarse level (first) partitioner */
577 hpart->nfineparts = 1; /* we do not further partition coarse partition any more by default */
578 hpart->ncoarseparts = 0; /* number of coarse parts (first level) */
579 hpart->coarseparts = 0;
580 hpart->fineparts = 0;
581 hpart->coarseMatPart = 0;
582 hpart->fineMatPart = 0;
583
584 part->ops->apply = MatPartitioningApply_Hierarchical;
585 part->ops->view = MatPartitioningView_Hierarchical;
586 part->ops->destroy = MatPartitioningDestroy_Hierarchical;
587 part->ops->setfromoptions = MatPartitioningSetFromOptions_Hierarchical;
588 part->ops->improve = MatPartitioningImprove_Hierarchical;
589 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
590}