From 69f2911e04ffb1b19eef1fafb8c040af271f656e Mon Sep 17 00:00:00 2001 From: Tor Aamodt Date: Thu, 15 Jul 2010 18:09:46 -0800 Subject: creating branch for adding support for CUDA 3.x and Fermi [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6829] --- .../DG/3rdParty/ParMetis-3.1/ParMETISLib/selectq.c | 340 +++++++++++++++++++++ 1 file changed, 340 insertions(+) create mode 100644 benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/selectq.c (limited to 'benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/selectq.c') diff --git a/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/selectq.c b/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/selectq.c new file mode 100644 index 0000000..5ec9109 --- /dev/null +++ b/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/selectq.c @@ -0,0 +1,340 @@ +/* + * Copyright 1997, Regents of the University of Minnesota + * + * selectq.c + * + * This file contains the driving routines for multilevel k-way refinement + * + * Started 7/28/97 + * George + * + * $Id: selectq.c,v 1.2 2003/07/21 17:18:53 karypis Exp $ + */ + +#include + +/************************************************************************* +* This stuff is hardcoded for up to four constraints +**************************************************************************/ +void Moc_DynamicSelectQueue(int nqueues, int ncon, int subdomain1, int subdomain2, + idxtype *currentq, float *flows, int *from, int *qnum, int minval, float avgvwgt, + float maxdiff) +{ + int i, j; + int hash, index = -1, current; + int cand[MAXNCON], rank[MAXNCON], dont_cares[MAXNCON]; + int nperms, perm[24][5]; + float sign = 0.0; + KVType array[MAXNCON]; +int mype; +MPI_Comm_rank(MPI_COMM_WORLD, &mype); + + *qnum = -1; + + if (*from == -1) { + for (i=0; iavgvwgt*MOC_GD_GRANULARITY_FACTOR) { + *from = subdomain1; + sign = 1.0; + index = 0; + } + + if (flows[array[ncon-1].key]<-1.0*avgvwgt*MOC_GD_GRANULARITY_FACTOR) { + *from = subdomain2; + sign = -1.0; + index = nqueues; + } + + if (*from == -1) { + return; + } + } + else { + ASSERTS(*from == subdomain1 || *from == subdomain2); + + if (*from == subdomain1) { + sign = 1.0; + index = 0; + } + else { + sign = -1.0; + index = nqueues; + } + } + + for (i=0; i 0) { + *qnum = hash; + return; + } + } + + return; +} + + +/************************************************************************* +* This function sorts the nvwgts of a vertex and returns a hashed value +**************************************************************************/ +int Moc_HashVwgts(int ncon, float *nvwgt) +{ + int i; + int multiplier, retval; + int rank[MAXNCON]; + KVType array[MAXNCON]; + + + for (i=0; i