Skip to content

Commit

Permalink
initialize structure to support fixed script #3
Browse files Browse the repository at this point in the history
  • Loading branch information
abdelrahmanhosny committed Jan 11, 2020
1 parent c39d8c7 commit 6175eb6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": ".venv/bin/python"
}
14 changes: 11 additions & 3 deletions drills.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import numpy as np
import time
from drills.model import A2C
from drills.fixed_optimization import optimize_with_fixed_script
from pyfiglet import Figlet

def log(message):
Expand All @@ -29,8 +30,12 @@ def add_usage(self, usage, actions, groups, prefix=None):
description='Performs logic synthesis optimization using RL')
parser._positionals.title = 'Positional arguments'
parser._optionals.title = 'Optional arguments'
parser.add_argument('-v', '--version', action='version', version = 'DRiLLS v0.1', help = "Shows program's version number and exit")
parser.add_argument("-l", "--load_model", action='store_true', help="Loads a saved Tensorflow model")
parser.add_argument('-v', '--version', action='version', \
version = 'DRiLLS v0.1', help="Shows program's version number and exit")
parser.add_argument("-l", "--load_model", action='store_true', \
help="Loads a saved Tensorflow model")
parser.add_argument("-s", "--fixed_script", type=open, \
help="Executes a fixed optimization script before DRiLLS")
parser.add_argument("mode", type=str, choices=['train', 'optimize'], \
help="Use the design to train the model or only optimize it")
parser.add_argument("mapping", type=str, choices=['scl', 'fpga'], \
Expand All @@ -44,6 +49,9 @@ def add_usage(self, usage, actions, groups, prefix=None):
f = Figlet(font='slant')
print(f.renderText('DRiLLS'))

if args.fixed_script:
params = optimize_with_fixed_script(params, args.fixed_script)

if args.mapping == 'scl':
fpga_mapping = False
else:
Expand Down Expand Up @@ -72,5 +80,5 @@ def add_usage(self, usage, actions, groups, prefix=None):
log('Starting agent to optimize')
learner = A2C(options, load_model=True)
for _ in range(options['iterations']):
# to be completed
# TODO: iteratively run the optimizer
pass
17 changes: 17 additions & 0 deletions drills/fixed_optimization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/python3

# Copyright (c) 2019, SCALE Lab, Brown University
# All rights reserved.

# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

def optimize_with_fixed_script(params, fixed_script_file):
"""
Optimizes the design with the fixed script and writes down a new design file
"""
optimized_design_file = None
# TODO: run an scl session with the fixed script.

params.design_file = optimized_design_file
return params

0 comments on commit 6175eb6

Please sign in to comment.