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/debug.c | 247 +++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/debug.c (limited to 'benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/debug.c') diff --git a/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/debug.c b/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/debug.c new file mode 100644 index 0000000..ebdf69c --- /dev/null +++ b/benchmarks/CUDA/DG/3rdParty/ParMetis-3.1/ParMETISLib/debug.c @@ -0,0 +1,247 @@ +/* + * Copyright 1997, Regents of the University of Minnesota + * + * debug.c + * + * This file contains various functions that are used to display debuging + * information + * + * Started 10/20/96 + * George + * + * $Id: debug.c,v 1.2 2003/07/21 17:18:48 karypis Exp $ + * + */ + +#include + + +/************************************************************************* +* This function prints a vector stored in each processor +**************************************************************************/ +void PrintVector(CtrlType *ctrl, int n, int first, idxtype *vec, char *title) +{ + int i, penum; + + for (penum=0; penumnpes; penum++) { + if (ctrl->mype == penum) { + if (ctrl->mype == 0) + printf("%s\n", title); + printf("\t%3d. ", ctrl->mype); + for (i=0; icomm); + } +} + + +/************************************************************************* +* This function prints a vector stored in each processor +**************************************************************************/ +void PrintVector2(CtrlType *ctrl, int n, int first, idxtype *vec, char *title) +{ + int i, penum; + + for (penum=0; penumnpes; penum++) { + if (ctrl->mype == penum) { + if (ctrl->mype == 0) + printf("%s\n", title); + printf("\t%3d. ", ctrl->mype); + for (i=0; i=KEEP_BIT ? 1 : 0), (vec[i]>=KEEP_BIT ? vec[i]-KEEP_BIT : vec[i])); + printf("\n"); + fflush(stdout); + } + MPI_Barrier(ctrl->comm); + } +} + + +/************************************************************************* +* This function prints a vector stored in each processor +**************************************************************************/ +void PrintPairs(CtrlType *ctrl, int n, KeyValueType *pairs, char *title) +{ + int i, penum; + + for (penum=0; penumnpes; penum++) { + if (ctrl->mype == penum) { + if (ctrl->mype == 0) + printf("%s\n", title); + printf("\t%3d. ", ctrl->mype); + for (i=0; icomm); + } +} + + + +/************************************************************************* +* This function prints the local portion of the graph stored at each +* processor +**************************************************************************/ +void PrintGraph(CtrlType *ctrl, GraphType *graph) +{ + int i, j, penum; + int firstvtx; + + MPI_Barrier(ctrl->comm); + + firstvtx = graph->vtxdist[ctrl->mype]; + + for (penum=0; penumnpes; penum++) { + if (ctrl->mype == penum) { + printf("\t%d", penum); + for (i=0; invtxs; i++) { + if (i==0) + printf("\t%2d %2d\t", firstvtx+i, graph->vwgt[i]); + else + printf("\t\t%2d %2d\t", firstvtx+i, graph->vwgt[i]); + for (j=graph->xadj[i]; jxadj[i+1]; j++) + printf("[%d %d] ", graph->adjncy[j], graph->adjwgt[j]); + printf("\n"); + } + fflush(stdout); + } + MPI_Barrier(ctrl->comm); + } +} + + +/************************************************************************* +* This function prints the local portion of the graph stored at each +* processor along with degree information during refinement +**************************************************************************/ +void PrintGraph2(CtrlType *ctrl, GraphType *graph) +{ + int i, j, penum; + int firstvtx; + + MPI_Barrier(ctrl->comm); + + firstvtx = graph->vtxdist[ctrl->mype]; + + for (penum=0; penumnpes; penum++) { + if (ctrl->mype == penum) { + printf("\t%d", penum); + for (i=0; invtxs; i++) { + if (i==0) + printf("\t%2d %2d [%d %d %d]\t", firstvtx+i, graph->vwgt[i], graph->where[i], graph->rinfo[i].id, graph->rinfo[i].ed); + else + printf("\t\t%2d %2d [%d %d %d]\t", firstvtx+i, graph->vwgt[i], graph->where[i], graph->rinfo[i].id, graph->rinfo[i].ed); + for (j=graph->xadj[i]; jxadj[i+1]; j++) + printf("[%d %d] ", graph->adjncy[j], graph->adjwgt[j]); + printf("\n"); + } + fflush(stdout); + } + MPI_Barrier(ctrl->comm); + } +} + + +/************************************************************************* +* This function prints the information computed during setup +**************************************************************************/ +void PrintSetUpInfo(CtrlType *ctrl, GraphType *graph) +{ + int i, j, penum; + + MPI_Barrier(ctrl->comm); + + for (penum=0; penumnpes; penum++) { + if (ctrl->mype == penum) { + printf("PE: %d, nnbrs: %d\n", ctrl->mype, graph->nnbrs); + printf("\tSending...\n"); + for (i=0; innbrs; i++) { + printf("\t\tTo: %d: ", graph->peind[i]); + for (j=graph->sendptr[i]; jsendptr[i+1]; j++) + printf("%d ", graph->sendind[j]); + printf("\n"); + } + printf("\tReceiving...\n"); + for (i=0; innbrs; i++) { + printf("\t\tFrom: %d: ", graph->peind[i]); + for (j=graph->recvptr[i]; jrecvptr[i+1]; j++) + printf("%d ", graph->recvind[j]); + printf("\n"); + } + printf("\n"); + } + MPI_Barrier(ctrl->comm); + } + +} + + +/************************************************************************* +* This function prints information about the graphs that were sent/received +**************************************************************************/ +void PrintTransferedGraphs(CtrlType *ctrl, int nnbrs, idxtype *peind, idxtype *slens, + idxtype *rlens, idxtype *sgraph, idxtype *rgraph) +{ + int i, ii, jj, ll, penum; + + MPI_Barrier(ctrl->comm); + for (penum=0; penumnpes; penum++) { + if (ctrl->mype == penum) { + printf("PE: %d, nnbrs: %d", ctrl->mype, nnbrs); + for (ll=i=0; i 0) { + printf("\n\tTo %d\t", peind[i]); + for (ii=slens[i]; ii 0) { + printf("\n\tFrom %d\t", peind[i]); + for (ii=rlens[i]; iicomm); + } + +} + + +/************************************************************************* +* This function writes a graph in the format used by serial METIS +**************************************************************************/ +void WriteMetisGraph(int nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt) +{ + int i, j; + FILE *fp; + + fp = fopen("test.graph", "w"); + + fprintf(fp, "%d %d 11", nvtxs, xadj[nvtxs]/2); + for (i=0; i