Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
macroplacement
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
macroplacement
Commits
36623716
Commit
36623716
authored
Jan 16, 2023
by
ZhiangWang033
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add file
Signed-off-by: ZhiangWang033 <zhw033@ucsd.edu>
parent
a04eedcc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
10 deletions
+15
-10
CodeElements/SimulatedAnnealing/src/main.cpp
+2
-1
CodeElements/SimulatedAnnealing/src/plc_netlist.h
+2
-1
CodeElements/SimulatedAnnealing/src/plc_netlist_sa.cpp
+11
-8
No files found.
CodeElements/SimulatedAnnealing/src/main.cpp
View file @
36623716
...
...
@@ -35,10 +35,11 @@ int main(int argc, char* argv[]) {
PBFNetlist
design
(
netlist_file
);
std
::
string
new_netlist_file
=
run_dir
+
"/"
+
design_name
+
".pb.txt.final"
;
std
::
string
new_plc_file
=
run_dir
+
"/"
+
design_name
+
".plc.final"
;
std
::
string
sa_plc_file
=
run_dir
+
"/"
+
design_name
;
design
.
RestorePlacement
(
plc_file
);
auto
start_timestamp_global
=
std
::
chrono
::
high_resolution_clock
::
now
();
design
.
SimulatedAnnealing
(
action_probs
,
num_actions
,
max_temperature
,
num_iters
,
seed
,
spiral_flag
,
summary_file
);
num_iters
,
seed
,
spiral_flag
,
summary_file
,
sa_plc_file
);
//design.CalcCost();
auto
end_timestamp_global
=
std
::
chrono
::
high_resolution_clock
::
now
();
double
total_global_time
...
...
CodeElements/SimulatedAnnealing/src/plc_netlist.h
View file @
36623716
...
...
@@ -58,7 +58,8 @@ class PBFNetlist {
unsigned
int
num_iters
,
int
seed
,
bool
spiral_flag
,
std
::
string
summary_file
);
std
::
string
summary_file
,
std
::
string
plc_file
);
// calculate the cost
float
CalcCost
(
bool
debug_mode
=
false
);
...
...
CodeElements/SimulatedAnnealing/src/plc_netlist_sa.cpp
View file @
36623716
...
...
@@ -424,7 +424,8 @@ void PBFNetlist::SimulatedAnnealing(std::vector<float> action_probs,
unsigned
int
num_iters
,
int
seed
,
bool
spiral_flag
,
std
::
string
summary_file
)
{
std
::
string
summary_file
,
std
::
string
plc_file
)
{
// Initialization
action_probs_
=
action_probs
;
for
(
size_t
i
=
1
;
i
<
action_probs_
.
size
();
i
++
)
...
...
@@ -451,17 +452,17 @@ void PBFNetlist::SimulatedAnnealing(std::vector<float> action_probs,
const
float
t_factor
=
std
::
log
(
t_min
/
max_temperature
);
float
t
=
max_temperature
;
float
cur_cost
=
0.0
;
float
min_cost
=
0.0
;
std
::
vector
<
float
>
cost_list
;
// we need to plot the cost curve
CallFDPlacer
();
cur_cost
=
CalcCost
();
min_cost
=
cur_cost
;
std
::
ofstream
f
;
f
.
open
(
summary_file
);
f
.
close
();
for
(
int
num_iter
=
0
;
num_iter
<
num_iters
;
num_iter
++
)
{
// call FDPlacer to update the cost
CallFDPlacer
();
cur_cost
=
CalcCost
();
for
(
int
step
=
0
;
step
<
N
;
step
++
)
{
if
(
Action
()
==
true
)
{
const
float
new_cost
=
CalcCostIncr
(
false
);
...
...
@@ -477,13 +478,15 @@ void PBFNetlist::SimulatedAnnealing(std::vector<float> action_probs,
}
cost_list
.
push_back
(
cur_cost
);
}
if
((
num_iter
+
1
)
%
5
==
0
)
{
CallFDPlacer
();
cur_cost
=
CalcCost
();
if
((
num_iter
+
1
)
%
100
==
0
)
{
f
.
open
(
summary_file
,
std
::
ios
::
out
|
std
::
ios
::
app
);
for
(
auto
&
value
:
cost_list
)
f
<<
value
<<
std
::
endl
;
f
.
close
();
cost_list
.
clear
();
cost_list
.
clear
();
WritePlcFile
(
plc_file
+
"_step_"
+
std
::
to_string
(
num_iter
+
1
)
+
"_cost_"
+
std
::
to_string
(
cur_cost
)
+
".plc"
);
}
// update the temperature
t
=
max_temperature
*
std
::
exp
(
t_factor
*
num_iter
/
num_iters
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment