source: codes/icosagcm/devel/Python/src/partition.c @ 643

Last change on this file since 643 was 620, checked in by dubos, 7 years ago

devel/unstructured : mesh partitioning

File size: 1.2 KB
Line 
1#include <mpi.h>
2#include <stdio.h>
3#include <parmetis.h>
4
5void dynamico_partition_graph(int mpi_rank, int mpi_size, 
6                     idx_t vtxdist[], idx_t xadj_loc[], idx_t adjncy_loc[],
7                     idx_t nparts, idx_t part[])
8{
9  MPI_Comm comm = MPI_COMM_WORLD; /* avoid passing a communicator as argument due to Fortran/C issues */
10  idx_t edgecut;
11  idx_t options[]={0}, wgtflag=0, numflag=0, ncon=1;
12  real_t tpwgts[2*nparts], ubvec[]={1.05};
13
14  /* int ParMETIS V3 PartKway (
15     idx t *vtxdist, idx t *xadj, idx t *adjncy, idx t *vwgt, idx t *adjwgt,
16     idx t *wgtflag, idx t *numflag, idx t *ncon, idx t *nparts,
17     real t *tpwgts, real t *ubvec, idx t *options, idx t *edgecut, idx t *part,
18     MPI Comm *comm )
19  */
20
21/*  printf("sizeof : %d %d \n", sizeof(int), sizeof(idx_t));
22  printf("partition_graph : %d %d %d\n", mpi_rank, mpi_size, nparts);
23  printf("vtxdist : \n");
24  for(int i=0; i<mpi_size+1; i++) printf("%d %d %d\n", mpi_rank, i, vtxdist[i]); */
25     
26  for(int i=0; i<2*nparts; i++) tpwgts[i] = 1./nparts;
27  ParMETIS_V3_PartKway(vtxdist, xadj_loc, adjncy_loc, NULL, NULL, 
28                       &wgtflag, &numflag, &ncon, &nparts, 
29                       tpwgts, ubvec, options, &edgecut, part, &comm); 
30}
Note: See TracBrowser for help on using the repository browser.