diff options
| author | Tor Aamodt <[email protected]> | 2010-07-15 18:09:46 -0800 |
|---|---|---|
| committer | Tor Aamodt <[email protected]> | 2010-07-15 18:09:46 -0800 |
| commit | 69f2911e04ffb1b19eef1fafb8c040af271f656e (patch) | |
| tree | 231d3b6bdc3a202f7c255bfcf7bf2c36e32cee9e /benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/METISLib/NEW_stats.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/METISLib/NEW_stats.c')
| -rw-r--r-- | benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/METISLib/NEW_stats.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/METISLib/NEW_stats.c b/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/METISLib/NEW_stats.c new file mode 100644 index 0000000..9e04b23 --- /dev/null +++ b/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/METISLib/NEW_stats.c @@ -0,0 +1,44 @@ +/* + * Copyright 1997, Regents of the University of Minnesota + * + * stat.c + * + * This file computes various statistics + * + * Started 7/25/97 + * George + * + * $Id: NEW_stats.c,v 1.1 2003/07/16 15:55:15 karypis Exp $ + * + */ + +#include <metis.h> + + +/************************************************************************* +* This function computes the balance of the partitioning +**************************************************************************/ +void Moc_ComputePartitionBalance(GraphType *graph, int nparts, idxtype *where, float *ubvec) +{ + int i, j, nvtxs, ncon; + float *kpwgts, *nvwgt; + float balance; + + nvtxs = graph->nvtxs; + ncon = graph->ncon; + nvwgt = graph->nvwgt; + + kpwgts = fmalloc(nparts, "ComputePartitionInfo: kpwgts"); + + for (j=0; j<ncon; j++) { + sset(nparts, 0.0, kpwgts); + for (i=0; i<graph->nvtxs; i++) + kpwgts[where[i]] += nvwgt[i*ncon+j]; + + ubvec[j] = (float)nparts*kpwgts[samax(nparts, kpwgts)]/ssum(nparts, kpwgts); + } + + free(kpwgts); + +} + |
