From 563a9dec264d7ac8bfc852290fa6b9895b045c37 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 22 Jun 2010 14:09:20 +0000 Subject: [PATCH] * ./metis: - Change: In doQuadriPart, manage correctly non-square designs. So that after an initial non-quadripartition step, the partitions are rougly squares. Seems to have trouble with small designs. --- metis/src/MetisEngine.cpp | 37 +++++++++++++++++++++++++---------- metis/src/metis/MetisEngine.h | 2 +- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/metis/src/MetisEngine.cpp b/metis/src/MetisEngine.cpp index 415c0fc6..fe6dc70f 100644 --- a/metis/src/MetisEngine.cpp +++ b/metis/src/MetisEngine.cpp @@ -165,6 +165,7 @@ namespace Metis { _globalEdgeCut += graph->part ( output ); } catch ( MetisGraph::TooLowNVTXSException& e ) { + if ( cmess2.enabled() ) cerr << "\n"; cerr << Warning("Impossible to part graph, only %d nodes",e._nvtxs); } @@ -178,7 +179,7 @@ namespace Metis { } } - output << endl; + output << "\n"; for ( MetisGraphs::iterator mgit=_actualGraphs->begin(); mgit != _actualGraphs->end(); ++mgit ) delete *mgit; @@ -270,14 +271,27 @@ namespace Metis { } - unsigned int MetisEngine::computeQuadriPartitions ( Cell* cell ) + unsigned int MetisEngine::computeQuadriPartitions ( Cell* cell, int& xsplits, int& ysplits ) { - size_t gates = getInstancesCount ( cell ); + size_t gates = getInstancesCount ( cell ); + Box ab = cell->getAbutmentBox(); + double aspectRatio = (double)(ab.getWidth()) / (double)(ab.getHeight()); + + if ( aspectRatio >= 1.0 ) { + xsplits = ((int)(trunc ( aspectRatio +0.5 ) )) * 2; + ysplits = 2; + } else { + xsplits = 2; + ysplits = ((int)(trunc ( (1.0/aspectRatio)+0.5 ) )) * 2; + } + + cerr << "gates:" << gates << endl; + cerr << "ar:" << aspectRatio << " xsplits:" << xsplits << " ysplits:" << ysplits << endl; int partitionSizeStop = Cfg::getParamInt("metis.numberOfInstancesStopCriterion",45)->asInt(); - double partitions = log((double)gates / (double)partitionSizeStop) / log(4.0) + 1.0; + double quadPartitions = log((double)gates / (double)(partitionSizeStop*xsplits*ysplits) ) / log(4.0) + 1.0; - return (unsigned int)(partitions); + return (unsigned int)(quadPartitions); } @@ -297,9 +311,6 @@ namespace Metis { // throw Error ("Metis::doQuadriPart(): Nimbus already exists on <%s>" // ,getString(cell->getName()).c_str()); - // nimbus = NimbusEngine::create ( cell, AllianceFramework::get()->getLibrary(1) ); - // metis = MetisEngine ::create ( cell ); - NimbusEngine* nimbus = NimbusEngine::get ( cell ); if ( nimbus == NULL ) nimbus = NimbusEngine::create ( cell ); @@ -308,10 +319,16 @@ namespace Metis { if ( metis == NULL ) metis = MetisEngine ::create ( cell ); - size_t partitions = computeQuadriPartitions ( cell ); + int xsplits; + int ysplits; + size_t partitions = computeQuadriPartitions ( cell, xsplits, ysplits ); + for ( size_t part=0 ; partprogress (); + nimbus->progress ( xsplits, ysplits ); metis-> run (); + + xsplits = 2; + ysplits = 2; } } diff --git a/metis/src/metis/MetisEngine.h b/metis/src/metis/MetisEngine.h index 9793ff34..0bd64336 100644 --- a/metis/src/metis/MetisEngine.h +++ b/metis/src/metis/MetisEngine.h @@ -61,7 +61,7 @@ namespace Metis { static MetisEngine* create ( Cell* ); static MetisEngine* get ( Cell* ); // Methods. - static unsigned int computeQuadriPartitions ( Cell* ); + static unsigned int computeQuadriPartitions ( Cell*, int& xsplits, int& ysplits ); static void doQuadriPart ( Cell* ); static bool isHMetisCapable (); static const Name& staticGetName ();