OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
mumps_metis64.c
Go to the documentation of this file.
1/*
2 *
3 * This file is part of MUMPS 5.5.1, released
4 * on Tue Jul 12 13:17:24 UTC 2022
5 *
6 *
7 * Copyright 1991-2022 CERFACS, CNRS, ENS Lyon, INP Toulouse, Inria,
8 * Mumps Technologies, University of Bordeaux.
9 *
10 * This version of MUMPS is provided to you free of charge. It is
11 * released under the CeCILL-C license
12 * (see doc/CeCILL-C_V1-en.txt, doc/CeCILL-C_V1-fr.txt, and
13 * https://cecill.info/licences/Licence_CeCILL-C_V1-en.html)
14 *
15 */
16#include <stdio.h> /* For NULL constant (stddef.h) and debug printings */
17#include "mumps_metis64.h"
18#if defined(parmetis) || defined(parmetis3)
19/*PARMETIS*/
20#if defined(parmetis3)
21/* Provide prototype by hand. This is because we are not sure
22 * at compilation/preprocessing time whether we use a 32-bit
23 * or a 64-bit metis */
24 void ParMETIS_V3_NodeND(MUMPS_INT8 *first, MUMPS_INT8 *vertloctab, MUMPS_INT8 *edgeloctab, MUMPS_INT *numflag, MUMPS_INT *options, MUMPS_INT8 *order, MUMPS_INT8 *sizes, MPI_Comm *Ccomm);
25#else
26#include "metis.h"
27#include "parmetis.h" /* Prototypes from parmetis.h will be used */
28#endif
29void MUMPS_CALL
30MUMPS_PARMETIS_64(MUMPS_INT8 *first, MUMPS_INT8 *vertloctab,
31 MUMPS_INT8 *edgeloctab,
32#if defined(parmetis3)
33 MUMPS_INT *numflag, MUMPS_INT *options,
34#else
35 MUMPS_INT8 *numflag, MUMPS_INT8 *options,
36#endif
37 MUMPS_INT8 *order,
38 MUMPS_INT8 *sizes, MUMPS_INT *comm,
39 MUMPS_INT *ierr)
40{
41 MPI_Comm int_comm;
42#if defined(parmetis)
43# if (IDXTYPEWIDTH == 64)
44 int iierr;
45#endif
46#endif
47 int_comm = MPI_Comm_f2c(*comm);
48#if defined(parmetis3)
49 /* Prototype may not match with 32-bit integers and Parmetis3 */
50 ParMETIS_V3_NodeND(first, vertloctab, edgeloctab, numflag, options, order, sizes, &int_comm);
51#elif defined(parmetis)
52# if (IDXTYPEWIDTH == 64)
53 *ierr=0;
54 iierr=ParMETIS_V3_NodeND(first, vertloctab, edgeloctab, numflag, options, order, sizes, &int_comm);
55 if(iierr != METIS_OK)
56 *ierr=1;
57# else
58 /* SHOULD NEVER BE CALLED */
59 printf("** Error: ParMETIS version >= 4, IDXTYPE WIDTH !=64, but MUMPS_PARMETIS_64 was called\n");
60 *ierr=1;
61# endif
62#endif
63 return;
64}
65#endif
66#if defined(parmetis) || defined(metis) || defined(parmetis3) || defined(metis4)
67#if defined(metis4) || defined(parmetis3) /* parmetis3 comes with metis4 */
68/* Provide prototype by hand. This is because we are not sure
69 * at compilation/preprocessing time whether we use a 32-bit
70 * or a 64-bit metis */
71void METIS_PartGraphKway(int *, MUMPS_INT8 *, MUMPS_INT8 *, MUMPS_INT8 *, MUMPS_INT8 *, int *, int *, int *, int *, int *, MUMPS_INT8 *);
72#else
73/* Prototype properly defined in metis.h
74 * One can rely on IDXTYPEWIDTH to know at compilation/preprocessing
75 * time whether we use a 32-bit or a 64-bit metis */
76#include "metis.h"
77#endif
78/* Interface for metis k-way partitioning with 64-bit ints */
79void MUMPS_CALL
80MUMPS_METIS_KWAY_64(MUMPS_INT8 *n, MUMPS_INT8 *iptr,
81 MUMPS_INT8 *jcn, MUMPS_INT8 *k,
82 MUMPS_INT8 *part)
83/* n -- the size of the graph to be partitioned
84 iptr -- pointer to the beginning of each node's adjacency list
85 jcn -- jcn[iptr[i]:iptr[i+1]-1] contains the list of neighbors of node i
86 k -- the number of parts
87 part -- part[i] is the part node i belongs to */
88/* SELECTIVE I8 FIXME: add an argument *ierr, check it on exit */
89 {
90#if defined(metis4) || defined(parmetis3)
91 MUMPS_INT numflag, edgecut, wgtflag, options[8];
92 MUMPS_INT kINT, nINT;
93 options[0] = 0;
94 /* unweighted partitioning */
95 wgtflag = 0;
96 /* Use 1-based fortran numbering */
97 numflag = 1;
98 /* n and k are MUMPS_INT */
99 nINT=(MUMPS_INT)(*n);
100 kINT=(MUMPS_INT)(*k);
101/* void METIS_PartGraphKway(int *, idxtype *, idxtype *, idxtype *, idxtype *, int *, int *, int *, int *, int *, idxtype *); */
102 METIS_PartGraphKway(&nINT, iptr, jcn,
103 NULL, NULL, &wgtflag,
104 &numflag, &kINT,
105 options, &edgecut,
106 part);
107#else /* METIS >= 5 */
108 int ierr;
109# if (IDXTYPEWIDTH == 64)
110 MUMPS_INT8 ncon, edgecut, options[40];
111 ierr=METIS_SetDefaultOptions(options);
112 options[0] = 0;
113 /* Use 1-based fortran numbering */
114 options[17] = 1;
115 ncon = 1;
116 ierr = METIS_PartGraphKway(n, &ncon, iptr, jcn,
117 NULL, NULL, NULL,
118 k, NULL, NULL, options,
119 &edgecut, part);
120# else
121 printf("** Error: METIS version >= 4, IDXTYPE WIDTH !=64, but MUMPS_METIS_KWAY_64 was called\n");
122 ierr=1;
123# endif
124#endif
125 return;
126 }
127/* Interface for metis k-way partitioning with 64-bit ints and weights on vertices*/
128void MUMPS_CALL
129MUMPS_METIS_KWAY_AB_64(MUMPS_INT8 *n, MUMPS_INT8 *iptr,
130 MUMPS_INT8 *jcn, MUMPS_INT8 *k,
131 MUMPS_INT8 *part, MUMPS_INT8 *vwgt )
132/* n -- the size of the graph to be partitioned
133 iptr -- pointer to the beginning of each node's adjacency list
134 jcn -- jcn[iptr[i]:iptr[i+1]-1] contains the list of neighbors of node i
135 k -- the number of parts
136 part -- part[i] is the part node i belongs to */
137/* SELECTIVE I8 FIXME: add an argument *ierr, check it on exit */
138 {
139#if defined(metis4) || defined(parmetis3)
140 MUMPS_INT numflag, edgecut, wgtflag, options[8];
141 MUMPS_INT kINT, nINT;
142 options[0] = 0;
143 /* unweighted partitioning */
144 wgtflag = 0;
145 /* Use 1-based fortran numbering */
146 numflag = 1;
147 /* n and k are MUMPS_INT */
148 nINT=(MUMPS_INT)(*n);
149 kINT=(MUMPS_INT)(*k);
150/* void METIS_PartGraphKway(int *, idxtype *, idxtype *, idxtype *, idxtype *, int *, int *, int *, int *, int *, idxtype *); */
151 METIS_PartGraphKway(&nINT, iptr, jcn,
152 vwgt, NULL, &wgtflag,
153 &numflag, &kINT,
154 options, &edgecut,
155 part);
156#else /* METIS >= 5 */
157 int ierr;
158# if (IDXTYPEWIDTH == 64)
159 MUMPS_INT8 ncon, edgecut, options[40];
160 ierr=METIS_SetDefaultOptions(options);
161 options[0] = 0;
162 /* Use 1-based fortran numbering */
163 options[17] = 1;
164 ncon = 1;
165 ierr = METIS_PartGraphKway(n, &ncon, iptr, jcn,
166 vwgt, NULL, NULL,
167 k, NULL, NULL, options,
168 &edgecut, part);
169# else
170 printf("** Error: METIS version >= 4, IDXTYPE WIDTH !=64, but MUMPS_METIS_KWAY_AB_64 was called\n");
171 ierr=1;
172# endif
173#endif
174 return;
175 }
176#endif
int METIS_PartGraphKway(int *NELEM, int *NCOND, int *XADJ, int *ADJNCY, int *IWD, int *vsize, int *ADJWGT2, int *NNODE, float *tpwgts, float *UBVEC, int *OPTIONS, int *NEC, int *CEP)
LIBSEQ_INT MPI_Comm
Definition mpi.h:50
#define MUMPS_INT8
#define MUMPS_INT
#define MUMPS_CALL
n