Skip to content
Snippets Groups Projects
Commit b1816f84 authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Updated version of METIS to 5.0.2.

Modified graph partitioning routine to new API
Temporarily disabled calls to AS_METIS_NodeND.
parent 764acd12
No related branches found
No related tags found
No related merge requests found
......@@ -221,7 +221,7 @@ MACRO(ADD_NEKTAR_LIBRARY name component type)
# NIST Sparse BLAS only static, so link into Nektar libraries directly.
TARGET_LINK_LIBRARIES( ${name} ${NIST_SPARSE_BLAS} ${METIS_LIB})
ADD_DEPENDENCIES(${name} spblastk0.9b modmetis-4.0 boost tinyxml zlib)
ADD_DEPENDENCIES(${name} spblastk0.9b metis-5.0.2 boost tinyxml zlib)
SET_PROPERTY(TARGET ${name} PROPERTY FOLDER ${component})
IF (NEKTAR_USE_MPI)
TARGET_LINK_LIBRARIES( ${name} ${GSMPI_LIBRARY} ${XXT_LIBRARY})
......
......@@ -4,17 +4,18 @@ SET(THIRDPARTY_BUILD_METIS ON CACHE BOOL
IF (THIRDPARTY_BUILD_METIS)
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
modmetis-4.0
metis-5.0.2
PREFIX ${TPSRC}
URL ${TPURL}/modmetis-4.0.tar.bz2
URL_MD5 "4267355e04dcc2ef36f9889a98c923a5"
URL ${TPURL}/metis-5.0.2.tar.gz
URL_MD5 "acb521a4e8c2e6dd559a7f9abd0468c5"
DOWNLOAD_DIR ${TPSRC}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH=${TPSRC}/dist ${TPSRC}/src/modmetis-4.0
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH=${TPSRC}/dist -DGKLIB_PATH:PATH=${TPSRC}/src/metis-5.0.2/GKlib ${TPSRC}/src/metis-5.0.2
)
SET(METIS_LIB modmetis CACHE FILEPATH
SET(METIS_LIB metis CACHE FILEPATH
"METIS library" FORCE)
MARK_AS_ADVANCED(METIS_LIB)
LINK_DIRECTORIES(${TPSRC}/dist/lib)
INCLUDE_DIRECTORIES(${TPSRC}/dist/include)
ELSE (THIRDPARTY_BUILD_METIS)
INCLUDE (FindMetis)
ENDIF (THIRDPARTY_BUILD_METIS)
......
......@@ -39,15 +39,17 @@
#include <LibUtilities/BasicConst/NektarUnivTypeDefs.hpp>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include "metis.h"
namespace Metis
{
extern "C"
{
// -- Sparse MAtrix Reordering (equivalent to onmetis)
/* // -- Sparse MAtrix Reordering (equivalent to onmetis)
void METIS_NodeND (int *nVerts, int *xadj, int *adjncy, int *numflag, int *options,
int *perm, int *iperm);
void AS_METIS_NodeND(int *nVerts, int *xadj, int *adjncy, int *numflag, int *options,
void AS_METIS_NodeND(int *nVerts, int *xadj, int *adjncy, int *numflag, int *options,
int *perm, int *iperm, int *map, int *mdswitch);
void METIS_PartMeshNodal(int *nElmts, int *nVerts, int *elType, int *numflag,
......@@ -55,9 +57,8 @@ namespace Metis
void METIS_PartGraphVKway(int *nVerts, int *xadj, int *adjcy, int *vertWgt, int *vertSize,
int *wgtFlag, int *numflag, int *nparts, int *options, int *volume, int *part);
}
*/ }
//#ifdef NEKTAR_USING_METIS
inline static void onmetis(int *nVerts, int *xadj, int *adjncy, int *numflag, int *options,
int *perm, int *iperm)
{
......@@ -67,7 +68,7 @@ namespace Metis
inline static void as_onmetis(int *nVerts, int *xadj, int *adjncy, int *numflag, int *options,
int *perm, int *iperm, int *map, int *mdswitch)
{
AS_METIS_NodeND(nVerts,xadj,adjncy,numflag,options,perm,iperm,map,mdswitch) ;
// AS_METIS_NodeND(nVerts,xadj,adjncy,numflag,options,perm,iperm,map,mdswitch) ;
}
inline static void onmetis(int nVerts, Nektar::Array<Nektar::OneD, int> xadj, Nektar::Array<Nektar::OneD, int> adjncy,
......@@ -87,22 +88,22 @@ namespace Metis
Nektar::Array<Nektar::OneD, int> perm, Nektar::Array<Nektar::OneD, int> iperm, Nektar::Array<Nektar::OneD, int> map,
int mdswitch)
{
ASSERTL1(xadj.num_elements() == nVerts+1,"Array xadj out of bounds");
ASSERTL1(perm.num_elements() == nVerts,"Array perm out of bounds");
ASSERTL1(iperm.num_elements() == nVerts,"Array iperm out of bounds");
int numflag = 0;
int options[8];
options[0]=0;
AS_METIS_NodeND(&nVerts,&xadj[0],&adjncy[0],&numflag,options,&perm[0],&iperm[0],&map[0],&mdswitch);
// ASSERTL1(xadj.num_elements() == nVerts+1,"Array xadj out of bounds");
// ASSERTL1(perm.num_elements() == nVerts,"Array perm out of bounds");
// ASSERTL1(iperm.num_elements() == nVerts,"Array iperm out of bounds");
//
// int numflag = 0;
// int options[8];
// options[0]=0;
// AS_METIS_NodeND(&nVerts,&xadj[0],&adjncy[0],&numflag,options,&perm[0],&iperm[0],&map[0],&mdswitch);
}
inline static void MeshPartition(int nElmts, int nVerts, Nektar::Array<Nektar::OneD, int>& mesh, int type, int nparts,
Nektar::Array<Nektar::OneD, int>& edgePart, Nektar::Array<Nektar::OneD, int>& nodePart)
{
int numflag = 0;
METIS_PartMeshNodal(&nElmts, &nVerts, &mesh[0], &type, &numflag, &nparts, &edgePart[0], &nodePart[0]);
}
// inline static void MeshPartition(int nElmts, int nVerts, Nektar::Array<Nektar::OneD, int>& mesh, int type, int nparts,
// Nektar::Array<Nektar::OneD, int>& edgePart, Nektar::Array<Nektar::OneD, int>& nodePart)
// {
// int numflag = 0;
// METIS_PartMeshNodal(&nElmts, &nVerts, &mesh[0], &type, &numflag, &nparts, &edgePart[0], &nodePart[0]);
// }
inline static void PartGraphVKway( int& nVerts,
Nektar::Array<Nektar::OneD, int>& xadj,
......@@ -114,24 +115,23 @@ namespace Metis
Nektar::Array<Nektar::OneD, int>& part)
{
int wgtflag = 0;
int *wgts = 0;
int *sizes = 0;
int *vwgt = 0;
int *vsize = 0;
if (vertWgt.num_elements() > 0)
{
wgtflag += 1;
wgts = &vertWgt[0];
vwgt = &vertWgt[0];
}
if (vertSize.num_elements() > 0)
{
wgtflag += 2;
sizes = &vertSize[0];
vsize = &vertSize[0];
}
int numflag = 0;
int options[5];
options[0]=0;
METIS_PartGraphVKway(&nVerts, &xadj[0], &adjcy[0], wgts, sizes, &wgtflag,
&numflag, &nparts, options, &volume, &part[0]);
int ncon = 1;
int options[METIS_NOPTIONS];
METIS_SetDefaultOptions(options);
METIS_PartGraphKway(&nVerts, &ncon, &xadj[0], &adjcy[0], vwgt, vsize,
0, &nparts, 0, 0, options, &volume, &part[0]);
}
//#endif //NEKTAR_USING_METIS
}
#endif //NEKTAR_LIB_UTILITIES_BASICUTILS_METIS_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment