geo_mpi_partition_scotch.cc
Go to the documentation of this file.
#include "rheolef/config.h"
#ifdef _RHEOLEF_HAVE_MPI
// mesh partition
#include "rheolef/distributed.h"
#include "geo_partition_scotch.h"
namespace rheolef {
using namespace std;
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);
extern "C" {
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);
}
// -------------------------------------------------------------------------------------
// This function is the entry point of the distributed k-way multilevel mesh partitionioner
// This function assumes nothing about the mesh distribution.
// It is the general case.
// -------------------------------------------------------------------------------------
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)
{
if (eind.size() == 0) {
error_macro ("empty sizes not supported");
}
// Try and take care bad inputs
if (elmdist == NULL || eptr == NULL ||
ncon == NULL || ncommonnodes == NULL || nparts == NULL ||
tpwgts == NULL || ubvec == NULL || edgecut == NULL ||
part == NULL) {
error_macro ("one or more required parameters is NULL");
}
comm.barrier();
vector<my_idxtype> xadj;
vector<my_idxtype> adjncy;
geo_dual (
elmdist,
eptr,
eind,
ncommonnodes,
xadj,
adjncy,
comm);
comm.barrier();
// Partition the graph
MPI_Comm raw_comm = comm;
int options[10];
options[0] = 1;
options[PMV3_OPTION_DBGLVL] = 0; // otherwise: timming print to stdout...
options[PMV3_OPTION_SEED] = 0;
int numflag = 0;
int wgtflag = 0;
ParMETIS_V3_PartKway(
elmdist,
xadj.begin().operator->(),
adjncy.begin().operator->(),
elmwgt,
NULL,
&wgtflag,
&numflag,
ncon,
nparts,
tpwgts,
ubvec,
options,
edgecut,
part,
&raw_comm);
comm.barrier();
}
} // namespace rheolef
#endif // _RHEOLEF_HAVE_MPI
rheolef::my_idxtype
int my_idxtype
Definition: geo_partition_scotch.h:28
error_macro
#define error_macro(message)
Definition: dis_macros.h:49
geo_partition_scotch.h
PMV3_OPTION_DBGLVL
#define PMV3_OPTION_DBGLVL
Definition: geo_partition_scotch.h:61
PMV3_OPTION_SEED
#define PMV3_OPTION_SEED
Definition: geo_partition_scotch.h:62
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
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::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::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