Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/mpl/src/SACoreSoftMacro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "SACoreSoftMacro.h"

#include <boost/random/uniform_int_distribution.hpp>
#include <vector>

#include "MplObserver.h"
Expand Down Expand Up @@ -748,8 +749,17 @@ void SACoreSoftMacro::calNotchPenalty()

void SACoreSoftMacro::resizeOneCluster()
{
const int idx = static_cast<int>(
std::floor(distribution_(generator_) * pos_seq_.size()));
if (pos_seq_.empty()) {
logger_->error(
utl::MPL,
51,
"Position sequence array is empty, please report this internal error");
}

boost::random::uniform_int_distribution<> index_distribution(
0, pos_seq_.size() - 1);
const int idx = index_distribution(generator_);

macro_id_ = idx;
SoftMacro& src_macro = macros_[idx];
if (src_macro.isMacroCluster()) {
Expand Down
10 changes: 7 additions & 3 deletions src/mpl/src/SimulatedAnnealingCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "SimulatedAnnealingCore.h"

#include <boost/random/uniform_int_distribution.hpp>
#include <fstream>
#include <iostream>
#include <vector>
Expand Down Expand Up @@ -642,11 +643,14 @@ void SimulatedAnnealingCore<T>::exchangeMacros()
template <class T>
void SimulatedAnnealingCore<T>::generateRandomIndices(int& index1, int& index2)
{
index1 = (int) (std::floor(distribution_(generator_) * pos_seq_.size()));
index2 = (int) (std::floor(distribution_(generator_) * pos_seq_.size()));
boost::random::uniform_int_distribution<> index_distribution(
0, pos_seq_.size() - 1);

index1 = index_distribution(generator_);
index2 = index_distribution(generator_);

while (index1 == index2) {
index2 = (int) (std::floor(distribution_(generator_) * pos_seq_.size()));
index2 = index_distribution(generator_);
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/mpl/src/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#include "object.h"

#include <boost/random/uniform_int_distribution.hpp>
#include <vector>

#include "utl/Logger.h"
Expand Down Expand Up @@ -1298,8 +1299,11 @@ void SoftMacro::resizeRandomly(
if (width_list_.empty()) {
return;
}
const int idx = static_cast<int>(
std::floor(distribution(generator) * width_list_.size()));

boost::random::uniform_int_distribution<> index_distribution(
0, width_list_.size() - 1);
const int idx = index_distribution(generator);

const float min_width = width_list_[idx].first;
const float max_width = width_list_[idx].second;
width_ = min_width + distribution(generator) * (max_width - min_width);
Expand Down
800 changes: 400 additions & 400 deletions src/mpl/test/guides1.defok

Large diffs are not rendered by default.

800 changes: 400 additions & 400 deletions src/mpl/test/io_constraints1.defok

Large diffs are not rendered by default.

802 changes: 401 additions & 401 deletions src/mpl/test/io_constraints2.defok

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/par/src/Multilevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "Multilevel.h"

#include <algorithm>
#include <boost/random/uniform_int_distribution.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <functional>
#include <limits>
Expand Down Expand Up @@ -303,7 +304,8 @@ void MultilevelPartitioner::InitialPartition(
"Running Initial Partitioning...");
std::mt19937 gen;
gen.seed(seed_);
std::uniform_real_distribution<> dist(0.0, 1.0);
boost::random::uniform_int_distribution<> dist(
0, std::numeric_limits<int>::max());
std::vector<float> initial_solutions_cost;
std::vector<bool>
initial_solutions_flag; // if the solutions statisfy balance constraint
Expand All @@ -319,7 +321,7 @@ void MultilevelPartitioner::InitialPartition(
k_way_fm_refiner_->SetMaxMove(hgraph->GetNumVertices());
// generate random seed
for (int i = 0; i < num_initial_random_solutions_; ++i) {
const int seed = std::numeric_limits<int>::max() * dist(gen);
const int seed = dist(gen);
auto& solution = initial_solutions[i];
// call random partitioning
partitioner_->SetRandomSeed(seed);
Expand Down Expand Up @@ -347,7 +349,7 @@ void MultilevelPartitioner::InitialPartition(
}
// generate random vile solution
for (int i = 0; i < num_initial_random_solutions_; ++i) {
const int seed = std::numeric_limits<int>::max() * dist(gen);
const int seed = dist(gen);
auto& solution = initial_solutions[i + num_initial_random_solutions_];
// call random partitioning
partitioner_->SetRandomSeed(seed);
Expand Down
4 changes: 2 additions & 2 deletions src/par/test/partition_gcd.ok
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Display Timing Path Cuts Statistics
Total number of timing-noncritical paths = 51
The worst number of cuts on timing-critical paths = 1
The average number of cuts on timing-critical paths = 1
Total number of timing-noncritical to timing critical paths = 32
Total number of timing-noncritical to timing critical paths = 30
The worst number of cuts on timing-non2critical paths = 2
The average number of cuts on timing-non2critical paths = 1.28125
The average number of cuts on timing-non2critical paths = 1.3
[INFO PAR-0001] Writing partition to verilog.
No differences found.
No differences found.
18 changes: 9 additions & 9 deletions src/par/test/partition_gcd.partok
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ req_msg[6] 0
req_msg[7] 0
req_msg[8] 1
req_msg[9] 1
req_rdy 0
req_rdy 1
req_val 1
reset 1
resp_msg[0] 0
Expand All @@ -48,7 +48,7 @@ resp_msg[4] 0
resp_msg[5] 0
resp_msg[6] 0
resp_msg[7] 0
resp_msg[8] 1
resp_msg[8] 0
resp_msg[9] 1
resp_rdy 1
resp_val 1
Expand Down Expand Up @@ -167,12 +167,12 @@ _508_ 1
_509_ 1
_510_ 1
_511_ 1
_512_ 1
_512_ 0
_513_ 0
_514_ 1
_515_ 1
_516_ 1
_517_ 1
_517_ 0
_518_ 0
_519_ 0
_520_ 0
Expand All @@ -187,8 +187,8 @@ _528_ 0
_529_ 0
_530_ 1
_531_ 0
_532_ 0
_533_ 0
_532_ 1
_533_ 1
_534_ 0
_535_ 0
_536_ 0
Expand Down Expand Up @@ -269,7 +269,7 @@ _610_ 0
_611_ 0
_612_ 0
_613_ 0
_614_ 1
_614_ 0
_615_ 0
_616_ 0
_617_ 0
Expand Down Expand Up @@ -353,7 +353,7 @@ _694_ 1
_695_ 0
_696_ 0
_697_ 0
_698_ 0
_698_ 1
_699_ 0
_700_ 0
_701_ 0
Expand All @@ -380,7 +380,7 @@ _721_ 0
_722_ 0
_723_ 0
_724_ 0
_725_ 0
_725_ 1
_726_ 0
_727_ 0
_728_ 0
Expand Down
Loading