summaryrefslogtreecommitdiff
path: root/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/mmetis.c
diff options
context:
space:
mode:
authorTor Aamodt <[email protected]>2010-07-15 18:09:46 -0800
committerTor Aamodt <[email protected]>2010-07-15 18:09:46 -0800
commit69f2911e04ffb1b19eef1fafb8c040af271f656e (patch)
tree231d3b6bdc3a202f7c255bfcf7bf2c36e32cee9e /benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/mmetis.c
creating branch for adding support for CUDA 3.x and Fermi
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6829]
Diffstat (limited to 'benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/mmetis.c')
-rw-r--r--benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/mmetis.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/mmetis.c b/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/mmetis.c
new file mode 100644
index 0000000..b262ed1
--- /dev/null
+++ b/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/mmetis.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright 1997, Regents of the University of Minnesota
+ *
+ * mmetis.c
+ *
+ * This is the entry point of ParMETIS_V3_PartMeshKway
+ *
+ * Started 10/19/96
+ * George
+ *
+ * $Id: mmetis.c,v 1.8 2003/07/25 04:01:04 karypis Exp $
+ *
+ */
+
+#include <parmetislib.h>
+
+
+/***********************************************************************************
+* This function is the entry point of the parallel k-way multilevel mesh partitionioner.
+* This function assumes nothing about the mesh distribution.
+* It is the general case.
+************************************************************************************/
+void ParMETIS_V3_PartMeshKway(idxtype *elmdist, idxtype *eptr, idxtype *eind, idxtype *elmwgt,
+ int *wgtflag, int *numflag, int *ncon, int *ncommonnodes, int *nparts,
+ float *tpwgts, float *ubvec, int *options, int *edgecut, idxtype *part,
+ MPI_Comm *comm)
+{
+ int i, nvtxs, nedges, gnedges, npes, mype;
+ idxtype *xadj, *adjncy;
+ timer TotalTmr, Mesh2DualTmr, ParMETISTmr;
+ CtrlType ctrl;
+
+ /********************************/
+ /* Try and take care bad inputs */
+ /********************************/
+ if (elmdist == NULL || eptr == NULL || eind == NULL || wgtflag == NULL ||
+ numflag == NULL || ncon == NULL || ncommonnodes == NULL || nparts == NULL ||
+ tpwgts == NULL || ubvec == NULL || options == NULL || edgecut == NULL ||
+ part == NULL || comm == NULL) {
+ printf("ERROR: One or more required parameters is NULL. Aborting.\n");
+ abort();
+ }
+ if (((*wgtflag)&2) && elmwgt == NULL) {
+ printf("ERROR: elmwgt == NULL when vertex weights were specified. Aborting.\n");
+ abort();
+ }
+
+
+ SetUpCtrl(&ctrl, *nparts, (options[0] == 1 ? options[PMV3_OPTION_DBGLVL] : 0), *comm);
+ npes = ctrl.npes;
+ mype = ctrl.mype;
+
+ cleartimer(TotalTmr);
+ cleartimer(Mesh2DualTmr);
+ cleartimer(ParMETISTmr);
+
+ MPI_Barrier(ctrl.comm);
+ starttimer(TotalTmr);
+ starttimer(Mesh2DualTmr);
+
+ ParMETIS_V3_Mesh2Dual(elmdist, eptr, eind, numflag, ncommonnodes, &xadj, &adjncy, &(ctrl.comm));
+
+ if (ctrl.dbglvl&DBG_INFO) {
+ nvtxs = elmdist[mype+1]-elmdist[mype];
+ nedges = xadj[nvtxs] + (*numflag == 0 ? 0 : -1);
+ rprintf(&ctrl, "Completed Dual Graph -- Nvtxs: %d, Nedges: %d \n",
+ elmdist[npes], GlobalSESum(&ctrl, nedges));
+ }
+
+ MPI_Barrier(ctrl.comm);
+ stoptimer(Mesh2DualTmr);
+
+
+ /***********************/
+ /* Partition the graph */
+ /***********************/
+ starttimer(ParMETISTmr);
+
+ ParMETIS_V3_PartKway(elmdist, xadj, adjncy, elmwgt, NULL, wgtflag, numflag, ncon,
+ nparts, tpwgts, ubvec, options, edgecut, part, &(ctrl.comm));
+
+ MPI_Barrier(ctrl.comm);
+ stoptimer(ParMETISTmr);
+ stoptimer(TotalTmr);
+
+ IFSET(ctrl.dbglvl, DBG_TIME, PrintTimer(&ctrl, Mesh2DualTmr, " Mesh2Dual"));
+ IFSET(ctrl.dbglvl, DBG_TIME, PrintTimer(&ctrl, ParMETISTmr, " ParMETIS"));
+ IFSET(ctrl.dbglvl, DBG_TIME, PrintTimer(&ctrl, TotalTmr, " Total"));
+
+ GKfree((void **)&xadj, (void **)&adjncy, LTERM);
+
+ FreeCtrl(&ctrl);
+
+ return;
+}