File size: 4,523 Bytes
d59bb1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Build from sources using Docker

## Prerequisites

- For this method you only need to install
[Docker](https://docs.docker.com/engine/install) on your machine.
- Ensure that you have sufficient memory allocated to the Virtual Machine (VM)
as per our system [requirements](../index.md#system-requirements). Refer to
this [Docker guide](https://docs.docker.com/config/containers/resource_constraints/) for setting CPU cores and memory limits.

:::{Warning}
The `build_openroad.sh` will use the host number of CPUs to compile `openroad`.

Please check your Docker daemon setup to make sure all host CPUs are
available. If you are not sure, you can check with the command below. If
the output number is different from the number of CPUs from your machine,
then is recommended that you restrict the number of CPUs used by the scripts
(see instructions below).
:::

``` shell
docker run --rm ubuntu:22.04 nproc
```

### Build Using Docker from pre-built binaries

Courtesy of [Precision Innovations](https://precisioninno.com/),
they release `.deb` installers of OpenROAD for Ubuntu
and Debian on a regular basis.
This greatly helps to reduce the compilation time needed.

We recommend to use a Docker image of a supported OS
and install OpenROAD using the pre-built binaries from
Precision Innovations. 
You can start the container in an interactive mode using 
the command below. 

```shell
docker run -it ubuntu:22.04
```

Now you are ready to install the prebuilt binaries.
Please refer to the instructions for installing prebuilt binaries
[here](./BuildWithPrebuilt.md).

### Build Using Docker from sources

Alternatively, if you would like the latest commits from the OpenROAD repositories,
do follow the instructions below.


#### Clone and Build

The following instructions build the docker image with Ubuntu 22.04 as the base OS:


``` shell
git clone --recursive https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts
cd OpenROAD-flow-scripts
./build_openroad.sh
```

You can restrict the number of CPUs with the `-t|--threads N` argument:

``` shell
./build_openroad.sh --threads N
```

## Verify Installation

The binaries are only available from inside a Docker container. Here is an example of starting a container from the created Docker image.

``` shell
docker run --rm -it -u $(id -u ${USER}):$(id -g ${USER}) -v $(pwd)/flow:/OpenROAD-flow-scripts/flow openroad/flow-ubuntu22.04-builder
```

Then, inside docker:

``` shell
source ./env.sh
yosys -help
openroad -help
cd flow
make
exit
```

Alternatively you may also use the `docker_shell` utility as follows.
It is important that you are in the `flow` directory. 

```shell
cd flow
util/docker_shell make
```

## Enable GUI support

To use the GUI feature you will need to start the docker with the
following command,

For Ubuntu/Debian OS users:

```
docker run --rm -it \
           -u $(id -u ${USER}):$(id -g ${USER}) \
           -v $(pwd)/flow:/OpenROAD-flow-scripts/flow \
           -e DISPLAY=${DISPLAY} \
           -v /tmp/.X11-unix:/tmp/.X11-unix \
           -v ${HOME}/.Xauthority:/.Xauthority \
           --network host \
           --security-opt seccomp=unconfined \
           openroad/flow-$OS_NAME-builder
```

Running GUI with Docker on Mac OS X users, refer [here](https://cntnr.io/running-guis-with-docker-on-mac-os-x-a14df6a76efc).

Then use:

```
docker run --rm -it -e DISPLAY=<IP_LIKE_FROM_TUTORIAL>:0 --network host --privileged <IMAGE_NAME>
```

Alternatively, you may also use the `docker_shell` utility for GUI as follows. 
It is important that you are in the `flow` directory. 

```shell
cd flow
util/docker_shell gui_final
```

```{note}
`docker_shell` is a helpful utility to automate the 
aforementioned Docker commands using the user's parameters. 
Do refer to the documentation [here](./DockerShell.md).
```

## Build Docker Image for Different OS

The following instructions build the docker image with a parameterized OS
in two stages. These are for CI and developers that wish to use an OS other
than Ubuntu 22.04; regular users should use the steps from previous sections.
The dev stage installs all dependencies and packages required to run OpenROAD
and OpenROAD Flow Scripts. The build stage generates all binaries needed to run
the flow (i.e., `openroad` and `yosys`).

``` shell
git clone --recursive https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts
cd OpenROAD-flow-scripts
./etc/DockerHelper.sh create -target=dev -os=$OS_NAME
./etc/DockerHelper.sh create -target=builder -os=$OS_NAME
```