Skip to content

Commit aa12017

Browse files
committed
Merge branch 'master' into secure-repair_antennas
Signed-off-by: Eder Monteiro <[email protected]>
2 parents c8b3b3b + 636e3d5 commit aa12017

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1175
-389
lines changed

bazel/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# OpenROAD-flow-scripts and Bazel integration
2+
3+
`bazel-orfs` is a Bazel package containing the definitions and logic governing the build process of ORFS designs.
4+
The module uses the `openroad/orfs` docker image to extract the flow scripts with dependencies, builds the Bazel environment around them and defines the methods of calling the ORFS Makefiles with selected designs.
5+
6+
## Run examples
7+
8+
`flow/BUILD.bazel` contains definitions for various flows to serve as examples.
9+
10+
It is recommended to run the utility [Bazelisk](https://github.com/bazelbuild/bazelisk) to manage the version of `bazel` installed on the system.
11+
Details on installation can be found in the `bazel-orfs` [README](https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#requirements)
12+
13+
The flow can be ran with the following call structure:
14+
15+
```bash
16+
bazel build <target_name>_<stage_name>
17+
```
18+
19+
For example, to run the stage `final`, along with all the dependent stages, call:
20+
```bash
21+
bazel build gcd_final
22+
```
23+
24+
Details on usage and defining of the flows are presented in the Usage section of the `bazel-orfs` [README](https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#usage)
25+
26+
## Dependency version management
27+
28+
In the flow scipts, the `bazel-orfs` version is defined as
29+
30+
```starlark
31+
bazel_dep(name = "bazel-orfs")
32+
git_override(
33+
module_name = "bazel-orfs",
34+
commit = "<Hash of the default bazel-orfs commit>",
35+
remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
36+
)
37+
```
38+
However, as the referenced documentation shows, the git-based dependency can be overridden with a local repository.
39+
First, remove the `git_override` call entirely and replace it with a `local_path_override` call following this convention:
40+
41+
```starlark
42+
local_path_override(
43+
module_name = "bazel-orfs",
44+
path = "/replace/with/path/to/local/orfs/repository"
45+
)
46+
```
47+
48+
`bazel-orfs` sets a default version of the docker image used to create the Bazel environment.
49+
This selection can be overridden by a following snippet inserted below the `bazel-orfs` declaration and override.
50+
51+
```starlark
52+
orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
53+
orfs.default(
54+
image = "tag-name",
55+
sha256 = "the-hash",
56+
)
57+
```
58+
59+
Substitute `tag-name` with the tag of the version needed and `the-hash` with the digest corresponding to the selected tag (without the `sha256:` prefix).
60+

docker/Dockerfile.builder

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ COPY --link flow/platforms flow/platforms
3333
COPY --link flow/util flow/util
3434
COPY --link flow/scripts flow/scripts
3535
COPY --link flow/designs flow/designs
36+
COPY --link tools/AutoTuner tools/AutoTuner
3637

3738
COPY --link --from=orfs-builder-base /OpenROAD-flow-scripts/tools/install tools/install
3839
COPY --link \

docs/user/InstructionsForAutoTuner.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,16 @@ User-defined coefficient values (`coeff_perform`, `coeff_power`, `coeff_area`) o
2323

2424
## Setting up AutoTuner
2525

26-
To setup AutoTuner, make sure you have a virtual environment set up with
27-
Python 3.9.X. There are plenty of ways to do this, we recommend using
28-
[Miniconda](https://docs.conda.io/en/latest/miniconda.html),
29-
which is a free minimal installer for the package manager `conda`.
26+
We have provided two convenience scripts, `./install.sh` and `./setup.sh`
27+
that works in Python3.8 for installation and configuration of AutoTuner,
28+
as shown below:
3029

3130
```shell
32-
# set up conda environment
33-
conda create -n autotuner_env python=3.9
34-
conda activate autotuner_env
31+
# Install prerequisites
32+
./tools/AutoTuner/install.sh
3533

36-
# install requirements
37-
pip install -r ./tools/AutoTuner/requirements.txt
34+
# Start virtual environment
35+
./tools/AutoTuner/setup.sh
3836
```
3937

4038
## Input JSON structure
@@ -198,6 +196,15 @@ We show three different views possible at the end, namely: `Table View`, `Scatte
198196
![Parallel Coordinate View](../images/Autotuner_best_parameter_view.webp)
199197
<p style="text-align: center;">Parallel Coordinate View (best run is in green)</p>
200198

199+
## Testing framework
200+
201+
Assuming the virtual environment is setup at `./tools/AutoTuner/autotuner_env`:
202+
203+
```
204+
./tools/AutoTuner/setup.sh
205+
python3 ./tools/AutoTuner/test/smoke_test_sweep.py
206+
python3 ./tools/AutoTuner/test/smoke_test_tune.py
207+
```
201208

202209
## Citation
203210

etc/DependencyInstaller.sh

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ _installUbuntuPackages() {
126126
zlib1g-dev
127127

128128
# install KLayout
129-
if _versionCompare $1 -ge 23.04; then
129+
if [[ $1 == "rodete" ]]; then
130+
apt-get -y install --no-install-recommends klayout python3-pandas
131+
elif _versionCompare "$1" -ge 23.04; then
130132
apt-get -y install --no-install-recommends klayout python3-pandas
131133
else
132134
arch=$(uname -m)
@@ -160,6 +162,14 @@ _installUbuntuPackages() {
160162
rm -rf "${baseDir}"
161163
fi
162164

165+
if command -v docker &> /dev/null; then
166+
# The user can uninstall docker if they want to reinstall it,
167+
# and also this allows the user to choose drop in replacements
168+
# for docker, such as podman-docker
169+
echo "Docker is already installed, skip docker reinstall."
170+
return 0
171+
fi
172+
163173
# Add Docker's official GPG key:
164174
install -m 0755 -d /etc/apt/keyrings
165175
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
@@ -172,11 +182,13 @@ _installUbuntuPackages() {
172182
tee /etc/apt/sources.list.d/docker.list > /dev/null
173183

174184
apt-get -y update
175-
apt-get -y install --no-install-recommends \
176-
docker-ce \
177-
docker-ce-cli \
178-
containerd.io \
179-
docker-buildx-plugin
185+
if [[ $1 != "rodete" ]]; then
186+
apt-get -y install --no-install-recommends \
187+
docker-ce \
188+
docker-ce-cli \
189+
containerd.io \
190+
docker-buildx-plugin
191+
fi
180192
}
181193

182194
_installDarwinPackages() {
@@ -315,8 +327,11 @@ case "${os}" in
315327
_installCommon
316328
fi
317329
;;
318-
"Ubuntu" )
330+
"Ubuntu" | "Debian GNU/Linux rodete" )
319331
version=$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release | sed 's/"//g')
332+
if [[ -z ${version} ]]; then
333+
version=$(awk -F= '/^VERSION_CODENAME/{print $2}' /etc/os-release | sed 's/"//g')
334+
fi
320335
if [[ ${CI} == "yes" ]]; then
321336
echo "Installing CI Tools"
322337
_installCI
@@ -327,7 +342,9 @@ case "${os}" in
327342
_installUbuntuCleanUp
328343
fi
329344
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
330-
if _versionCompare ${version} -lt 23.04 ; then
345+
if [[ $version == "rodete" ]]; then
346+
echo "Skip common for rodete"
347+
elif _versionCompare ${version} -lt 23.04 ; then
331348
_installCommon
332349
fi
333350
fi

flow/.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build --incompatible_strict_action_env
2+
try-import %workspace%/.user-bazelrc

flow/.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.2.1

0 commit comments

Comments
 (0)