From 276fabf7ff7926b5f79a450c24fa08f57063c654 Mon Sep 17 00:00:00 2001 From: Roselyne Chotin-Avot Date: Wed, 20 Jul 2016 15:21:50 +0200 Subject: [PATCH] Compatibility with clang 7.3 and MacOSX 10.11 --- coloquinte/src/circuit.cxx | 11 ++++++----- coloquinte/src/coloquinte/circuit_helper.hxx | 3 ++- .../src/coloquinte/optimization_subproblems.hxx | 4 +++- coloquinte/src/legalizer.cxx | 12 ++++++------ coloquinte/src/optimization_subproblems.cxx | 2 +- coloquinte/src/piecewise_linear.cxx | 1 + coloquinte/src/solvers.cxx | 1 + coloquinte/src/topologies.cxx | 16 +++++++++------- crlcore/src/LibraryManager/CMakeLists.txt | 1 + hurricane/src/hurricane/hurricane/Observer.h | 1 + hurricane/src/isobar/CMakeLists.txt | 1 + 11 files changed, 32 insertions(+), 21 deletions(-) diff --git a/coloquinte/src/circuit.cxx b/coloquinte/src/circuit.cxx index 4d9c0200..b91cb864 100644 --- a/coloquinte/src/circuit.cxx +++ b/coloquinte/src/circuit.cxx @@ -1,6 +1,7 @@ #include "coloquinte/circuit_helper.hxx" #include "coloquinte/circuit.hxx" +#include namespace coloquinte{ @@ -51,7 +52,7 @@ void add_force(pin_1D const p1, pin_1D const p2, linear_system & L, float_t forc } void add_force(pin_1D const p1, pin_1D const p2, linear_system & L, float_t tol, float_t scale){ - add_force(p1, p2, L, scale/std::max(tol, static_cast(std::abs(p2.pos-p1.pos)))); + add_force(p1, p2, L, scale/std::max(tol, static_cast(std::abs((float)(p2.pos-p1.pos))))); } point empty_linear_systems(netlist const & circuit, placement_t const & pl){ @@ -344,11 +345,11 @@ point get_linear_pulling_forces (netlist const & circuit, placeme std::vector scaling = get_area_scales(circuit); for(index_t i=0; i(std::abs(UB_pl.positions_[i].x - LB_pl.positions_[i].x)), min_distance)), + force * scaling[i] / (std::max(static_cast(std::abs((float)(UB_pl.positions_[i].x - LB_pl.positions_[i].x))), min_distance)), i, UB_pl.positions_[i].x ); L.y.add_anchor( - force * scaling[i] / (std::max(static_cast(std::abs(UB_pl.positions_[i].y - LB_pl.positions_[i].y)), min_distance)), + force * scaling[i] / (std::max(static_cast(std::abs((float)(UB_pl.positions_[i].y - LB_pl.positions_[i].y))), min_distance)), i, UB_pl.positions_[i].y ); } @@ -378,7 +379,7 @@ float_t get_mean_linear_disruption(netlist const & circuit, placement_t const & if( (circuit.get_cell(i).attributes & XMovable) == 0) assert(diff.x == 0); if( (circuit.get_cell(i).attributes & YMovable) == 0) assert(diff.y == 0); - tot_cost += area * (std::abs(diff.x) + std::abs(diff.y)); + tot_cost += area * (std::abs((float)diff.x) + std::abs((float)diff.y)); tot_area += area; } return tot_cost / tot_area; @@ -394,7 +395,7 @@ float_t get_mean_quadratic_disruption(netlist const & circuit, placement_t const if( (circuit.get_cell(i).attributes & XMovable) == 0) assert(diff.x == 0); if( (circuit.get_cell(i).attributes & YMovable) == 0) assert(diff.y == 0); - float_t manhattan = (std::abs(diff.x) + std::abs(diff.y)); + float_t manhattan = (std::abs((float)diff.x) + std::abs((float)diff.y)); tot_cost += area * manhattan * manhattan; tot_area += area; } diff --git a/coloquinte/src/coloquinte/circuit_helper.hxx b/coloquinte/src/coloquinte/circuit_helper.hxx index ae002480..5509052b 100644 --- a/coloquinte/src/coloquinte/circuit_helper.hxx +++ b/coloquinte/src/coloquinte/circuit_helper.hxx @@ -4,6 +4,7 @@ #include "common.hxx" #include "netlist.hxx" +#include namespace coloquinte{ @@ -30,7 +31,7 @@ struct pin_2D{ inline int_t dist(pin_2D const a, pin_2D const b){ point diff = a.pos - b.pos; - return std::abs(diff.x) + std::abs(diff.y); + return std::abs((float)diff.x) + std::abs((float)diff.y); } inline std::vector get_pins_2D(netlist const & circuit, placement_t const & pl, index_t net_ind){ diff --git a/coloquinte/src/coloquinte/optimization_subproblems.hxx b/coloquinte/src/coloquinte/optimization_subproblems.hxx index 8c9ff465..e0849b23 100644 --- a/coloquinte/src/coloquinte/optimization_subproblems.hxx +++ b/coloquinte/src/coloquinte/optimization_subproblems.hxx @@ -7,6 +7,8 @@ #include #include #include +#include +#include namespace coloquinte{ @@ -133,7 +135,7 @@ inline T OSRP_leg::get_displacement(legalizable_task const newly_pushed, b } } - return cur_cost + width * std::abs(final_abs_pos - target_abs_pos); // Add the cost of the new cell + return cur_cost + width * std::abs((float)(final_abs_pos - target_abs_pos)); // Add the cost of the new cell } template diff --git a/coloquinte/src/legalizer.cxx b/coloquinte/src/legalizer.cxx index 8166798f..31485144 100644 --- a/coloquinte/src/legalizer.cxx +++ b/coloquinte/src/legalizer.cxx @@ -119,7 +119,7 @@ std::vector simple_legalize( if(interval_lim >= cur_pos){ // An admissible solution is found (and if cell.x_pos is between cur_pos and interval_lim it is optimal) int_t row_best_x = std::min(interval_lim, std::max(cur_pos, cell.x_pos)); - int_t row_cost_x = std::abs(row_best_x - cell.x_pos); + int_t row_cost_x = std::abs((float)(row_best_x - cell.x_pos)); if(not found_location or row_cost_x + additional_cost < best_cost){ found_location = true; best_cost = row_cost_x + additional_cost; @@ -140,11 +140,11 @@ std::vector simple_legalize( ++row_dist ){ if(central_row + row_dist < nbr_rows - C.nbr_rows){ - int_t add_cost = C.width * std::abs(static_cast(central_row + row_dist) * static_cast(row_height) + y_orig - C.y_pos); + int_t add_cost = C.width * std::abs((float)static_cast(central_row + row_dist) * static_cast(row_height) + y_orig - C.y_pos); check_row_cost(central_row + row_dist, C, add_cost); } if(central_row >= row_dist){ - int_t add_cost = C.width * std::abs(static_cast(central_row - row_dist) * static_cast(row_height) + y_orig - C.y_pos); + int_t add_cost = C.width * std::abs((float)static_cast(central_row - row_dist) * static_cast(row_height) + y_orig - C.y_pos); check_row_cost(central_row - row_dist, C, add_cost); } } @@ -252,7 +252,7 @@ std::vector good_legalize( int_t region_end = it != obstacles[r].rend() ? it->min_x : x_max; if(region_end >= prev_it->max_x + cell.width){ int_t loc_x = std::min(region_end - cell.width, std::max(prev_it->max_x, cell.x_pos)); - int_t loc_cost = cell.width * std::abs(cell.x_pos - loc_x); + int_t loc_cost = cell.width * std::abs((float)(cell.x_pos - loc_x)); if(not found_here or cur_cost > loc_cost){ found_here = true; cur_cost = loc_cost; @@ -287,11 +287,11 @@ std::vector good_legalize( ++row_dist ){ if(central_row + row_dist < nbr_rows - C.nbr_rows){ - int_t add_cost = C.width * std::abs(static_cast(central_row + row_dist) * static_cast(row_height) + y_orig - C.y_pos); + int_t add_cost = C.width * std::abs((float)static_cast(central_row + row_dist) * static_cast(row_height) + y_orig - C.y_pos); check_row_cost(central_row + row_dist, C, add_cost); } if(central_row >= row_dist){ - int_t add_cost = C.width * std::abs(static_cast(central_row - row_dist) * static_cast(row_height) + y_orig - C.y_pos); + int_t add_cost = C.width * std::abs((float)static_cast(central_row - row_dist) * static_cast(row_height) + y_orig - C.y_pos); check_row_cost(central_row - row_dist, C, add_cost); } } diff --git a/coloquinte/src/optimization_subproblems.cxx b/coloquinte/src/optimization_subproblems.cxx index 92a26f68..38872344 100644 --- a/coloquinte/src/optimization_subproblems.cxx +++ b/coloquinte/src/optimization_subproblems.cxx @@ -51,7 +51,7 @@ std::vector transport_1D(std::vector sources, std::vector< auto get_slope = [&](index_t src, index_t boundary){ assert(boundary+1 < sinks.size()); assert(src < sources.size()); - return std::abs(sources[src].first - sinks[boundary+1].first) - std::abs(sources[src].first - sinks[boundary].first); + return std::abs((float)(sources[src].first - sinks[boundary+1].first)) - std::abs((float)(sources[src].first - sinks[boundary].first)); }; capacity_t cur_abs_pos = min_abs_pos; diff --git a/coloquinte/src/piecewise_linear.cxx b/coloquinte/src/piecewise_linear.cxx index c422354e..84130cda 100644 --- a/coloquinte/src/piecewise_linear.cxx +++ b/coloquinte/src/piecewise_linear.cxx @@ -2,6 +2,7 @@ #include "coloquinte/piecewise_linear.hxx" #include +#include namespace coloquinte{ diff --git a/coloquinte/src/solvers.cxx b/coloquinte/src/solvers.cxx index 6838d85e..57f0fbc1 100644 --- a/coloquinte/src/solvers.cxx +++ b/coloquinte/src/solvers.cxx @@ -3,6 +3,7 @@ #include #include +#include namespace coloquinte{ namespace gp{ diff --git a/coloquinte/src/topologies.cxx b/coloquinte/src/topologies.cxx index 1fefe579..20c944a2 100644 --- a/coloquinte/src/topologies.cxx +++ b/coloquinte/src/topologies.cxx @@ -7,6 +7,8 @@ #include #include #include +#include +#include namespace coloquinte{ using edge_t = std::pair; @@ -44,7 +46,7 @@ int_t Hconnectivity::get_wirelength(std::array, pin_cnt> c } int_t cost = sorted_points.back().x - sorted_points.front().x + sorted_points[b_con+1].x - sorted_points[e_con+1].x; for(std::uint8_t const E : connexions){ - cost += std::abs(sorted_points[(E >> 4) +1].x - sorted_points[(E & 15u) +1].x); + cost += std::abs((float)(sorted_points[(E >> 4) +1].x - sorted_points[(E & 15u) +1].x)); } for(index_t i=0; i > const & points, } std::int64_t cost = 0; for(edge_t const E : Htopo){ - cost += std::abs(points[E.first].x - points[E.second].x); + cost += std::abs((float)(points[E.first].x - points[E.second].x)); } for(index_t i=0; i > get_MST_topology(std::vector a, point b){ return std::abs(a.x - b.x) + std::abs(a.y - b.y); }; + auto D = [](point a, point b){ return (int_t)(std::abs((float)(a.x - b.x)) + std::abs((float)(a.y - b.y))); }; auto dists = std::array({D(pins[1], pins[2]), D(pins[1], pins[2]), D(pins[0], pins[1])}); index_t mx = std::max_element(dists.begin(), dists.end()) - dists.begin(); for(index_t i=0; i<3; ++i){ @@ -420,7 +422,7 @@ std::vector > get_MST_topology(std::vector p1 = pins[E.first], p2 = pins[E.second]; - return std::abs(p1.x - p2.x) + std::abs(p1.y - p2.y); + return std::abs((float)(p1.x - p2.x)) + std::abs((float)(p1.y - p2.y)); }; // Perform Kruskal to get the tree std::sort(edges.begin(), edges.end(), [&](edge_t a, edge_t b){ return edge_length(a) < edge_length(b); }); @@ -444,8 +446,8 @@ std::int64_t MST_length(std::vector > const & pins){ auto edges = get_MST_topology(pins); std::int64_t sum = 0; for(auto E : edges){ - sum += std::abs(pins[E.first].x - pins[E.second].x); - sum += std::abs(pins[E.first].y - pins[E.second].y); + sum += std::abs((float)(pins[E.first].x - pins[E.second].x)); + sum += std::abs((float)(pins[E.first].y - pins[E.second].y)); } return sum; } @@ -454,7 +456,7 @@ std::int64_t RSMT_length(std::vector > const & pins, index_t exacti assert(exactitude_limit <= 10 and exactitude_limit >= 3); if(pins.size() <= 3){ if(pins.size() == 2){ - return std::abs(pins[0].x - pins[1].x) + std::abs(pins[0].y - pins[1].y); + return std::abs((float)(pins[0].x - pins[1].x)) + std::abs((float)(pins[0].y - pins[1].y)); } else if(pins.size() == 3){ auto minmaxX = std::minmax_element(pins.begin(), pins.end(), [](point a, point b){ return a.x < b.x; }), diff --git a/crlcore/src/LibraryManager/CMakeLists.txt b/crlcore/src/LibraryManager/CMakeLists.txt index 788e7908..497e6ca3 100644 --- a/crlcore/src/LibraryManager/CMakeLists.txt +++ b/crlcore/src/LibraryManager/CMakeLists.txt @@ -5,6 +5,7 @@ ${CRLCORE_SOURCE_DIR}/src/ccore/bookshelf ${CRLCORE_SOURCE_DIR}/src/ccore/alliance/ap ${CRLCORE_SOURCE_DIR}/src/ccore/alliance/vst + ${Boost_INCLUDE_DIRS} ${CONFIGURATION_INCLUDE_DIR} ${HURRICANE_INCLUDE_DIR} ) diff --git a/hurricane/src/hurricane/hurricane/Observer.h b/hurricane/src/hurricane/hurricane/Observer.h index f08dd0c7..a02273ee 100644 --- a/hurricane/src/hurricane/hurricane/Observer.h +++ b/hurricane/src/hurricane/hurricane/Observer.h @@ -18,6 +18,7 @@ #define HURRICANE_OBSERVER_H #include +#include #include "hurricane/Error.h" diff --git a/hurricane/src/isobar/CMakeLists.txt b/hurricane/src/isobar/CMakeLists.txt index 43ae1e09..70a2273d 100644 --- a/hurricane/src/isobar/CMakeLists.txt +++ b/hurricane/src/isobar/CMakeLists.txt @@ -4,6 +4,7 @@ include_directories( ${HURRICANE_SOURCE_DIR}/src/hurricane ${HURRICANE_SOURCE_DIR}/src/viewer ${HURRICANE_SOURCE_DIR}/src/isobar + ${Boost_INCLUDE_DIRS} ${CONFIGURATION_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH} )