Rheolef  7.1
an efficient C++ finite element environment
geo_mpi_partition_scotch.cc
Go to the documentation of this file.
1 #include "rheolef/config.h"
22 #ifdef _RHEOLEF_HAVE_MPI
23 // mesh partition
24 #include "rheolef/distributed.h"
25 
26 #include "geo_partition_scotch.h"
27 
28 namespace rheolef {
29 using namespace std;
30 
31 void geo_dual (
32  my_idxtype *elmdist,
33  my_idxtype *eptr,
34  vector<my_idxtype>& eind,
35  int *ncommonnodes,
36  vector<my_idxtype>& xadj,
37  vector<my_idxtype>& adjncy,
38  const mpi::communicator& comm);
39 
40 extern "C" {
41 void ParMETIS_V3_PartKway (const int * const, int * const, int * const, int * const, int * const, const int * const, const int * const, const int * const, const int * const, const float * const, const float * const, const int * const, int * const, int * const, MPI_Comm * const);
42 }
43 // -------------------------------------------------------------------------------------
44 // This function is the entry point of the distributed k-way multilevel mesh partitionioner
45 // This function assumes nothing about the mesh distribution.
46 // It is the general case.
47 // -------------------------------------------------------------------------------------
49  my_idxtype *elmdist,
50  my_idxtype *eptr,
51  vector<my_idxtype>& eind,
52  my_idxtype *elmwgt,
53  int *ncon,
54  int *ncommonnodes,
55  int *nparts,
56  float *tpwgts,
57  float *ubvec,
58  int *edgecut,
59  my_idxtype *part,
60  const mpi::communicator& comm)
61 {
62  if (eind.size() == 0) {
63  error_macro ("empty sizes not supported");
64  }
65  // Try and take care bad inputs
66  if (elmdist == NULL || eptr == NULL ||
67  ncon == NULL || ncommonnodes == NULL || nparts == NULL ||
68  tpwgts == NULL || ubvec == NULL || edgecut == NULL ||
69  part == NULL) {
70  error_macro ("one or more required parameters is NULL");
71  }
72  comm.barrier();
73 
74  vector<my_idxtype> xadj;
75  vector<my_idxtype> adjncy;
76  geo_dual (
77  elmdist,
78  eptr,
79  eind,
80  ncommonnodes,
81  xadj,
82  adjncy,
83  comm);
84 
85  comm.barrier();
86 
87  // Partition the graph
88  MPI_Comm raw_comm = comm;
89  int options[10];
90  options[0] = 1;
91  options[PMV3_OPTION_DBGLVL] = 0; // otherwise: timming print to stdout...
92  options[PMV3_OPTION_SEED] = 0;
93  int numflag = 0;
94  int wgtflag = 0;
96  elmdist,
97  xadj.begin().operator->(),
98  adjncy.begin().operator->(),
99  elmwgt,
100  NULL,
101  &wgtflag,
102  &numflag,
103  ncon,
104  nparts,
105  tpwgts,
106  ubvec,
107  options,
108  edgecut,
109  part,
110  &raw_comm);
111 
112  comm.barrier();
113 }
114 
115 } // namespace rheolef
116 #endif // _RHEOLEF_HAVE_MPI
rheolef::geo_dual
void geo_dual(my_idxtype *elmdist, my_idxtype *eptr, vector< my_idxtype > &eind, int *ncommonnodes, vector< my_idxtype > &xadj, vector< my_idxtype > &adjncy, const mpi::communicator &comm)
Definition: geo_mpi_dual.cc:35
rheolef::my_idxtype
int my_idxtype
Definition: geo_partition_scotch.h:28
rheolef::ParMETIS_V3_PartKway
void ParMETIS_V3_PartKway(const int *const, int *const, int *const, int *const, int *const, const int *const, const int *const, const int *const, const int *const, const float *const, const float *const, const int *const, int *const, int *const, MPI_Comm *const)
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
error_macro
#define error_macro(message)
Definition: dis_macros.h:49
PMV3_OPTION_SEED
#define PMV3_OPTION_SEED
Definition: geo_partition_scotch.h:62
rheolef::geo_partition_scotch
void geo_partition_scotch(my_idxtype *elmdist, my_idxtype *eptr, vector< my_idxtype > &eind, my_idxtype *elmwgt, int *ncon, int *ncommonnodes, int *nparts, float *tpwgts, float *ubvec, int *edgecut, my_idxtype *part, const mpi::communicator &comm)
Definition: geo_mpi_partition_scotch.cc:48
PMV3_OPTION_DBGLVL
#define PMV3_OPTION_DBGLVL
Definition: geo_partition_scotch.h:61
geo_partition_scotch.h