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] --- benchmarks/CUDA/DG/include/Mesh.h | 98 +++++++++ benchmarks/CUDA/DG/include/data3dN06.h | 349 ++++++++++++++++++++++++++++++ benchmarks/CUDA/DG/include/defs.h | 102 +++++++++ benchmarks/CUDA/DG/include/fem.h | 109 ++++++++++ benchmarks/CUDA/DG/include/macros.h | 163 ++++++++++++++ benchmarks/CUDA/DG/include/parmetis.h | 193 +++++++++++++++++ benchmarks/CUDA/DG/include/parmetisbin.h | 31 +++ benchmarks/CUDA/DG/include/proto.h | 352 +++++++++++++++++++++++++++++++ benchmarks/CUDA/DG/include/rename.h | 290 +++++++++++++++++++++++++ benchmarks/CUDA/DG/include/stdheaders.h | 25 +++ benchmarks/CUDA/DG/include/struct.h | 290 +++++++++++++++++++++++++ 11 files changed, 2002 insertions(+) create mode 100644 benchmarks/CUDA/DG/include/Mesh.h create mode 100644 benchmarks/CUDA/DG/include/data3dN06.h create mode 100644 benchmarks/CUDA/DG/include/defs.h create mode 100644 benchmarks/CUDA/DG/include/fem.h create mode 100644 benchmarks/CUDA/DG/include/macros.h create mode 100644 benchmarks/CUDA/DG/include/parmetis.h create mode 100644 benchmarks/CUDA/DG/include/parmetisbin.h create mode 100644 benchmarks/CUDA/DG/include/proto.h create mode 100644 benchmarks/CUDA/DG/include/rename.h create mode 100644 benchmarks/CUDA/DG/include/stdheaders.h create mode 100644 benchmarks/CUDA/DG/include/struct.h (limited to 'benchmarks/CUDA/DG/include') diff --git a/benchmarks/CUDA/DG/include/Mesh.h b/benchmarks/CUDA/DG/include/Mesh.h new file mode 100644 index 0000000..f14338a --- /dev/null +++ b/benchmarks/CUDA/DG/include/Mesh.h @@ -0,0 +1,98 @@ + +/* default order */ +#ifndef p_N +#define p_N 6 +#endif + +#define NODETOL 1e-4 +#ifdef NDG2d +#define p_Nfp (p_N+1) +#define p_Np ((p_N+1)*(p_N+2)/2) +#define p_Nfields 3 +#define p_Nfaces 3 +#endif + +#ifdef NDG3d +#define p_Nfp ((p_N+1)*(p_N+2)/2) +#define p_Np ((p_N+1)*(p_N+2)*(p_N+3)/6) +#define p_Nfields 6 +#define p_Nfaces 4 +#endif + +#define BSIZE (16*((p_Np+15)/16)) +//#define BSIZE p_Np + +#define max(a,b) ( (a>b)?a:b ) +#define min(a,b) ( (a +#include +#include +#include + +#include "Mesh.h" + +/* prototypes for storage functions (Utils.c) */ +double **BuildMatrix(int Nrows, int Ncols); +double *BuildVector(int Nrows); +int **BuildIntMatrix(int Nrows, int Ncols); +int *BuildIntVector(int Nrows); + +double **DestroyMatrix(double **); +double *DestroyVector(double *); +int **DestroyIntMatrix(int **); +int *DestroyIntVector(int *); + +void PrintMatrix(char *message, double **A, int Nrows, int Ncols); +void SaveMatrix(char *filename, double **A, int Nrows, int Ncols); + +/* geometric/mesh functions */ +Mesh *ReadMesh2d(char *filename); +Mesh *ReadMesh3d(char *filename); + +void PrintMesh ( Mesh *mesh ); + +void Normals2d(Mesh *mesh, int k, double *nx, double *ny, double *sJ); +void Normals3d(Mesh *mesh, int k, + double *nx, double *ny, double *nz, double *sJ); + +void GeometricFactors2d(Mesh *mesh, int k, + double *drdx, double *dsdx, double *drdy, double *dsdy, + double *J); + +void GeometricFactors3d(Mesh *mesh, int k, + double *drdx, double *dsdx, double *dtdx, + double *drdy, double *dsdy, double *dtdy, + double *drdz, double *dsdz, double *dtdz, + double *J); + +/* start up */ +void StartUp2d(Mesh *mesh); +void StartUp3d(Mesh *mesh); + +void BuildMaps2d(Mesh *mesh); +void BuildMaps3d(Mesh *mesh); + +/* Parallel */ +void LoadBalance2d(Mesh *mesh); +void LoadBalance3d(Mesh *mesh); + +void FacePair2d(Mesh *mesh, int *maxNv); +void FacePair3d(Mesh *mesh, int *maxNv); + +void ParallelPairs(void *objs, int Nmyobjs, int sizeobj, + int (*numget)(const void *), + void (*numset)(const void *, int ), + int (*procget)(const void *), + void (*marry)(const void *, const void *), + int (*compare_objs)(const void *, const void *)); + +void MaxwellsMPISend2d(Mesh *mesh); +void MaxwellsMPIRecv2d(Mesh *mesh, float *c_partQ); + +void MaxwellsMPISend3d(Mesh *mesh); +void MaxwellsMPIRecv3d(Mesh *mesh, float *c_partQ); + + +/* GPU functions */ +void gpu_set_data2d(int K, + double *d_Hx, double *d_Hy, double *d_Ez); +void gpu_set_data3d(int K, + double *d_Hx, double *d_Hy, double *d_Hz, + double *d_Ex, double *d_Ey, double *d_Ez); + +void gpu_get_data2d(int K, + double *d_Hx, double *d_Hy, double *d_Ez); +void gpu_get_data3d(int K, + double *d_Hx, double *d_Hy, double *d_Hz, + double *d_Ex, double *d_Ey, double *d_Ez); + +double InitGPU2d(Mesh *mesh, int Nfields); +double InitGPU3d(Mesh *mesh, int Nfields); + +/* CPU functions */ +void cpu_set_data2d(Mesh *mesh, double *Hx, double *Hy, double *Ez); +void cpu_set_data3d(Mesh *mesh, double *Hx, double *Hy, double *Hz, + double *Ex, double *Ey, double *Ez); + +double InitCPU2d(Mesh *mesh, int Nfields); +double InitCPU3d(Mesh *mesh, int Nfields); + +/* Maxwells functions */ +void MaxwellsKernel2d(Mesh *mesh, float frka, float frkb, float fdt); +void MaxwellsKernel3d(Mesh *mesh, float frka, float frkb, float fdt); + +void MaxwellsRHS2d(Mesh *mesh, float frka, float frkb, float fdt); +void MaxwellsRHS3d(Mesh *mesh, float frka, float frkb, float fdt); + +void MaxwellsRun2d(Mesh *mesh, double FinalTime, double dt); +void MaxwellsRun3d(Mesh *mesh, double FinalTime, double dt); + +/* CUDA headers */ +#ifdef CUDA +#include "cuda.h" +#include "cuda_runtime_api.h" +#endif + diff --git a/benchmarks/CUDA/DG/include/macros.h b/benchmarks/CUDA/DG/include/macros.h new file mode 100644 index 0000000..31861f7 --- /dev/null +++ b/benchmarks/CUDA/DG/include/macros.h @@ -0,0 +1,163 @@ +/* + * Copyright 1997, Regents of the University of Minnesota + * + * macros.h + * + * This file contains macros used in multilevel + * + * Started 9/25/94 + * George + * + * $Id: macros.h,v 1.8 2003/07/21 19:11:46 karypis Exp $ + * + */ + + +/************************************************************************* +* The following macro returns a random number in the specified range +**************************************************************************/ +#define RandomInRange(u) ((int)(1.0*(u)*rand()/(RAND_MAX+1.0))) + +#define amax(a, b) ((a) >= (b) ? (a) : (b)) +#define amin(a, b) ((a) >= (b) ? (b) : (a)) + +#define AND(a, b) ((a) < 0 ? ((-(a))&(b)) : ((a)&(b))) +#define OR(a, b) ((a) < 0 ? -((-(a))|(b)) : ((a)|(b))) +#define XOR(a, b) ((a) < 0 ? -((-(a))^(b)) : ((a)^(b))) + +#define SWAP(a, b, tmp) \ + do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0) + +#define INC_DEC(a, b, val) \ + do {(a) += (val); (b) -= (val);} while(0) + + +#define icopy(n, a, b) memcpy((b), (a), sizeof(int)*(n)) +#define scopy(n, a, b) memcpy((b), (a), sizeof(float)*(n)) +#define idxcopy(n, a, b) memcpy((b), (a), sizeof(idxtype)*(n)) + +#define HASHFCT(key, size) ((key)%(size)) + + +/************************************************************************* +* Timer macros +**************************************************************************/ +#define cleartimer(tmr) (tmr = 0.0) +#define starttimer(tmr) (tmr -= MPI_Wtime()) +#define stoptimer(tmr) (tmr += MPI_Wtime()) +#define gettimer(tmr) (tmr) + + +/************************************************************************* +* This macro is used to handle dbglvl +**************************************************************************/ +#define IFSET(a, flag, cmd) if ((a)&(flag)) (cmd); + +/************************************************************************* +* These macros are used for debuging memory leaks +**************************************************************************/ +#ifdef DMALLOC +#define imalloc(n, msg) (malloc(sizeof(int)*(n))) +#define fmalloc(n, msg) (malloc(sizeof(float)*(n))) +#define idxmalloc(n, msg) (malloc(sizeof(idxtype)*(n))) +#define ismalloc(n, val, msg) (iset((n), (val), malloc(sizeof(int)*(n)))) +#define idxsmalloc(n, val, msg) (idxset((n), (val), malloc(sizeof(idxtype)*(n)))) +#define GKmalloc(a, b) (malloc(a)) +#endif + +#ifdef DMALLOC +# define MALLOC_CHECK(ptr); +/* +# define MALLOC_CHECK(ptr) \ + if (malloc_verify((ptr)) == DMALLOC_VERIFY_ERROR) { \ + printf("***MALLOC_CHECK failed on line %d of file %s: " #ptr "\n", \ + __LINE__, __FILE__); \ + abort(); \ + } +*/ +#else +# define MALLOC_CHECK(ptr) ; +#endif + +/************************************************************************* +* This macro converts a length array in a CSR one +**************************************************************************/ +#define MAKECSR(i, n, a) \ + do { \ + for (i=1; i0; i--) a[i] = a[i-1]; \ + a[0] = 0; \ + } while(0) + + +#define SHIFTCSR(i, n, a) \ + do { \ + for (i=n; i>0; i--) a[i] = a[i-1]; \ + a[0] = 0; \ + } while(0) + + + +#ifdef DEBUG +# define ASSERT(ctrl, expr) \ + if (!(expr)) { \ + myprintf(ctrl, "***ASSERTION failed on line %d of file %s: " #expr "\n", \ + __LINE__, __FILE__); \ + abort(); \ + } +#else +# define ASSERT(ctrl, expr) ; +#endif + +#ifdef DEBUG +# define ASSERTP(ctrl, expr, msg) \ + if (!(expr)) { \ + myprintf(ctrl, "***ASSERTION failed on line %d of file %s:" #expr "\n", \ + __LINE__, __FILE__); \ + myprintf msg ; \ + abort(); \ + } +#else +# define ASSERTP(ctrl, expr,msg) ; +#endif + +#ifdef DEBUGS +# define ASSERTS(expr) \ + if (!(expr)) { \ + printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \ + __LINE__, __FILE__); \ + abort(); \ + } +#else +# define ASSERTS(expr) ; +#endif + +#ifdef DEBUGS +# define ASSERTSP(expr, msg) \ + if (!(expr)) { \ + printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \ + __LINE__, __FILE__); \ + printf msg ; \ + abort(); \ + } +#else +# define ASSERTSP(expr, msg) ; +#endif + +/************************************************************************* + * * These macros insert and remove nodes from the boundary list + * **************************************************************************/ +#define BNDInsert(nbnd, bndind, bndptr, vtx) \ + do { \ + bndind[nbnd] = vtx; \ + bndptr[vtx] = nbnd++;\ + } while(0) + +#define BNDDelete(nbnd, bndind, bndptr, vtx) \ + do { \ + bndind[bndptr[vtx]] = bndind[--nbnd]; \ + bndptr[bndind[nbnd]] = bndptr[vtx]; \ + bndptr[vtx] = -1; \ + } while(0) + + diff --git a/benchmarks/CUDA/DG/include/parmetis.h b/benchmarks/CUDA/DG/include/parmetis.h new file mode 100644 index 0000000..64a90ea --- /dev/null +++ b/benchmarks/CUDA/DG/include/parmetis.h @@ -0,0 +1,193 @@ +/* + * Copyright 1997-2003, Regents of the University of Minnesota + * + * parmetis.h + * + * This file contains function prototypes and constrant definitions for + * ParMETIS + * + * Started 7/21/03 + * George + * + */ + +#ifndef __parmetis_h__ +#define __parmetis_h__ + +#include + +#ifndef _MSC_VER +#define __cdecl +#endif + + +/************************************************************************* +* Data-structures +**************************************************************************/ +/* Undefine the following #define in order to use short int as the idxtype */ +#define IDXTYPE_INT + +/* Indexes are as long as integers for now */ +#ifdef IDXTYPE_INT +typedef int idxtype; +#else +typedef short idxtype; +#endif + + +/************************************************************************* +* Constants +**************************************************************************/ +#define PARMETIS_MAJOR_VERSION 3 +#define PARMETIS_MINOR_VERSION 1 + + +/************************************************************************* +* Function prototypes +**************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/*------------------------------------------------------------------- +* API Introduced with Release 3.0 (current API) +*--------------------------------------------------------------------*/ +void __cdecl ParMETIS_V3_AdaptiveRepart( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *vsize, idxtype *adjwgt, int *wgtflag, int *numflag, int *ncon, + int *nparts, float *tpwgts, float *ubvec, float *ipc2redist, + int *options, int *edgecut, idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_V3_PartGeomKway( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *ndims, float *xyz, + int *ncon, int *nparts, float *tpwgts, float *ubvec, int *options, + int *edgecut, idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_V3_PartGeom( + idxtype *vtxdist, int *ndims, float *xyz, idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_V3_PartKway( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *ncon, int *nparts, + float *tpwgts, float *ubvec, int *options, int *edgecut, idxtype *part, + MPI_Comm *comm); + +void __cdecl ParMETIS_V3_Mesh2Dual( + idxtype *elmdist, idxtype *eptr, idxtype *eind, int *numflag, + int *ncommonnodes, idxtype **xadj, idxtype **adjncy, MPI_Comm *comm); + +void __cdecl 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); + +void __cdecl ParMETIS_V3_NodeND( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, int *numflag, + int *options, idxtype *order, idxtype *sizes, MPI_Comm *comm); + +void __cdecl ParMETIS_V3_RefineKway( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *ncon, int *nparts, + float *tpwgts, float *ubvec, int *options, int *edgecut, + idxtype *part, MPI_Comm *comm); + + + +/*------------------------------------------------------------------ +* Backward compatibility routines with Release 2.0 +*-------------------------------------------------------------------*/ +void __cdecl ParMETIS_PartKway( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, int *options, + int *edgecut, idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_PartGeomKway( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, + int *wgtflag, int *numflag, int *ndims, float *xyz, int *nparts, int *options, + int *edgecut, idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_PartGeom( + idxtype *vtxdist, int *ndims, float *xyz, idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_PartGeomRefine( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *ndims, float *xyz, + int *options, int *edgecut, idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_RefineKway( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *options, int *edgecut, + idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_RepartLDiffusion( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *options, int *edgecut, + idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_RepartGDiffusion( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *options, int *edgecut, + idxtype *part, MPI_Comm *comm); + +void __cdecl ParMETIS_RepartRemap( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, + int *wgtflag, int *numflag, int *options, int *edgecut, idxtype *part, + MPI_Comm *comm); + +void __cdecl ParMETIS_RepartMLRemap( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, idxtype *adjwgt, + int *wgtflag, int *numflag, int *options, int *edgecut, idxtype *part, + MPI_Comm *comm); + +void __cdecl ParMETIS_NodeND( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, int *numflag, int *options, + idxtype *order, idxtype *sizes, MPI_Comm *comm); + +void __cdecl ParMETIS_SerialNodeND( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, int *numflag, int *options, + idxtype *order, idxtype *sizes, MPI_Comm *comm); + + + + +/*------------------------------------------------------------------- +* Backward compatibility routines with Release 1.0 +*--------------------------------------------------------------------*/ +void __cdecl PARKMETIS( + idxtype *vtxdist, idxtype *xadj, idxtype *vwgt, idxtype *adjncy, idxtype *adjwgt, + idxtype *part, int *options, MPI_Comm comm); + +void __cdecl PARGKMETIS( + idxtype *vtxdist, idxtype *xadj, idxtype *vwgt, idxtype *adjncy, idxtype *adjwgt, + int ndims, float *xyz, idxtype *part, int *options, MPI_Comm comm); + +void __cdecl PARGRMETIS( + idxtype *vtxdist, idxtype *xadj, idxtype *vwgt, idxtype *adjncy, idxtype *adjwgt, + int ndims, float *xyz, idxtype *part, int *options, MPI_Comm comm); + +void __cdecl PARGMETIS( + idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, int ndims, float *xyz, + idxtype *part, int *options, MPI_Comm comm); + +void __cdecl PARRMETIS( + idxtype *vtxdist, idxtype *xadj, idxtype *vwgt, idxtype *adjncy, + idxtype *adjwgt, idxtype *part, int *options, MPI_Comm comm); + +void __cdecl PARUAMETIS( + idxtype *vtxdist, idxtype *xadj, idxtype *vwgt, idxtype *adjncy, + idxtype *adjwgt, idxtype *part, int *options, MPI_Comm comm); + +void __cdecl PARDAMETIS( + idxtype *vtxdist, idxtype *xadj, idxtype *vwgt, idxtype *adjncy, idxtype *adjwgt, + idxtype *part, int *options, MPI_Comm comm); + +#ifdef __cplusplus +} +#endif + + + + +#endif diff --git a/benchmarks/CUDA/DG/include/parmetisbin.h b/benchmarks/CUDA/DG/include/parmetisbin.h new file mode 100644 index 0000000..f0e9047 --- /dev/null +++ b/benchmarks/CUDA/DG/include/parmetisbin.h @@ -0,0 +1,31 @@ +/* + * Copyright 1997, Regents of the University of Minnesota + * + * par_metis.h + * + * This file includes all necessary header files + * + * Started 8/27/94 + * George + * + * $Id: parmetisbin.h,v 1.1 2003/07/21 17:50:23 karypis Exp $ + */ + +/* +#define DEBUG 1 +#define DMALLOC 1 +*/ + +#include +#include "parmetis.h" + +#ifdef DMALLOC +#include +#endif + +#include +#include +#include +#include +#include + diff --git a/benchmarks/CUDA/DG/include/proto.h b/benchmarks/CUDA/DG/include/proto.h new file mode 100644 index 0000000..bbab2e5 --- /dev/null +++ b/benchmarks/CUDA/DG/include/proto.h @@ -0,0 +1,352 @@ +/* + * Copyright 1997, Regents of the University of Minnesota + * + * proto.h + * + * This file contains header files + * + * Started 10/19/95 + * George + * + * $Id: proto.h,v 1.11 2003/07/25 13:52:03 karypis Exp $ + * + */ + +/* kmetis.c */ +void Moc_Global_Partition(CtrlType *, GraphType *, WorkSpaceType *); + +/* mmetis.c */ + +/* gkmetis.c */ + +/* match.c */ +void Moc_GlobalMatch_Balance(CtrlType *, GraphType *, WorkSpaceType *); + +/* coarsen.c */ +void Moc_Global_CreateCoarseGraph(CtrlType *, GraphType *, WorkSpaceType *, int); + +/* initpart.c */ +void Moc_InitPartition_RB(CtrlType *, GraphType *, WorkSpaceType *); +void Moc_KeepPart(GraphType *, WorkSpaceType *, idxtype *, int); + +/* kwayrefine.c */ +void Moc_ProjectPartition(CtrlType *, GraphType *, WorkSpaceType *); +void Moc_ComputePartitionParams(CtrlType *, GraphType *, WorkSpaceType *); + +/* kwayfm.c */ +void Moc_KWayFM(CtrlType *, GraphType *, WorkSpaceType *, int); + +/* kwaybalance.c */ +void Moc_KWayBalance(CtrlType *, GraphType *, WorkSpaceType *, int); + +/* remap.c */ +void ParallelReMapGraph(CtrlType *, GraphType *, WorkSpaceType *); +void ParallelTotalVReMap(CtrlType *, idxtype *, idxtype *, WorkSpaceType *, int, int); +int SimilarTpwgts(float *, int, int, int); + +/* move.c */ +GraphType *Moc_MoveGraph(CtrlType *, GraphType *, WorkSpaceType *); +/* move.c */ +void CheckMGraph(CtrlType *, GraphType *); +void ProjectInfoBack(CtrlType *, GraphType *, idxtype *, idxtype *, WorkSpaceType *); +void FindVtxPerm(CtrlType *, GraphType *, idxtype *, WorkSpaceType *); + +/* memory.c */ +void PreAllocateMemory(CtrlType *, GraphType *, WorkSpaceType *); +void FreeWSpace(WorkSpaceType *); +void FreeCtrl(CtrlType *); +GraphType *CreateGraph(void); +void InitGraph(GraphType *); +void FreeGraph(GraphType *); +void FreeInitialGraphAndRemap(GraphType *, int); + + +/* ametis.c */ +void Adaptive_Partition(CtrlType *, GraphType *, WorkSpaceType *); + +/* rmetis.c */ + + +/* lmatch.c */ +void Mc_LocalMatch_HEM(CtrlType *, GraphType *, WorkSpaceType *); +void Mc_Local_CreateCoarseGraph(CtrlType *, GraphType *, WorkSpaceType *, int); + +/* wave.c */ +float WavefrontDiffusion(CtrlType *, GraphType *, idxtype *); + +/* balancemylink.c */ +int BalanceMyLink(CtrlType *, GraphType *, idxtype *, int, int, float *, float, float *, float *, float); + +/* redomylink.c */ +void RedoMyLink(CtrlType *, GraphType *, idxtype *, int, int, float *, float *, float *); + +/* initbalance.c */ +void Balance_Partition(CtrlType *, GraphType *, WorkSpaceType *); +GraphType *Moc_AssembleAdaptiveGraph(CtrlType *, GraphType *, WorkSpaceType *); + +/* mdiffusion.c */ +int Moc_Diffusion(CtrlType *, GraphType *, idxtype *, idxtype *, idxtype *, WorkSpaceType *, int); +GraphType *ExtractGraph(CtrlType *, GraphType *, idxtype *, idxtype *, idxtype *); + +/* diffutil.c */ +void SetUpConnectGraph(GraphType *, MatrixType *, idxtype *); +void Mc_ComputeMoveStatistics(CtrlType *, GraphType *, int *, int *, int *); + int Mc_ComputeSerialTotalV(GraphType *, idxtype *); +void ComputeLoad(GraphType *, int, float *, float *, int); +void ConjGrad2(MatrixType *, float *, float *, float, float *); +void mvMult2(MatrixType *, float *, float *); +void ComputeTransferVector(int, MatrixType *, float *, float *, int); +int ComputeSerialEdgeCut(GraphType *); +int ComputeSerialTotalV(GraphType *, idxtype *); + +/* akwayfm.c */ +void Moc_KWayAdaptiveRefine(CtrlType *, GraphType *, WorkSpaceType *, int); + +/* selectq.c */ +void Moc_DynamicSelectQueue(int, int, int, int, idxtype *, float *, int *, int *, int, float, float); +int Moc_HashVwgts(int, float *); +int Moc_HashVRank(int, int *); + + +/* csrmatch.c */ +void CSR_Match_SHEM(MatrixType *, idxtype *, idxtype *, idxtype *, int); + +/* serial.c */ +void Moc_SerialKWayAdaptRefine(GraphType *, int, idxtype *, float *, int); +void Moc_ComputeSerialPartitionParams(GraphType *, int, EdgeType *); +int AreAllHVwgtsBelow(int, float, float *, float, float *, float *); +void ComputeHKWayLoadImbalance(int, int, float *, float *); +void SerialRemap(GraphType *, int, idxtype *, idxtype *, idxtype *, float *); +int SSMIncKeyCmp(const void *, const void *); +void Moc_Serial_FM_2WayRefine(GraphType *, float *, int); +void Serial_SelectQueue(int, float *, float *, int *, int *, FPQueueType [MAXNCON][2]); +int Serial_BetterBalance(int, float *, float *, float *); +float Serial_Compute2WayHLoadImbalance(int, float *, float *); +void Moc_Serial_Balance2Way(GraphType *, float *, float); +void Moc_Serial_Init2WayBalance(GraphType *, float *); +int Serial_SelectQueueOneWay(int, float *, float *, int, FPQueueType [MAXNCON][2]); +void Moc_Serial_Compute2WayPartitionParams(GraphType *); +int Serial_AreAnyVwgtsBelow(int, float, float *, float, float *, float *); + +/* weird.c */ +void PartitionSmallGraph(CtrlType *, GraphType *, WorkSpaceType *); +void CheckInputs(int partType, int npes, int dbglvl, int *wgtflag, int *iwgtflag, + int *numflag, int *inumflag, int *ncon, int *incon, int *nparts, + int *inparts, float *tpwgts, float **itpwgts, float *ubvec, + float *iubvec, float *ipc2redist, float *iipc2redist, int *options, + int *ioptions, idxtype *part, MPI_Comm *comm); + +/* mesh.c */ + +/* ometis.c */ + +/* pspases.c */ +GraphType *AssembleEntireGraph(CtrlType *, idxtype *, idxtype *, idxtype *); + +/* node_refine.c */ +void ComputeNodePartitionParams0(CtrlType *, GraphType *, WorkSpaceType *); +void ComputeNodePartitionParams(CtrlType *, GraphType *, WorkSpaceType *); +void KWayNodeRefine0(CtrlType *, GraphType *, WorkSpaceType *, int, float); +void KWayNodeRefine(CtrlType *, GraphType *, WorkSpaceType *, int, float); +void KWayNodeRefine2(CtrlType *, GraphType *, WorkSpaceType *, int, float); +void PrintNodeBalanceInfo(CtrlType *, int, idxtype *, idxtype *, idxtype *, int); + +/* initmsection.c */ +void InitMultisection(CtrlType *, GraphType *, WorkSpaceType *); +GraphType *AssembleMultisectedGraph(CtrlType *, GraphType *, WorkSpaceType *); + +/* order.c */ +void MultilevelOrder(CtrlType *, GraphType *, idxtype *, idxtype *, WorkSpaceType *); +void LabelSeparators(CtrlType *, GraphType *, idxtype *, idxtype *, idxtype *, idxtype *, WorkSpaceType *); +void CompactGraph(CtrlType *, GraphType *, idxtype *, WorkSpaceType *); +void LocalOrder(CtrlType *, GraphType *, idxtype *, int, WorkSpaceType *); +void LocalNDOrder(CtrlType *, GraphType *, idxtype *, int, WorkSpaceType *); +void Order_Partition(CtrlType *, GraphType *, WorkSpaceType *); + +/* xyzpart.c */ +void Coordinate_Partition(CtrlType *, GraphType *, int, float *, int, WorkSpaceType *); +void PartSort(CtrlType *, GraphType *, KeyValueType *, WorkSpaceType *); + + +/* fpqueue.c */ +void FPQueueInit(FPQueueType *, int); +void FPQueueReset(FPQueueType *); +void FPQueueFree(FPQueueType *); +int FPQueueGetSize(FPQueueType *); +int FPQueueInsert(FPQueueType *, int, float); +int FPQueueDelete(FPQueueType *, int); +int FPQueueUpdate(FPQueueType *, int, float, float); +void FPQueueUpdateUp(FPQueueType *, int, float, float); +int FPQueueGetMax(FPQueueType *); +int FPQueueSeeMaxVtx(FPQueueType *); +float FPQueueSeeMaxGain(FPQueueType *); +float FPQueueGetKey(FPQueueType *); +int FPQueueGetQSize(FPQueueType *); +int CheckHeapFloat(FPQueueType *); + +/* stat.c */ +void Moc_ComputeSerialBalance(CtrlType *, GraphType *, idxtype *, float *); +void Moc_ComputeParallelBalance(CtrlType *, GraphType *, idxtype *, float *); +void Moc_PrintThrottleMatrix(CtrlType *, GraphType *, float *); +void Moc_ComputeRefineStats(CtrlType *, GraphType *, float *); + +/* debug.c */ +void PrintVector(CtrlType *, int, int, idxtype *, char *); +void PrintVector2(CtrlType *, int, int, idxtype *, char *); +void PrintPairs(CtrlType *, int, KeyValueType *, char *); +void PrintGraph(CtrlType *, GraphType *); +void PrintGraph2(CtrlType *, GraphType *); +void PrintSetUpInfo(CtrlType *ctrl, GraphType *graph); +void PrintTransferedGraphs(CtrlType *, int, idxtype *, idxtype *, idxtype *, idxtype *, idxtype *); +void WriteMetisGraph(int, idxtype *, idxtype *, idxtype *, idxtype *); + +/* comm.c */ +void CommInterfaceData(CtrlType *, GraphType *, idxtype *, idxtype *, idxtype *); +void CommChangedInterfaceData(CtrlType *, GraphType *, int, idxtype *, idxtype *, KeyValueType *, KeyValueType *, idxtype *); +int GlobalSEMax(CtrlType *, int); +double GlobalSEMaxDouble(CtrlType *, double); +int GlobalSEMin(CtrlType *, int); +int GlobalSESum(CtrlType *, int); +float GlobalSEMaxFloat(CtrlType *, float); +float GlobalSEMinFloat(CtrlType *, float); +float GlobalSESumFloat(CtrlType *, float); + +/* util.c */ +void errexit(char *,...); +void myprintf(CtrlType *, char *f_str,...); +void rprintf(CtrlType *, char *f_str,...); +#ifndef DMALLOC +int *imalloc(int, char *); +idxtype *idxmalloc(int, char *); +float *fmalloc(int, char *); +int *ismalloc(int, int, char *); +idxtype *idxsmalloc(int, idxtype, char *); +void *GKmalloc(int, char *); +#endif +/*void GKfree(void **,...); */ +int *iset(int n, int val, int *x); +idxtype * idxset(int n, idxtype val, idxtype *x); +int idxamax(int n, idxtype *x); +int idxamin(int n, idxtype *x); +int idxasum(int n, idxtype *x); +float snorm2(int, float *); +float sdot(int n, float *, float *); +void saxpy(int, float, float *, float *); +void ikeyvalsort_org(int, KeyValueType *); +int IncKeyValueCmp(const void *, const void *); +void dkeyvalsort(int, KeyValueType *); +int DecKeyValueCmp(const void *, const void *); +int BSearch(int, idxtype *, int); +void RandomPermute(int, idxtype *, int); +void FastRandomPermute(int, idxtype *, int); +int ispow2(int); +int log2Int(int); +void BucketSortKeysDec(int, int, idxtype *, idxtype *); +float *sset(int n, float val, float *x); +int iamax(int, int *); +int idxamax_strd(int, idxtype *, int); +int idxamin_strd(int, idxtype *, int); +int samax_strd(int, float *, int); +int sfamax(int, float *); +int samin_strd(int, float *, int); +float idxavg(int, idxtype *); +float savg(int, float *); +int samax(int, float *); +int sfavg(int n, float *x); +int samax2(int, float *); +int samin(int, float *); +int idxsum(int, idxtype *); +int idxsum_strd(int, idxtype *, int); +void idxadd(int, idxtype *, idxtype *); +float ssum(int, float *); +float ssum_strd(int, float *, int); +void sscale(int, float, float *); +void saneg(int, float *); +float BetterVBalance(int, float *, float *, float *); +int IsHBalanceBetterTT(int, float *, float *, float *, float *); +int IsHBalanceBetterFT(int, float *, float *, float *, float *); +int myvalkeycompare(const void *, const void *); +int imyvalkeycompare(const void *, const void *); +float *fsmalloc(int, float, char *); +void saxpy2(int, float, float *, int, float *, int); +void GetThreeMax(int, float *, int *, int *, int *); + +/* qsort_special.c */ +void iidxsort(int, idxtype *); +void iintsort(int, int *); +void ikeysort(int, KeyValueType *); +void ikeyvalsort(int, KeyValueType *); + +/* grsetup.c */ +GraphType *Moc_SetUpGraph(CtrlType *, int, idxtype *, idxtype *, idxtype *, idxtype *, idxtype *, int *); +void SetUpCtrl(CtrlType *ctrl, int, int, MPI_Comm); +void ChangeNumbering(idxtype *, idxtype *, idxtype *, idxtype *, int, int, int); +void ChangeNumberingMesh(idxtype *, idxtype *, idxtype *, idxtype *, idxtype *, int, int, int, int); +void ChangeNumberingMesh2(idxtype *elmdist, idxtype *eptr, idxtype *eind, + idxtype *xadj, idxtype *adjncy, idxtype *part, + int npes, int mype, int from); +void GraphRandomPermute(GraphType *); +void ComputeMoveStatistics(CtrlType *, GraphType *, int *, int *, int *); + +/* timer.c */ +void InitTimers(CtrlType *); +void PrintTimingInfo(CtrlType *); +void PrintTimer(CtrlType *, timer, char *); + +/* setup.c */ +void SetUp(CtrlType *, GraphType *, WorkSpaceType *); +int Home_PE(int, int, idxtype *, int); + + +/*********************/ +/* METIS subroutines */ +/*********************/ +void METIS_WPartGraphKway2(int *, idxtype *, idxtype *, idxtype *, idxtype *, int *, int *, int *, float *, int *, int *, idxtype *); +void METIS_mCPartGraphRecursive2(int *, int *, idxtype *, idxtype *, idxtype *, idxtype *, int *, int *, int *, float *, int *, int *, idxtype *); +int MCMlevelRecursiveBisection2(CtrlType *, GraphType *, int, float *, idxtype *, float, int); +void METIS_PartGraphKway(int *, idxtype *, idxtype *, idxtype *, idxtype *, int *, int *, int *, int *, int *, idxtype *); +void METIS_mCPartGraphKway(int *, int *, idxtype *, idxtype *, idxtype *, idxtype *, int *, int *, int *, float *, int *, int *, idxtype *); +void METIS_EdgeComputeSeparator(int *, idxtype *, idxtype *, idxtype *, idxtype *, int *, int *, idxtype *); +void METIS_NodeComputeSeparator(int *, idxtype *, idxtype *, idxtype *, idxtype *, int *, int *, idxtype *); +void METIS_NodeND(int *, idxtype *, idxtype *, int *, int *, idxtype *, idxtype *); +void METIS_NodeNDP(int, idxtype *, idxtype *, int, int *, idxtype *, idxtype *, idxtype *); + + + +/***********************/ +/* TESTing subroutines */ +/***********************/ + +/* pio.c */ +void ParallelReadGraph(GraphType *, char *, MPI_Comm); +void Moc_ParallelWriteGraph(CtrlType *, GraphType *, char *, int, int); +void ReadTestGraph(GraphType *, char *, MPI_Comm); +float *ReadTestCoordinates(GraphType *, char *, int, MPI_Comm); +void ReadMetisGraph(char *, int *, idxtype **, idxtype **); +void Moc_SerialReadGraph(GraphType *, char *, int *, MPI_Comm); +void Moc_SerialReadMetisGraph(char *, int *, int *, int *, int *, idxtype **, idxtype **, idxtype **, idxtype **, int *); + +/* adaptgraph */ +void AdaptGraph(GraphType *, int, MPI_Comm); +void AdaptGraph2(GraphType *, int, MPI_Comm); +void Mc_AdaptGraph(GraphType *, idxtype *, int, int, MPI_Comm); + +/* ptest.c */ +void TestParMetis(char *, MPI_Comm); + +/* NEW_ptest.c */ +void TestParMetis_V3(char *, MPI_Comm); +int ComputeRealCut(idxtype *, idxtype *, char *, MPI_Comm); +int ComputeRealCut2(idxtype *, idxtype *, idxtype *, idxtype *, char *, MPI_Comm); +void TestMoveGraph(GraphType *, GraphType *, idxtype *, MPI_Comm); +GraphType *SetUpGraph(CtrlType *, idxtype *, idxtype *, idxtype *, idxtype *, idxtype *, int); + +/* mienio.c */ +void mienIO(MeshType *, char *, int, int, MPI_Comm); + +/* meshio.c */ +void ParallelReadMesh(MeshType *, char *, MPI_Comm); + +/* parmetis.c */ +void ChangeToFortranNumbering(idxtype *, idxtype *, idxtype *, int, int); + diff --git a/benchmarks/CUDA/DG/include/rename.h b/benchmarks/CUDA/DG/include/rename.h new file mode 100644 index 0000000..d993257 --- /dev/null +++ b/benchmarks/CUDA/DG/include/rename.h @@ -0,0 +1,290 @@ +/* kmetis.c */ +#define Moc_Global_Partition Moc_Global_Partition__ + +/* mmetis.c */ + +/* gkmetis.c */ + +/* match.c */ +#define Moc_GlobalMatch_Balance Moc_GlobalMatch_Balance__ + +/* coarsen.c */ +#define Moc_Global_CreateCoarseGraph Moc_Global_CreateCoarseGraph__ + +/* initpart.c */ +#define Moc_InitPartition_RB Moc_InitPartition_RB__ +#define Moc_KeepPart Moc_KeepPart__ + +/* kwayrefine.c */ +#define Moc_ProjectPartition Moc_ProjectPartition__ +#define Moc_ComputePartitionParams Moc_ComputePartitionParams__ + +/* kwayfm.c */ +#define Moc_KWayFM Moc_KWayFM__ + +/* kwaybalance.c */ +#define Moc_KWayBalance Moc_KWayBalance__ + +/* remap.c */ +#define ParallelReMapGraph ParallelReMapGraph__ +#define ParallelTotalVReMap ParallelTotalVReMap__ +#define SimilarTpwgts SimilarTpwgts__ + +/* move.c */ +#define Moc_MoveGraph Moc_MoveGraph__ +#define CheckMGraph CheckMGraph__ +#define ProjectInfoBack ProjectInfoBack__ +#define FindVtxPerm FindVtxPerm__ + +/* memory.c */ +#define PreAllocateMemory PreAllocateMemory__ +#define FreeWSpace FreeWSpace__ +#define FreeCtrl FreeCtrl__ +#define CreateGraph CreateGraph__ +#define InitGraph InitGraph__ +#define FreeGraph FreeGraph__ +#define FreeInitialGraphAndRemap FreeInitialGraphAndRemap__ + + +/************************/ +/* Adaptive subroutines */ +/************************/ +/* ametis.c */ +#define Adaptive_Partition Adaptive_Partition__ + +/* rmetis.c */ + +/* lmatch.c */ +#define Mc_LocalMatch_HEM Mc_LocalMatch_HEM__ +#define Mc_Local_CreateCoarseGraph Mc_Local_CreateCoarseGraph__ + +/* wave.c */ +#define WavefrontDiffusion WavefrontDiffusion__ + +/* balancemylink.c */ +#define BalanceMyLink BalanceMyLink__ + +/* redomylink.c */ +#define RedoMyLink RedoMyLink__ + +/* initbalance.c */ +#define Balance_Partition Balance_Partition__ +#define Moc_AssembleAdaptiveGraph Moc_AssembleAdaptiveGraph__ + +/* mdiffusion.c */ +#define Moc_Diffusion Moc_Diffusion__ +#define ExtractGraph ExtractGraph__ + +/* diffutil.c */ +#define SetUpConnectGraph SetUpConnectGraph__ +#define Mc_ComputeMoveStatistics Mc_ComputeMoveStatistics__ +#define Mc_ComputeSerialTotalV Mc_ComputeSerialTotalV__ +#define ComputeLoad ComputeLoad__ +#define ConjGrad2 ConjGrad2__ +#define mvMult2 mvMult2__ +#define ComputeTransferVector ComputeTransferVector__ +#define ComputeSerialEdgeCut ComputeSerialEdgeCut__ +#define ComputeSerialTotalV ComputeSerialTotalV__ + +/* akwayfm.c */ +#define Moc_KWayAdaptiveRefine Moc_KWayAdaptiveRefine__ + +/* selectq.c */ +#define Moc_DynamicSelectQueue Moc_DynamicSelectQueue__ +#define Moc_HashVwgts Moc_HashVwgts__ +#define Moc_HashVRank Moc_HashVRank__ + +/* csrmatch.c */ +#define CSR_Match_SHEM CSR_Match_SHEM__ + +/* serial.c */ +#define Moc_SerialKWayAdaptRefine Moc_SerialKWayAdaptRefine__ +#define Moc_ComputeSerialPartitionParams Moc_ComputeSerialPartitionParams__ +#define AreAllHVwgtsBelow AreAllHVwgtsBelow__ +#define ComputeHKWayLoadImbalance ComputeHKWayLoadImbalance__ +#define SerialRemap SerialRemap__ +#define SSMIncKeyCmp SSMIncKeyCmp__ +#define Moc_Serial_FM_2WayRefine Moc_Serial_FM_2WayRefine__ +#define Serial_SelectQueue Serial_SelectQueue__ +#define Serial_BetterBalance Serial_BetterBalance__ +#define Serial_Compute2WayHLoadImbalance Serial_Compute2WayHLoadImbalance__ +#define Moc_Serial_Balance2Way Moc_Serial_Balance2Way__ +#define Moc_Serial_Init2WayBalance Moc_Serial_Init2WayBalance__ +#define Serial_SelectQueueOneWay Serial_SelectQueueOneWay__ +#define Moc_Serial_Compute2WayPartitionParams Moc_Serial_Compute2WayPartitionParams__ +#define Serial_AreAnyVwgtsBelow Serial_AreAnyVwgtsBelow__ + +/* weird.c */ +#define PartitionSmallGraph PartitionSmallGraph__ +#define CheckInputs CheckInputs__ + + +/****************************/ +/* Mesh to Dual subroutines */ +/****************************/ +/* mesh.c */ +/* msetup.c */ +#define SetUpMesh SetUpMesh__ +#define CreateMesh CreateMesh__ +#define InitMesh InitMesh__ + + +/************************/ +/* Ordering subroutines */ +/************************/ +/* ometis.c */ +/* pspases.c */ +#define AssembleEntireGraph AssembleEntireGraph__ + +/* node_refine.c */ +#define ComputeNodePartitionParams0 ComputeNodePartitionParams0__ +#define ComputeNodePartitionParams ComputeNodePartitionParams__ +#define KWayNodeRefine0 KWayNodeRefine0__ +#define KWayNodeRefine KWayNodeRefine__ +#define KWayNodeRefine2 KWayNodeRefine2__ +#define PrintNodeBalanceInfo PrintNodeBalanceInfo__ + +/* initmsection.c */ +#define InitMultisection InitMultisection__ +#define AssembleMultisectedGraph AssembleMultisectedGraph__ + +/* order.c */ +#define MultilevelOrder MultilevelOrder__ +#define LabelSeparators LabelSeparators__ +#define CompactGraph CompactGraph__ +#define LocalOrder LocalOrder__ +#define LocalNDOrder LocalNDOrder__ +#define Order_Partition Order_Partition__ + +/* xyzpart.c */ +#define Coordinate_Partition Coordinate_Partition__ +#define PartSort PartSort__ + +/***********************/ +/* Utility subroutines */ +/***********************/ +/* fpqueue.c */ +#define FPQueueInit FPQueueInit__ +#define FPQueueReset FPQueueReset__ +#define FPQueueFree FPQueueFree__ +#define FPQueueGetSize FPQueueGetSize__ +#define FPQueueInsert FPQueueInsert__ +#define FPQueueDelete FPQueueDelete__ +#define FPQueueUpdate FPQueueUpdate__ +#define FPQueueUpdateUp FPQueueUpdateUp__ +#define FPQueueGetMax FPQueueGetMax__ +#define FPQueueSeeMaxVtx FPQueueSeeMaxVtx__ +#define FPQueueSeeMaxGain FPQueueSeeMaxGain__ +#define FPQueueGetKey FPQueueGetKey__ +#define FPQueueGetQSize FPQueueGetQSize__ +#define CheckHeapFloat CheckHeapFloat__ + +/* stat.c */ +#define Moc_ComputeSerialBalance Moc_ComputeSerialBalance__ +#define Moc_ComputeParallelBalance Moc_ComputeParallelBalance__ +#define Moc_PrintThrottleMatrix Moc_PrintThrottleMatrix__ +#define Moc_ComputeRefineStats Moc_ComputeRefineStats__ + +/* debug.c */ +#define PrintVector PrintVector__ +#define PrintVector2 PrintVector2__ +#define PrintPairs PrintPairs__ +#define PrintGraph PrintGraph__ +#define PrintGraph2 PrintGraph2__ +#define PrintSetUpInfo PrintSetUpInfo__ +#define PrintTransferedGraphs PrintTransferedGraphs__ +#define WriteMetisGraph WriteMetisGraph__ + +/* comm.c */ +#define CommInterfaceData CommInterfaceData__ +#define CommChangedInterfaceData CommChangedInterfaceData__ +#define GlobalSEMax GlobalSEMax__ +#define GlobalSEMaxDouble GlobalSEMaxDouble__ +#define GlobalSEMin GlobalSEMin__ +#define GlobalSESum GlobalSESum__ +#define GlobalSEMaxFloat GlobalSEMaxFloat__ +#define GlobalSEMinFloat GlobalSEMinFloat__ +#define GlobalSESumFloat GlobalSESumFloat__ + +/* util.c */ +#define errexit errexit__ +#define myprintf myprintf__ +#define rprintf rprintf__ +#define imalloc imalloc__ +#define idxmalloc idxmalloc__ +#define fmalloc fmalloc__ +#define ismalloc ismalloc__ +#define idxsmalloc idxsmalloc__ +#define GKmalloc GKmalloc__ +#define GKfree GKfree__ +#define iset iset__ +#define idxset idxset__ +#define idxamax idxamax__ +#define idxamin idxamin__ +#define idxasum idxasum__ +#define snorm2 snorm2__ +#define sdot sdot__ +#define saxpy saxpy__ +#define ikeyvalsort_org ikeyvalsort_org__ +#define IncKeyValueCmp IncKeyValueCmp__ +#define dkeyvalsort dkeyvalsort__ +#define DecKeyValueCmp DecKeyValueCmp__ +#define BSearch BSearch__ +#define RandomPermute RandomPermute__ +#define FastRandomPermute FastRandomPermute__ +#define ispow2 ispow2__ +#define log2Int log2Int__ +#define BucketSortKeysDec BucketSortKeysDec__ +#define sset sset__ +#define iamax iamax__ +#define idxamax_strd idxamax_strd__ +#define idxamin_strd idxamin_strd__ +#define samax_strd samax_strd__ +#define sfamax sfamax__ +#define samin_strd samin_strd__ +#define idxavg idxavg__ +#define savg savg__ +#define samax samax__ +#define sfavg sfavg__ +#define samax2 samax2__ +#define samin samin__ +#define idxsum idxsum__ +#define idxsum_strd idxsum_strd__ +#define idxadd idxadd__ +#define ssum ssum__ +#define ssum_strd ssum_strd__ +#define sscale sscale__ +#define saneg saneg__ +#define BetterVBalance BetterVBalance__ +#define IsHBalanceBetterTT IsHBalanceBetterTT__ +#define IsHBalanceBetterFT IsHBalanceBetterFT__ +#define myvalkeycompare myvalkeycompare__ +#define imyvalkeycompare imyvalkeycompare__ +#define fsmalloc fsmalloc__ +#define saxpy2 saxpy2__ +#define GetThreeMax GetThreeMax__ + +/* qsort_special.c */ +#define iidxsort iidxsort__ +#define iintsort iintsort__ +#define ikeysort ikeysort__ +#define ikeyvalsort ikeyvalsort__ + +/* grsetup.c */ +#define Moc_SetUpGraph Moc_SetUpGraph__ +#define SetUpCtrl SetUpCtrl__ +#define ChangeNumbering ChangeNumbering__ +#define ChangeNumberingMesh ChangeNumberingMesh__ +#define GraphRandomPermute GraphRandomPermute__ +#define ComputeMoveStatistics ComputeMoveStatistics__ + +/* timer.c */ +#define InitTimers InitTimers__ +#define PrintTimingInfo PrintTimingInfo__ +#define PrintTimer PrintTimer__ + +/* setup.c */ +#define SetUp SetUp__ +#define Home_PE Home_PE__ + + diff --git a/benchmarks/CUDA/DG/include/stdheaders.h b/benchmarks/CUDA/DG/include/stdheaders.h new file mode 100644 index 0000000..7135ed6 --- /dev/null +++ b/benchmarks/CUDA/DG/include/stdheaders.h @@ -0,0 +1,25 @@ +/* + * Copyright 1997, Regents of the University of Minnesota + * + * stdheaders.h + * + * This file includes all necessary header files + * + * Started 8/27/94 + * George + * + * $Id: stdheaders.h,v 1.4 2003/07/25 14:31:47 karypis Exp $ + */ + + +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include + diff --git a/benchmarks/CUDA/DG/include/struct.h b/benchmarks/CUDA/DG/include/struct.h new file mode 100644 index 0000000..3016c5e --- /dev/null +++ b/benchmarks/CUDA/DG/include/struct.h @@ -0,0 +1,290 @@ +/* + * Copyright 1997, Regents of the University of Minnesota + * + * struct.h + * + * This file contains data structures for ILU routines. + * + * Started 9/26/95 + * George + * + * $Id: struct.h,v 1.2 2003/07/21 17:50:22 karypis Exp $ + */ + +/* Indexes are as long as integers for now */ +#ifdef IDXTYPE_INT +#define IDX_DATATYPE MPI_INT +#define MAX_INT INT_MAX +#define MIN_INT INT_MIN +#else +#define IDX_DATATYPE MPI_SHORT +#define MAX_INT SHRT_MAX +#define MIN_INT SHRT_MIN +#endif + + +/************************************************************************* +* The following data structure stores key-value pair +**************************************************************************/ +struct KeyValueType { + idxtype key; + idxtype val; +}; + +typedef struct KeyValueType KeyValueType; + +/************************************************************************* +* The following data structure stores key-value pair +**************************************************************************/ +struct KVType { + int key; + float val; +}; + +typedef struct KVType KVType; + + +/************************************************************************* +* The following data structure stores key-value pair +**************************************************************************/ +struct FKeyValueType { + float key; + idxtype val; +}; + +typedef struct FKeyValueType FKeyValueType; + +/************************************************************************* +* The following data structure stores key-key-value triplets +**************************************************************************/ +struct KeyKeyValueType { + idxtype key1, key2; + idxtype val; +}; + +typedef struct KeyKeyValueType KeyKeyValueType; + +/************************************************************************* +* The following data structure is used to store the buckets for the +* refinment algorithms +**************************************************************************/ +struct PQueueType { + int nnodes; + int maxnnodes; + idxtype *perm, *iperm, *values; + /* iperm[i] stores where the ith entry is located + perm[i] stores the entry that is located in the ith position */ +}; + +typedef struct PQueueType PQueueType; + + +/************************************************************************* +* The following data structure is used to store the buckets for the +* refinment algorithms +**************************************************************************/ +struct FPQueueType { + int type; /* The type of the representation used */ + int nnodes; + int maxnodes; + + /* Heap version of the data structure */ + FKeyValueType *heap; + idxtype *locator; +}; + +typedef struct FPQueueType FPQueueType; + +/************************************************************************* +* The following data structure stores an edge +**************************************************************************/ +struct edgedef { + idxtype edge; + idxtype ewgt; +}; +typedef struct edgedef EdgeType; + + +/************************************************************************* +* This data structure holds various working space data +**************************************************************************/ +struct workspacedef { + idxtype *core; /* Where pairs, indices, and degrees are coming from */ + int maxcore; + + int nlarge; /* The size of 'Large' */ + + KeyValueType *pairs; /* Large pair array used during setup */ + idxtype *indices; /* Large array of indxtype used for various purposes */ + + /* Auxiliary parameters */ + idxtype *pv1, *pv2, *pv3, *pv4; /* Vectors of npes+1 size used in various places */ + KeyValueType *pepairs1, *pepairs2; + + EdgeType *degrees; +}; + +typedef struct workspacedef WorkSpaceType; + + +/************************************************************************* +* The following data structure holds information on degrees for k-way +* partition +**************************************************************************/ +struct rinfodef { + int id, ed; /* ID/ED of edges */ + int ndegrees; /* The number of different ext-degrees */ + EdgeType *degrees; /* List of edges */ +}; + +typedef struct rinfodef RInfoType; + + +/************************************************************************* +* The following data structure holds information on degrees for k-way +* partition +**************************************************************************/ +struct nrinfodef { + int edegrees[2]; +}; + +typedef struct nrinfodef NRInfoType; + + +/************************************************************************* +* The following data structure stores a sparse matrix in CSR format +* The diagonal entry is in the first position of each row. +**************************************************************************/ +struct matrixdef { + int nrows, nnzs; /* Number of rows and nonzeros in the matrix */ + idxtype *rowptr; + idxtype *colind; + float *values; + float *transfer; +}; + +typedef struct matrixdef MatrixType; + + +/************************************************************************* +* This data structure holds the input graph +**************************************************************************/ +struct graphdef { + int gnvtxs, nvtxs, nedges, ncon, nobj; + idxtype *xadj; /* Pointers to the locally stored vertices */ + idxtype *vwgt; /* Vertex weights */ + float *nvwgt; /* Vertex weights */ + idxtype *vsize; /* Vertex size */ + idxtype *adjncy; /* Array that stores the adjacency lists of nvtxs */ + idxtype *adjwgt; /* Array that stores the weights of the adjacency lists */ + idxtype *vtxdist; /* Distribution of vertices */ + + idxtype *match; + idxtype *cmap; + + idxtype *label; + + /* Communication/Setup parameters */ + int nnbrs, nrecv, nsend; /* The number of neighboring processors */ + idxtype *peind; /* Array of size nnbrs storing the neighboring PEs */ + idxtype *sendptr, *sendind; /* CSR format of the vertices that are sent */ + idxtype *recvptr, *recvind; /* CSR format of the vertices that are received */ + idxtype *imap; /* The inverse map of local to global indices */ + idxtype *pexadj, *peadjncy, + *peadjloc; /* CSR format of the PEs each vertex is adjancent to */ + + int nlocal; /* Number of interior vertices */ + idxtype *lperm; /* lperm[0:nlocal] points to interior vertices, the rest are interface */ + + /* Communication parameters for projecting the partition. + * These are computed during CreateCoarseGraph and used during projection + * Note that during projection, the meaning of received and sent is reversed! */ + idxtype *rlens, *slens; /* Arrays of size nnbrs of how many vertices you are sending and receiving */ + KeyValueType *rcand; + + + /* Partition parameters */ + idxtype *where, *home; + idxtype *lpwgts, *gpwgts; + float *lnpwgts, *gnpwgts; + RInfoType *rinfo; + + /* Node refinement information */ + NRInfoType *nrinfo; + int nsep; /* The number of vertices in the separator */ + idxtype *sepind; /* The indices of the vertices in the separator */ + + int lmincut, mincut; + + int level; + int match_type; + int edgewgt_type; + + struct graphdef *coarser, *finer; +}; + +typedef struct graphdef GraphType; + + +/************************************************************************* +* The following data type implements a timer +**************************************************************************/ +typedef double timer; + + +/************************************************************************* +* The following structure stores information used by parallel kmetis +**************************************************************************/ +struct controldef { + int mype, npes; /* Info about the parallel system */ + int CoarsenTo; /* The # of vertices in the coarsest graph */ + int dbglvl; /* Controls the debuging output of the program */ + int nparts; /* The number of partitions */ + int foldf; /* What is the folding factor */ + int ipart; /* The type of initial partitioning */ + int xyztype; /* The type of coordinate indexing */ + int seed; /* Random number seed */ + int sync; /* Random number seed */ + float *tpwgts; /* Target subdomain weights */ + int tvwgts[MAXNCON]; + float ubvec[MAXNCON]; + int partType; + int ps_relation; + + float redist_factor, redist_base, ipc_factor; + float edge_size_ratio; + MatrixType *matrix; + + MPI_Comm gcomm; + MPI_Comm comm; /* MPI Communicator */ + MPI_Request sreq[MAX_PES], + rreq[MAX_PES]; /* MPI send and receive requests */ + MPI_Status statuses[MAX_PES]; + MPI_Status status; + + /* Various Timers */ + timer TotalTmr, InitPartTmr, MatchTmr, ContractTmr, CoarsenTmr, RefTmr, + SetupTmr, ColorTmr, ProjectTmr, KWayInitTmr, KWayTmr, MoveTmr, + RemapTmr, AuxTmr1, AuxTmr2, AuxTmr3, AuxTmr4, AuxTmr5, AuxTmr6; +}; + +typedef struct controldef CtrlType; + + + +/************************************************************************* +* The following data structure stores a mesh. +**************************************************************************/ +struct meshdef { + int etype; + int gnelms, gnns; + int nelms, nns; + int ncon; + int esize, gminnode; + idxtype *elmdist; + idxtype *elements; + idxtype *elmwgt; +}; + +typedef struct meshdef MeshType; + -- cgit v1.3