Skip to content

Commit

Permalink
add Dockerfile for Synopsys HSPICE
Browse files Browse the repository at this point in the history
  • Loading branch information
limerainne committed Dec 19, 2018
1 parent ca1298e commit 436422e
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 5 deletions.
76 changes: 76 additions & 0 deletions Dockerfile_Synopsys_HSPICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
FROM ubuntu:18.04 AS installer
ARG repo_sed=s#://archive.ubuntu.com#://kr.archive.ubuntu.com#g

# 'cshell' is required to run the installer
RUN sed -i -e "${repo_sed}" /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends csh \
&& rm -rf /var/lib/apt/lists/*

# information of the tool to be installed in this image
# TODO how to deduplicate below arguments declaration
ARG base_dir=/usr/synopsys
ARG tool=hspice
ARG version=N-2017.12

ARG installer_version=v4.1


# copy installer and installation package temporarily
COPY package/installer_${installer_version} /tmp/installer/
COPY package/${tool}_v${version} /tmp/package/

# batch install target package
RUN mkdir -p ${base_dir} \
&& /tmp/installer/SynopsysInstaller_${installer_version}.run -dir ${base_dir}/installer_${installer_version} \
&& echo 'yes' | USER=docker ${base_dir}/installer_${installer_version}/batch_installer -install_as_root -source /tmp/package/ -target ${base_dir}/ -allprods \
&& rm -rf /tmp/package/ \
&& rm -rf /tmp/installer/ \
&& rm -rf ${base_dir}/installer_${installer_version}


# NOTE using multi-stage image build; avoid including installer package in the final image
FROM ubuntu:18.04
ARG repo_sed=s#://archive.ubuntu.com#://kr.archive.ubuntu.com#g

# install required library to run Synopsys tool and X11 library to show GUI
# NOTE HSPICE requires libxml2 also
RUN sed -i -e "${repo_sed}" /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
csh libxss1 libsm6 libice6 libxft2 libjpeg62 libtiff5 libmng2 libxml2\
&& apt-get install -y --no-install-recommends xserver-xorg-video-dummy xserver-xorg-input-void xserver-xorg-core xinit x11-xserver-utils \
&& echo "deb http://security.ubuntu.com/ubuntu xenial-security main" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y -t xenial libpng12-0 \
&& rm -rf /var/lib/apt/lists/*
# # using somewhat lighter X11 package rather than xorg; 'x11-apps' is not applicable
# ref: https://git.devuan.org/dev1fanboy/Upgrade-Install-Devuan/wikis/minimal-xorg-install
# # WORKAROUND install libpng12-0 package from Xenial, which is removed from Bionic
# ref: https://www.linuxuprising.com/2018/05/fix-libpng12-0-missing-in-ubuntu-1804.html

# WORKAROUND link outdated library files required from Synopsys tools
# WORKAROUND set default shell as Bash to avoid error from script included in the tool
RUN ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.5 /usr/lib/x86_64-linux-gnu/libtiff.so.3 \
&& ln -s /usr/lib/x86_64-linux-gnu/libmng.so.2 /usr/lib/x86_64-linux-gnu/libmng.so.1 \
&& update-alternatives --install /bin/sh sh /bin/bash 20

# WORKAROUND Ubuntu 18.04 does not have terminfo files in /usr/share/terminfo/
RUN cp -r /lib/terminfo/. /usr/share/terminfo/

# copy actual tool to be run in this image
ARG base_dir=/usr/synopsys
ARG tool=hspice
ARG version=N-2017.12


# just copy installed package from intermediate image
COPY --from=installer ${base_dir}/ ${base_dir}/

# set path to the tool executable
# NOTE HSPICE has different path to executable
ENV PATH ${base_dir}/${tool}/${version}/hspice/bin:$PATH

# default command when running this image
CMD "hspice" -I

16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# [WIP] Dockerize scripts for commercial EDA tools

I don't think dockerizing EDA tools is somewhat useful or not, but here is the `Dockerfile`s for dockerizing popular EDA tools!
I don't know which possibilities can bear from dockerizing EDA tools, but here is the `Dockerfile`s to dockerize popular EDA tools!

## Tried packages
- Synosys
- Design Compiler (DC)
- IC Compiler (ICC)
- VCS (RTL Simulator)
- HSPICE
- Cadence
- Incisive (NCSim)
- Virtuoso (IC)
Expand All @@ -16,7 +18,8 @@ I don't think dockerizing EDA tools is somewhat useful or not, but here is the `
- (you should not upload image containing commeiclal tool to public docker registry, of course ;-) )
- Intermediate image does not removed automatically, you have to remove by yourself for now. (see below)
- How can we run docker container with unpriviledged permission?
- [Singularity](https://www.sylabs.io) could be a solution, but currently I failed to use that tool.
- Currently, there is nothing to drop root priviledge in `Dockerfile`s
- [Singularity](https://www.sylabs.io) could be a solution.

## Prerequisites
- Docker 17.05+ (this script uses multi-stage build feature)
Expand All @@ -27,7 +30,7 @@ I don't think dockerizing EDA tools is somewhat useful or not, but here is the `

- First, clone this repository to your workstation.
- Copy (or bind mount) installer and installation package to the subdirectory
- Refer to shell scripts for bind-mounting installation files from other path
- Refer to shell scripts for bind-mounting installation files from other path. Bind mount was used only for avoiding copy installation package to working path
- modify dockerfile to match with your tool version, your requirements, etc.
- Execute below command to create an image.
`$ sudo docker build -t <image_name>:<version> -f <Dockerfile> .`
Expand All @@ -39,8 +42,9 @@ $ sudo docker rmi <image_tag_you_want_to_remove>
```

## Launch a container
- Example container launching command
- Example command to run a container
- You should pass `LM_LICENSE_FILE` environment variable regarding your license server
- Consider bind mount your user directory
```bash
$ sudo docker run --rm -it -e LM_LICENSE_FILE="<port>@<license_server>" \
<image_name> [<command>]
Expand All @@ -58,8 +62,10 @@ $ sudo apt install csh libxss1 libsm6 libice6 libxft2 libjpeg62 libtiff5 libmng2
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.5 /usr/lib/x86_64-linux-gnu/libtiff.so.3
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libmng.so.2 /usr/lib/x86_64-linux-gnu/libmng.so.1
```
- `HSPICE` requires `libxml2` also!

- Ubuntu 18.04 requires additional treatments, because `libpng12-0` package was removed from that version
- manually download and install `libpng12-0` package, or add older source and install from that source like below:
- Manually download and install `libpng12-0` package, or add source of older releases and install package from that source like below:
```bash
$ sudo 'echo "deb http://security.ubuntu.com/ubuntu xenial-security main" >> /etc/apt/sources.list'
$ sudo apt update
Expand Down

0 comments on commit 436422e

Please sign in to comment.