From 6fd383ad5141a0d02d411fae081d4d01f034476c Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 12 Feb 2019 12:48:52 +0100 Subject: [PATCH] Make FLUTE an independant tool in the Coriolis git repository. * Change: To allow multiple tools, and not only Knik, to link and use FLUTE, remove it from Knik and put it at top level. Bootsrap must compile this new tool and the library must be included in all CMakeLists.txt depending on Knik (and soon Anabatic). --- bootstrap/build.conf | 1 + bootstrap/cmake_modules/FindBootstrap.cmake | 4 +-- bora/CMakeLists.txt | 1 + bora/src/CMakeLists.txt | 1 + katabatic/CMakeLists.txt | 1 + katana/CMakeLists.txt | 1 + katana/src/CMakeLists.txt | 1 + kite/CMakeLists.txt | 1 + kite/src/CMakeLists.txt | 2 ++ knik/CMakeLists.txt | 5 ++-- knik/src/CMakeLists.txt | 33 +++------------------ knik/src/Graph.cpp | 13 ++++---- knik/src/KnikEngine.cpp | 4 +-- knik/src/knik/Graph.h | 8 +++-- unicorn/CMakeLists.txt | 1 + unicorn/src/CMakeLists.txt | 1 + 16 files changed, 35 insertions(+), 43 deletions(-) diff --git a/bootstrap/build.conf b/bootstrap/build.conf index de43eaeb..da0558b7 100644 --- a/bootstrap/build.conf +++ b/bootstrap/build.conf @@ -14,6 +14,7 @@ projects = [ , { 'name' : "coriolis" , 'tools' : [ "bootstrap" , "lefdef" + , "flute" , "vlsisapd" , "hurricane" , "crlcore" diff --git a/bootstrap/cmake_modules/FindBootstrap.cmake b/bootstrap/cmake_modules/FindBootstrap.cmake index fff95462..a716172c 100644 --- a/bootstrap/cmake_modules/FindBootstrap.cmake +++ b/bootstrap/cmake_modules/FindBootstrap.cmake @@ -85,8 +85,8 @@ set(ADDTIONAL_FLAGS "") set(CXX_STANDARD "c++11") endif() - set(CMAKE_C_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE) - set(CMAKE_C_FLAGS_RELEASE "-std=${CXX_STANDARD} -Wall -O2 ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C Compiler Release options." FORCE) + set(CMAKE_C_FLAGS_DEBUG " -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE) + set(CMAKE_C_FLAGS_RELEASE " -Wall -O2 ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C Compiler Release options." FORCE) set(CMAKE_CXX_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C++ Compiler Debug options." FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-std=${CXX_STANDARD} -Wall -O2 ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C++ Compiler Release options." FORCE) diff --git a/bora/CMakeLists.txt b/bora/CMakeLists.txt index a05c86b9..d834b59c 100644 --- a/bora/CMakeLists.txt +++ b/bora/CMakeLists.txt @@ -23,6 +23,7 @@ find_package(PythonSitePackages REQUIRED) find_package(LEFDEF REQUIRED) find_package(VLSISAPD REQUIRED) + find_package(FLUTE REQUIRED) find_package(HURRICANE REQUIRED) find_package(CORIOLIS REQUIRED) find_package(ANABATIC REQUIRED) diff --git a/bora/src/CMakeLists.txt b/bora/src/CMakeLists.txt index bdaef0b0..589c47be 100644 --- a/bora/src/CMakeLists.txt +++ b/bora/src/CMakeLists.txt @@ -85,6 +85,7 @@ ${CONFIGURATION_LIBRARY} ${CIF_LIBRARY} ${AGDS_LIBRARY} + ${FLUTE_LIBRARIES} ${LEFDEF_LIBRARIES} ${OA_LIBRARIES} ${QWT_LIBRARY} diff --git a/katabatic/CMakeLists.txt b/katabatic/CMakeLists.txt index fdb45f0f..f37e40eb 100644 --- a/katabatic/CMakeLists.txt +++ b/katabatic/CMakeLists.txt @@ -18,6 +18,7 @@ find_package(PythonLibs 2 REQUIRED) find_package(PythonSitePackages REQUIRED) + find_package(FLUTE REQUIRED) find_package(VLSISAPD REQUIRED) find_package(HURRICANE REQUIRED) find_package(CORIOLIS REQUIRED) diff --git a/katana/CMakeLists.txt b/katana/CMakeLists.txt index 52129e56..d5a437c1 100644 --- a/katana/CMakeLists.txt +++ b/katana/CMakeLists.txt @@ -23,6 +23,7 @@ find_package(PythonLibs 2 REQUIRED) find_package(PythonSitePackages REQUIRED) find_package(LEFDEF REQUIRED) + find_package(FLUTE REQUIRED) find_package(VLSISAPD REQUIRED) find_package(HURRICANE REQUIRED) find_package(CORIOLIS REQUIRED) diff --git a/katana/src/CMakeLists.txt b/katana/src/CMakeLists.txt index e0e50adc..ebb1df3e 100644 --- a/katana/src/CMakeLists.txt +++ b/katana/src/CMakeLists.txt @@ -95,6 +95,7 @@ ${CIF_LIBRARY} ${AGDS_LIBRARY} ${UTILITIES_LIBRARY} + ${FLUTE_LIBRARIES} ${LEFDEF_LIBRARIES} ${OA_LIBRARIES} ${QtX_LIBRARIES} diff --git a/kite/CMakeLists.txt b/kite/CMakeLists.txt index dea5d107..ba298a44 100644 --- a/kite/CMakeLists.txt +++ b/kite/CMakeLists.txt @@ -19,6 +19,7 @@ find_package(LibXml2 REQUIRED) find_package(PythonLibs 2 REQUIRED) find_package(PythonSitePackages REQUIRED) + find_package(FLUTE REQUIRED) find_package(VLSISAPD REQUIRED) find_package(LEFDEF REQUIRED) find_package(HURRICANE REQUIRED) diff --git a/kite/src/CMakeLists.txt b/kite/src/CMakeLists.txt index 7b7d1ca1..2c05d319 100644 --- a/kite/src/CMakeLists.txt +++ b/kite/src/CMakeLists.txt @@ -5,6 +5,7 @@ ${CORIOLIS_INCLUDE_DIR} ${HURRICANE_INCLUDE_DIR} ${CONFIGURATION_INCLUDE_DIR} + ${FLUTE_INCLUDE_DIR} ${WtX_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH} @@ -85,6 +86,7 @@ ${CIF_LIBRARY} ${AGDS_LIBRARY} ${UTILITIES_LIBRARY} + ${FLUTE_LIBRARIES} ${LEFDEF_LIBRARIES} ${OA_LIBRARIES} ${QtX_LIBRARIES} diff --git a/knik/CMakeLists.txt b/knik/CMakeLists.txt index 66064dc3..97d68038 100644 --- a/knik/CMakeLists.txt +++ b/knik/CMakeLists.txt @@ -16,9 +16,10 @@ setup_boost(program_options filesystem python regex) setup_qt() - find_package(VLSISAPD REQUIRED) + find_package(FLUTE REQUIRED) + find_package(VLSISAPD REQUIRED) find_package(HURRICANE REQUIRED) - find_package(CORIOLIS REQUIRED) + find_package(CORIOLIS REQUIRED) add_subdirectory(src) add_subdirectory(cmake_modules) diff --git a/knik/src/CMakeLists.txt b/knik/src/CMakeLists.txt index e4019571..a952177c 100644 --- a/knik/src/CMakeLists.txt +++ b/knik/src/CMakeLists.txt @@ -3,6 +3,7 @@ # include ( ${QT_USE_FILE} ) include_directories ( ${KNIK_SOURCE_DIR}/src ${KNIK_SOURCE_DIR}/src/flute-3.1/src + ${FLUTE_INCLUDE_DIR} ${HURRICANE_INCLUDE_DIR} ${CORIOLIS_INCLUDE_DIR} ${UTILITIES_INCLUDE_DIR} @@ -39,35 +40,12 @@ KnikEngine.cpp GraphicKnikEngine.cpp ) - set ( fluteIncludes flute-3.1/src/knik/flute.h - flute-3.1/src/knik/dl.h - flute-3.1/src/knik/mst2.h - flute-3.1/src/knik/err.h - flute-3.1/src/knik/heap.h - flute-3.1/src/knik/dist.h - flute-3.1/src/knik/global.h - flute-3.1/src/knik/neighbors.h - ) - set ( fluteCpps flute-3.1/src/flute.cpp - flute-3.1/src/flute_mst.cpp - flute-3.1/src/dist.cpp - flute-3.1/src/dl.cpp - flute-3.1/src/err.cpp - flute-3.1/src/mst2.cpp - flute-3.1/src/heap.cpp - flute-3.1/src/neighbors.cpp - ) qtX_wrap_cpp ( mocCpps ${mocIncludes} ) - add_library ( flute ${fluteCpps} ) - set_target_properties ( flute PROPERTIES VERSION 3.1 SOVERSION 3 ) - target_link_libraries ( flute ${HURRICANE_LIBRARIES} - ${CORIOLIS_LIBRARIES} - ) add_library ( knik ${cpps} ${mocCpps} ) set_target_properties ( knik PROPERTIES VERSION 1.0 SOVERSION 1 ) - target_link_libraries ( knik flute + target_link_libraries ( knik ${FLUTE_LIBRARY} ${HURRICANE_PYTHON_LIBRARIES} ${HURRICANE_GRAPHICAL_LIBRARIES} ${HURRICANE_LIBRARIES} @@ -83,9 +61,6 @@ ${PYTHON_LIBRARIES} -lutil ) - install ( TARGETS knik flute DESTINATION lib${LIB_SUFFIX} ) + install ( TARGETS knik DESTINATION lib${LIB_SUFFIX} ) install ( FILES ${includes} - ${mocIncludes} - ${fluteIncludes} DESTINATION include/coriolis2/knik ) - install ( FILES flute-3.1/etc/POST9.dat - flute-3.1/etc/POWV9.dat DESTINATION share/coriolis2/flute-3.1 ) + ${mocIncludes} DESTINATION include/coriolis2/knik ) diff --git a/knik/src/Graph.cpp b/knik/src/Graph.cpp index a4e12972..91335776 100644 --- a/knik/src/Graph.cpp +++ b/knik/src/Graph.cpp @@ -4,6 +4,8 @@ #include #include +#include "flute.h" + #include "hurricane/DebugSession.h" #include "hurricane/Warning.h" #include "hurricane/Error.h" @@ -33,7 +35,6 @@ #include "knik/VEdge.h" #include "knik/KnikEngine.h" -#include "knik/flute.h" //#define __USE_SLICINGTREE__ #define __USE_MATRIXVERTEX__ @@ -1524,14 +1525,14 @@ void Graph::Monotonic() //#endif } -FTree* Graph::createFluteTree() +Tree* Graph::createFluteTree() // **************************** { int accuracy = 3; // accuracy for flute (by default 3) int d = _vertexes_to_route.size(); // degre du net, ie nombre de routingPads int *x = new int [d]; // x coordinates of the vertexes int *y = new int [d]; // y coordinates of the vertexes - FTree* flutetree = new FTree; // the flute Steiner Tree + Tree* flutetree = new Tree; // the flute Steiner Tree //cout << "Net : " << _working_net << endl; // scans _working_net to find x,y coordinates and fill x, y and d @@ -1548,7 +1549,7 @@ FTree* Graph::createFluteTree() assert ( d == cpt ); - *flutetree = flute ( d, x, y, accuracy ); + *flutetree = Flute::flute ( d, x, y, accuracy ); //printtree ( flutetree ); //plottree ( flutetree ); //cout << endl; @@ -1561,9 +1562,9 @@ void Graph::UpdateEstimateCongestion ( bool create ) if ( _vertexes_to_route.size() < 2 ) return; //cerr << "Running FLUTE for net : " << _working_net << endl; - unique_ptr flutetree ( createFluteTree() ); + unique_ptr flutetree ( createFluteTree() ); - //parcours des branches du FTree pour créer la congestion estimée + //parcours des branches du Tree pour créer la congestion estimée for ( int i = 0 ; i < 2*flutetree->deg-2 ; i++ ) { // int sourceX = flutetree->branch[i].x; // int sourceY = flutetree->branch[i].y; diff --git a/knik/src/KnikEngine.cpp b/knik/src/KnikEngine.cpp index 8e026b1c..325fd3b1 100644 --- a/knik/src/KnikEngine.cpp +++ b/knik/src/KnikEngine.cpp @@ -15,6 +15,7 @@ #include +#include "flute.h" #include "hurricane/Warning.h" #include "hurricane/Property.h" #include "hurricane/NetRoutingProperty.h" @@ -40,7 +41,6 @@ #include "knik/RoutingGrid.h" #include "knik/NetExtension.h" #include "knik/KnikEngine.h" -#include "knik/flute.h" #define MAX_RUNTIME 86400 @@ -134,7 +134,7 @@ void KnikEngine::_postCreate() Inherit::_postCreate(); // For Flute : readLUT to be able to use POWV9.dat & POST9.dat - readLUT(); + Flute::readLUT( AllianceFramework::get()->getEnvironment()->getCORIOLIS_TOP() ); return; } diff --git a/knik/src/knik/Graph.h b/knik/src/knik/Graph.h index 6d8eaf82..b8bc6c5c 100644 --- a/knik/src/knik/Graph.h +++ b/knik/src/knik/Graph.h @@ -28,7 +28,11 @@ #include "knik/SlicingTree.h" #include "knik/RoutingGrid.h" -struct FTree; +namespace Flute { + struct Tree; +} +using Flute::Tree; + namespace Knik { @@ -153,7 +157,7 @@ namespace Knik { int initRouting ( Net* net ); void Dijkstra (); void Monotonic (); - FTree* createFluteTree (); + Tree* createFluteTree (); void CleanRoutingState (); void UpdateEstimateCongestion ( bool create = false ); void UpdateMaxEstimateCongestion (); diff --git a/unicorn/CMakeLists.txt b/unicorn/CMakeLists.txt index 1e20a760..6a93dd34 100644 --- a/unicorn/CMakeLists.txt +++ b/unicorn/CMakeLists.txt @@ -20,6 +20,7 @@ find_package(PythonSitePackages REQUIRED) find_package(LEFDEF REQUIRED) find_package(COLOQUINTE) + find_package(FLUTE REQUIRED) find_package(VLSISAPD REQUIRED) find_package(HURRICANE REQUIRED) find_package(CORIOLIS REQUIRED) diff --git a/unicorn/src/CMakeLists.txt b/unicorn/src/CMakeLists.txt index fe8fab2d..fcb98b4b 100644 --- a/unicorn/src/CMakeLists.txt +++ b/unicorn/src/CMakeLists.txt @@ -64,6 +64,7 @@ ${UTILITIES_LIBRARY} ${CONFIGURATION_LIBRARY} ${COLOQUINTE_LIBRARIES} + ${FLUTE_LIBRARIES} ${LEFDEF_LIBRARIES} ${OA_LIBRARIES} ${QtX_LIBRARIES}