* All Tools:
- A complete sweep of cleanup to suppress allmost all compiler warnings. * ./metis: - New: Added Python support, for configuration & Unicorn.
This commit is contained in:
parent
b09ad0c40a
commit
e111ec062b
|
@ -15,6 +15,8 @@
|
|||
|
||||
set(QT_USE_QTXML "true")
|
||||
find_package(Qt4 REQUIRED) # find and setup Qt4 for this project
|
||||
find_package(PythonLibs REQUIRED)
|
||||
find_package(PythonSitePackages REQUIRED)
|
||||
find_package(VLSISAPD REQUIRED)
|
||||
find_package(HURRICANE REQUIRED)
|
||||
find_package(CORIOLIS REQUIRED)
|
||||
|
|
|
@ -35,7 +35,7 @@ IF(UNIX)
|
|||
|
||||
FIND_LIBRARY(HMETIS_LIBRARY_PATH
|
||||
NAMES hmetis
|
||||
PATHS ${CORIOLIS_DIR_SEARCH} /opt/coriolis
|
||||
PATHS ${CORIOLIS_DIR_SEARCH}
|
||||
PATH_SUFFIXES lib${LIB_SUFFIX}
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${METIS_INCLUDE_PATH_DESCRIPTION}"
|
||||
|
|
|
@ -10,18 +10,24 @@ endif ( HMETIS_FOUND )
|
|||
${HURRICANE_INCLUDE_DIR}
|
||||
${CONFIGURATION_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PYTHON_INCLUDE_PATH}
|
||||
)
|
||||
set ( includes metis/hmetis.h
|
||||
metis/MetisGraph.h
|
||||
metis/Configuration.h
|
||||
metis/MetisEngine.h
|
||||
)
|
||||
set ( pyIncludes metis/PyMetisEngine.h
|
||||
)
|
||||
set ( cpps MetisGraph.cpp
|
||||
Configuration.cpp
|
||||
MetisEngine.cpp
|
||||
)
|
||||
set ( pyCpps PyMetis.cpp
|
||||
PyMetisEngine.cpp
|
||||
)
|
||||
|
||||
add_library ( metis ${cpps} ${mocCpps} )
|
||||
add_library ( metis ${cpps} ${mocCpps} ${pyCpps} )
|
||||
set_target_properties ( metis PROPERTIES VERSION 1.0 SOVERSION 1 )
|
||||
target_link_libraries ( metis ${HMETIS_LIBRARIES}
|
||||
${NIMBUS_LIBRARIES}
|
||||
|
@ -39,5 +45,18 @@ endif ( HMETIS_FOUND )
|
|||
${LIBXML2_LIBRARIES}
|
||||
${PYTHON_LIBRARIES} -lutil
|
||||
)
|
||||
install ( TARGETS metis DESTINATION lib${LIB_SUFFIX} )
|
||||
install ( FILES ${includes} ${mocIncludes} DESTINATION include/coriolis2/metis )
|
||||
|
||||
add_library ( pyMetis MODULE ${pyCpps} )
|
||||
set_target_properties ( pyMetis PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -D__PYTHON_MODULE__=1"
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "Metis"
|
||||
)
|
||||
target_link_libraries ( pyMetis metis
|
||||
${CORIOLIS_PYTHON_LIBRARIES}
|
||||
)
|
||||
|
||||
install ( TARGETS metis DESTINATION lib${LIB_SUFFIX} )
|
||||
install ( TARGETS pyMetis DESTINATION ${PYTHON_SITE_PACKAGES} )
|
||||
install ( FILES ${includes}
|
||||
${mocIncludes}
|
||||
${pyIncludes} DESTINATION include/coriolis2/metis )
|
||||
|
|
|
@ -2,14 +2,9 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | M e t i s - h M e t i s W r a p p e r |
|
||||
// | |
|
||||
|
@ -17,10 +12,7 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./Configuration.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | N i m b u s - Global Routing Framework |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyMetis.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
#include "hurricane/isobar/PyCell.h"
|
||||
#include "metis/PyMetisEngine.h"
|
||||
|
||||
|
||||
namespace Metis {
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using Hurricane::tab;
|
||||
using Hurricane::in_trace;
|
||||
using Isobar::__cs;
|
||||
using CRL::PyTypeToolEngine;
|
||||
|
||||
|
||||
#if !defined(__PYTHON_MODULE__)
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyMetis" Shared Library Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
|
||||
# else // End of PyHurricane Shared Library Code Part.
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyMetis" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
|
||||
static PyMethodDef PyMetis_Methods[] =
|
||||
{ {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Module Initialization : "initMetis ()"
|
||||
|
||||
DL_EXPORT(void) initMetis () {
|
||||
trace << "initMetis()" << endl;
|
||||
|
||||
PyMetisEngine_LinkPyType ();
|
||||
|
||||
PYTYPE_READY_SUB ( MetisEngine, ToolEngine );
|
||||
|
||||
|
||||
PyObject* module = Py_InitModule ( "Metis", PyMetis_Methods );
|
||||
if ( module == NULL ) {
|
||||
cerr << "[ERROR]\n"
|
||||
<< " Failed to initialize Metis module." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Py_INCREF ( &PyTypeMetisEngine );
|
||||
PyModule_AddObject ( module, "MetisEngine", (PyObject*)&PyTypeMetisEngine );
|
||||
}
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
#endif // End of Python Module Code Part.
|
||||
|
||||
} // End of Metis namespace.
|
|
@ -0,0 +1,148 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | M E T I S - Wrapper around hMetis |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyMetisEngine.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyCell.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "crlcore/Utilities.h"
|
||||
#include "metis/PyMetisEngine.h"
|
||||
|
||||
# undef ACCESS_OBJECT
|
||||
# undef ACCESS_CLASS
|
||||
# define ACCESS_OBJECT _baseObject._object
|
||||
# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject)
|
||||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(MetisEngine,metis,function)
|
||||
|
||||
|
||||
namespace Metis {
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::hex;
|
||||
using std::ostringstream;
|
||||
using Hurricane::tab;
|
||||
using Hurricane::in_trace;
|
||||
using Hurricane::Error;
|
||||
using Hurricane::Warning;
|
||||
using Isobar::ProxyProperty;
|
||||
using Isobar::ProxyError;
|
||||
using Isobar::ConstructorError;
|
||||
using Isobar::HurricaneError;
|
||||
using Isobar::HurricaneWarning;
|
||||
using Isobar::ParseOneArg;
|
||||
using Isobar::ParseTwoArg;
|
||||
using Isobar::PyCell;
|
||||
using Isobar::PyCell_Link;
|
||||
using CRL::PyToolEngine;
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
// +=================================================================+
|
||||
// | "PyMetisEngine" Python Module Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
|
||||
static PyObject* PyMetisEngine_create ( PyObject*, PyObject* args )
|
||||
{
|
||||
trace << "PyMetisEngine_create()" << endl;
|
||||
|
||||
MetisEngine* metis = NULL;
|
||||
|
||||
HTRY
|
||||
PyObject* arg0;
|
||||
|
||||
if (not ParseOneArg("Metis.create", args, CELL_ARG, &arg0)) return NULL;
|
||||
|
||||
Cell* cell = PYCELL_O(arg0);
|
||||
metis = MetisEngine::get(cell);
|
||||
|
||||
if (metis == NULL) {
|
||||
metis = MetisEngine::create(cell);
|
||||
if (cmess1.enabled())
|
||||
metis->getConfiguration()->print(cell);
|
||||
} else
|
||||
cerr << Warning("%s already has a Metis engine.",getString(cell).c_str()) << endl;
|
||||
HCATCH
|
||||
|
||||
return PyMetisEngine_Link(metis);
|
||||
}
|
||||
|
||||
|
||||
PyObject* PyMetisEngine_doQuadriPart ( PyMetisEngine*, PyObject* args )
|
||||
{
|
||||
trace << "PyMetisEngine_doQuadriPart()" << endl;
|
||||
|
||||
HTRY
|
||||
PyObject* arg0;
|
||||
|
||||
if (not ParseOneArg("Metis.doQuadriPart", args, CELL_ARG, &arg0)) return NULL;
|
||||
MetisEngine::doQuadriPart(PYCELL_O(arg0));
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
// Standart Accessors (Attributes).
|
||||
DirectVoidMethod(MetisEngine,metis,printConfiguration)
|
||||
DirectGetBoolAttribute(PyMetisEngine_isHMetisCapable,isHMetisCapable,PyMetisEngine,MetisEngine)
|
||||
|
||||
// Standart Destroy (Attribute).
|
||||
DBoDestroyAttribute(PyMetisEngine_destroy,PyMetisEngine)
|
||||
|
||||
|
||||
PyMethodDef PyMetisEngine_Methods[] =
|
||||
{ { "create" , (PyCFunction)PyMetisEngine_create , METH_VARARGS|METH_STATIC
|
||||
, "Create a Metis engine on this cell." }
|
||||
, { "isHMetisCapable" , (PyCFunction)PyMetisEngine_isHMetisCapable , METH_NOARGS
|
||||
, "Return True the hMetis support is enabled." }
|
||||
, { "printConfiguration", (PyCFunction)PyMetisEngine_printConfiguration, METH_NOARGS
|
||||
, "Display on the console the configuration of Metis." }
|
||||
, { "doQuadriPart" , (PyCFunction)PyMetisEngine_doQuadriPart , METH_VARARGS|METH_STATIC
|
||||
, "Perform a recursive quadri-partition on the cell." }
|
||||
, { "destroy" , (PyCFunction)PyMetisEngine_destroy , METH_NOARGS
|
||||
, "Destroy the associated hurricane object. The python object remains." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
DBoDeleteMethod(MetisEngine)
|
||||
PyTypeObjectLinkPyType(MetisEngine)
|
||||
|
||||
|
||||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
// +=================================================================+
|
||||
// | "PyMetisEngine" Shared Library Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
|
||||
// Link/Creation Method.
|
||||
PyTypeInheritedObjectDefinitions(MetisEngine,PyToolEngine)
|
||||
DBoLinkCreateMethod(MetisEngine)
|
||||
|
||||
|
||||
#endif // End of Shared Library Code Part.
|
||||
|
||||
} // End of extern "C".
|
||||
|
||||
} // End of Metis namespace.
|
||||
|
|
@ -68,6 +68,7 @@ namespace Metis {
|
|||
virtual const Name& getName () const;
|
||||
int getGlobalEdgeCut () const;
|
||||
inline Configuration* getConfiguration ();
|
||||
inline void printConfiguration () const;
|
||||
inline Configuration::RefreshCb_t&
|
||||
getRefreshCb ();
|
||||
inline bool getPartOrKWayHMetis () const;
|
||||
|
@ -102,6 +103,7 @@ namespace Metis {
|
|||
|
||||
// Inline Methods.
|
||||
inline Configuration* MetisEngine::getConfiguration () { return _configuration; }
|
||||
inline void MetisEngine::printConfiguration () const { _configuration->print(getCell()); }
|
||||
inline Configuration::RefreshCb_t& MetisEngine::getRefreshCb () { return _configuration->getRefreshCb(); }
|
||||
inline bool MetisEngine::getPartOrKWayHMetis () const { return _configuration->getPartOrKWayHMetis(); }
|
||||
inline unsigned int MetisEngine::getNumberOfInstancesStopCriterion () const { return _configuration->getNumberOfInstancesStopCriterion(); }
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | M E T I S - Wrapper around hMetis |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./metis/PyMetisEngine.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __PY_METIS_ENGINE__
|
||||
#define __PY_METIS_ENGINE__
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
#include "crlcore/PyToolEngine.h"
|
||||
#include "metis/MetisEngine.h"
|
||||
|
||||
|
||||
namespace Metis {
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Python Object : "PyMetisEngine".
|
||||
|
||||
typedef struct {
|
||||
CRL::PyToolEngine _baseObject;
|
||||
} PyMetisEngine;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Functions & Types exported to "PyMetis.ccp".
|
||||
|
||||
extern PyTypeObject PyTypeMetisEngine;
|
||||
extern PyMethodDef PyMetisEngine_Methods[];
|
||||
|
||||
extern PyObject* PyMetisEngine_Link ( Metis::MetisEngine* );
|
||||
extern void PyMetisEngine_LinkPyType ();
|
||||
|
||||
|
||||
#define IsPyMetisEngine(v) ( (v)->ob_type == &PyTypeMetisEngine )
|
||||
#define PY_METIS_ENGINE(v) ( (PyMetisEngine*)(v) )
|
||||
#define PY_METIS_ENGINE_O(v) ( PY_METIS_ENGINE(v)->_baseObject._object )
|
||||
|
||||
|
||||
} // extern "C".
|
||||
|
||||
} // Metis namespace.
|
||||
|
||||
#endif // __PY_METIS_ENGINE__
|
Loading…
Reference in New Issue