Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Rovinski <rovinski@users.noreply.github.com>
  • Loading branch information
rovinski authored Sep 13, 2024
2 parents 15f751c + 3eff2c7 commit bce80f5
Show file tree
Hide file tree
Showing 82 changed files with 80,576 additions and 53,318 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git
build*
Dockerfile
etc/openroad_deps_prefixes.txt
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ debug/

coverage-output
.metals/

etc/openroad_deps_prefixes.txt
3 changes: 2 additions & 1 deletion docker/Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ FROM $fromImage

ARG compiler=gcc
ARG numThreads=$(nproc)
ARG depsPrefixFile="/etc/openroad_deps_prefixes.txt"
ARG LOCAL_PATH=""

COPY . /OpenROAD
WORKDIR /OpenROAD
ENV PATH=${LOCAL_PATH}:${PATH}
RUN ./etc/Build.sh -compiler=${compiler} -threads=${numThreads}
RUN ./etc/Build.sh -compiler=${compiler} -threads=${numThreads} -deps-prefixes-file=${depsPrefixFile}
35 changes: 32 additions & 3 deletions etc/Build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

set -euo pipefail

cd "$(dirname $(readlink -f $0))/../"
DIR="$(dirname $(readlink -f $0))"
cd "$DIR/../"

# default values, can be overwritten by cmdline args
buildDir="build"
Expand All @@ -19,6 +20,7 @@ EOF
fi
cmakeOptions=""
cleanBefore=no
depsPrefixesFile=""
keepLog=no
compiler=gcc

Expand All @@ -30,7 +32,7 @@ OPTIONS:
-cmake='-<key>=<value> [-<key>=<value> ...]' User defined cmake options
Note: use single quote after
-cmake= and double quotes if
<key> has muliple <values>
<key> has multiple <values>
e.g.: -cmake='-DFLAGS="-a -b"'
-compiler=COMPILER_NAME Compiler name: gcc or clang
Default: gcc
Expand All @@ -50,6 +52,11 @@ OPTIONS:
-keep-log Keep a compile log in build dir
-help Shows this message
-gpu Enable GPU to accelerate the process
-deps-prefixes-file=FILE File with CMake packages roots,
its content extends -cmake argument.
By default, "openroad_deps_prefixes.txt"
file from OpenROAD's "etc" directory
or from system "/etc".
EOF
exit "${1:-1}"
Expand Down Expand Up @@ -102,7 +109,15 @@ while [ "$#" -gt 0 ]; do
-threads=* )
numThreads="${1#*=}"
;;
-compiler | -cmake | -dir | -threads )
-deps-prefixes-file=*)
file="${1#-deps-prefixes-file=}"
if [[ ! -f "$file" ]]; then
echo "${file} does not exist" >&2
_help
fi
depsPrefixesFile="$file"
;;
-compiler | -cmake | -dir | -threads | -install | -deps-prefixes-file )
echo "${1} requires an argument" >&2
_help
;;
Expand All @@ -117,6 +132,20 @@ while [ "$#" -gt 0 ]; do
shift 1
done

if [[ -z "$depsPrefixesFile" ]]; then
if [[ -f "$DIR/openroad_deps_prefixes.txt" ]]; then
depsPrefixesFile="$DIR/openroad_deps_prefixes.txt"
elif [[ -f "/etc/openroad_deps_prefixes.txt" ]]; then
depsPrefixesFile="/etc/openroad_deps_prefixes.txt"
fi
fi
if [[ -f "$depsPrefixesFile" ]]; then
cmakeOptions+=" $(cat "$depsPrefixesFile")"
echo "[INFO] Using additional CMake parameters from $depsPrefixesFile"
else
echo "[INFO] Auto-generated prefix file does not exist - CMake will choose the dependencies automatically"
fi

case "${compiler}" in
"gcc" )
if [[ -f "/opt/rh/devtoolset-8/enable" ]]; then
Expand Down
77 changes: 59 additions & 18 deletions etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -euo pipefail

CMAKE_PACKAGE_ROOT_ARGS=""

_versionCompare() {
local a b IFS=. ; set -f
printf -v a %08d $1; printf -v b %08d $3
Expand All @@ -21,7 +23,7 @@ _equivalenceDeps() {
git clone --depth=1 -b "${yosysVersion}" --recursive https://github.com/YosysHQ/yosys
cd yosys
# use of no-register flag is required for some compilers,
# e.g., gcc and clang fron RHEL8
# e.g., gcc and clang from RHEL8
make -j $(nproc) PREFIX="${yosysPrefix}" ABC_ARCHFLAGS=-Wno-register
make install
) fi
Expand Down Expand Up @@ -127,6 +129,7 @@ _installCommonDev() {
else
echo "Swig already installed."
fi
CMAKE_PACKAGE_ROOT_ARGS+=" -D SWIG_ROOT=$(realpath $swigPrefix) "

# boost
boostPrefix=${PREFIX:-"/usr/local"}
Expand All @@ -143,6 +146,7 @@ _installCommonDev() {
else
echo "Boost already installed."
fi
CMAKE_PACKAGE_ROOT_ARGS+=" -D Boost_ROOT=$(realpath $boostPrefix) "

# eigen
eigenPrefix=${PREFIX:-"/usr/local"}
Expand All @@ -155,10 +159,11 @@ _installCommonDev() {
else
echo "Eigen already installed."
fi
CMAKE_PACKAGE_ROOT_ARGS+=" -D Eigen3_ROOT=$(realpath $eigenPrefix) "

# cudd
cuddPrefix=${PREFIX:-"/usr/local"}
if [[ ! -d ${cuddPrefix}/include/cudd.h ]]; then
if [[ ! -f ${cuddPrefix}/include/cudd.h ]]; then
cd "${baseDir}"
git clone --depth=1 -b ${cuddVersion} https://github.com/The-OpenROAD-Project/cudd.git
cd cudd
Expand Down Expand Up @@ -191,6 +196,7 @@ _installCommonDev() {
else
echo "Lemon already installed."
fi
CMAKE_PACKAGE_ROOT_ARGS+=" -D LEMON_ROOT=$(realpath $lemonPrefix) "

# spdlog
spdlogPrefix=${PREFIX:-"/usr/local"}
Expand All @@ -203,6 +209,7 @@ _installCommonDev() {
else
echo "spdlog already installed."
fi
CMAKE_PACKAGE_ROOT_ARGS+=" -D spdlog_ROOT=$(realpath $spdlogPrefix) "

# gtest
gtestPrefix=${PREFIX:-"/usr/local"}
Expand All @@ -217,6 +224,7 @@ _installCommonDev() {
else
echo "gtest already installed."
fi
CMAKE_PACKAGE_ROOT_ARGS+=" -D GTest_ROOT=$(realpath $gtestPrefix) "

if [[ ${equivalenceDeps} == "yes" ]]; then
_equivalenceDeps
Expand Down Expand Up @@ -264,23 +272,28 @@ _installOrTools() {
if [[ ! -z "${PREFIX}" ]]; then mkdir -p "${PREFIX}"; fi
cd "${baseDir}"

orToolsPath=${PREFIX:-"/opt/or-tools"}
if [ "$(uname -m)" == "aarch64" ]; then
# Disable exit on error for 'find' command, as it might return non zero
set +euo pipefail
LIST=($(find / -type f -name "libortools.so*" 2>/dev/null))
# Bring back exit on error
set -euo pipefail
if [ ${#LIST[@]} -eq 0 ]; then
echo "OR-TOOLS NOT FOUND"
echo "Installing OR-Tools for aarch64..."
git clone --depth=1 -b "v${orToolsVersionBig}" https://github.com/google/or-tools.git
cd or-tools
${cmakePrefix}/bin/cmake -S. -Bbuild -DBUILD_DEPS:BOOL=ON -DBUILD_EXAMPLES:BOOL=OFF -DBUILD_SAMPLES:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DCMAKE_INSTALL_PREFIX=${orToolsPath} -DCMAKE_CXX_FLAGS="-w" -DCMAKE_C_FLAGS="-w"
${cmakePrefix}/bin/cmake --build build --config Release --target install -v -j $(nproc)
else
# Disable exit on error for 'find' command, as it might return non zero
set +euo pipefail
LIST=($(find / -type f -name "libortools.so*" 2>/dev/null))
# Bring back exit on error
set -euo pipefail
# Return if right version of or-tools is installed
for lib in ${LIST[@]}; do
if [[ "$lib" =~ .*"/libortools.so.${orToolsVersionSmall}" ]]; then
echo "OR-Tools is already installed"
CMAKE_PACKAGE_ROOT_ARGS+=" -D ortools_ROOT=$(realpath $(dirname $lib)/..) "
return
fi
done

orToolsPath=${PREFIX:-"/opt/or-tools"}
if [ "$(uname -m)" == "aarch64" ]; then
echo "OR-TOOLS NOT FOUND"
echo "Installing OR-Tools for aarch64..."
git clone --depth=1 -b "v${orToolsVersionBig}" https://github.com/google/or-tools.git
cd or-tools
${cmakePrefix}/bin/cmake -S. -Bbuild -DBUILD_DEPS:BOOL=ON -DBUILD_EXAMPLES:BOOL=OFF -DBUILD_SAMPLES:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DCMAKE_INSTALL_PREFIX=${orToolsPath} -DCMAKE_CXX_FLAGS="-w" -DCMAKE_C_FLAGS="-w"
${cmakePrefix}/bin/cmake --build build --config Release --target install -v -j $(nproc)
else
if [[ $version == rodete ]]; then
version=11
Expand All @@ -295,6 +308,7 @@ _installOrTools() {
tar --strip 1 --dir ${orToolsPath} -xf ${orToolsFile}
rm -rf ${baseDir}
fi
CMAKE_PACKAGE_ROOT_ARGS+=" -D ortools_ROOT=$(realpath $orToolsPath) "
}

_installUbuntuCleanUp() {
Expand Down Expand Up @@ -571,7 +585,7 @@ EOF
fi
brew install bison boost cmake eigen flex fmt groff libomp or-tools pandoc pyqt5 python spdlog tcl-tk zlib

# Some systems neeed this to correclty find OpenMP package during build
# Some systems need this to correctly find OpenMP package during build
brew link --force libomp

# Lemon is not in the homebrew-core repo
Expand Down Expand Up @@ -725,6 +739,12 @@ Usage: $0
# like working around a firewall. This opens
# vulnerability to man-in-the-middle (MITM)
# attacks.
$0 -save-deps-prefixes=FILE
# Dumps OpenROAD build arguments and variables
# to FILE
$0 -constant-build-dir
# Use constant build directory, instead of
# random one.
EOF
exit "${1:-1}"
Expand All @@ -736,6 +756,7 @@ option="all"
isLocal="false"
equivalenceDeps="no"
CI="no"
saveDepsPrefixes=""
# temp dir to download and compile
baseDir=$(mktemp -d /tmp/DependencyInstaller-XXXXXX)

Expand Down Expand Up @@ -780,6 +801,14 @@ while [ "$#" -gt 0 ]; do
export PREFIX="${HOME}/.local"
export isLocal="true"
;;
-constant-build-dir)
if [[ -d "$baseDir" ]]; then
echo "INFO: removing old building directory $baseDir"
rm -r "$baseDir"
fi
baseDir="/tmp/DependencyInstaller-OpenROAD"
mkdir -p "$baseDir"
;;
-prefix=*)
if [[ ! -z ${PREFIX} ]]; then
echo "WARNING: previous argument -local will be overwritten with -prefix"
Expand All @@ -795,6 +824,9 @@ while [ "$#" -gt 0 ]; do
alias wget="wget --no-check-certificate"
export GIT_SSL_NO_VERIFY=true
;;
-save-deps-prefixes=*)
saveDepsPrefixes=$(realpath ${1#-save-deps-prefixes=})
;;
*)
echo "unknown option: ${1}" >&2
_help
Expand All @@ -803,6 +835,11 @@ while [ "$#" -gt 0 ]; do
shift 1
done

if [[ -z "${saveDepsPrefixes}" ]]; then
DIR="$(dirname $(readlink -f $0))"
saveDepsPrefixes="$DIR/openroad_deps_prefixes.txt"
fi

platform="$(uname -s)"
case "${platform}" in
"Linux" )
Expand Down Expand Up @@ -938,3 +975,7 @@ EOF
_help
;;
esac
if [[ ! -z ${saveDepsPrefixes} ]]; then
mkdir -p "$(dirname $saveDepsPrefixes)"
echo "$CMAKE_PACKAGE_ROOT_ARGS" > $saveDepsPrefixes
fi
16 changes: 11 additions & 5 deletions etc/DockerHelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cd "$(dirname $(readlink -f $0))/../"
baseDir="$(pwd)"
# docker hub organization/user from where to pull/push images
org=openroad
depsPrefixesFile="/etc/openroad_deps_prefixes.txt"

_help() {
cat <<EOF
Expand All @@ -18,8 +19,8 @@ usage: $0 [CMD] [OPTIONS]
push Push the docker image to Docker Hub
OPTIONS:
-os=OS_NAME Choose beween ubuntu22.04 (default), ubuntu20.04, rhel, opensuse, debian10 and debian11.
-target=TARGET Choose target fo the Docker image:
-os=OS_NAME Choose between ubuntu22.04 (default), ubuntu20.04, rhel, opensuse, debian10 and debian11.
-target=TARGET Choose target for the Docker image:
'dev': os + packages to compile app
'builder': os + packages to compile app +
copy source code and build app
Expand All @@ -34,6 +35,7 @@ usage: $0 [CMD] [OPTIONS]
-local Installs with prefix /home/openroad-deps
-username Docker Username
-password Docker Password
-deps-prefixes-path=PATH Path where the file with dependency prefixes should be stored (in Docker image)
EOF
exit "${1:-1}"
Expand Down Expand Up @@ -84,6 +86,7 @@ _setup() {
context="."
buildArgs="--build-arg compiler=${compiler}"
buildArgs="${buildArgs} --build-arg numThreads=${numThreads}"
buildArgs="${buildArgs} --build-arg depsPrefixFile=${depsPrefixesFile}"
if [[ "${isLocal}" == "yes" ]]; then
buildArgs="${buildArgs} --build-arg LOCAL_PATH=${LOCAL_PATH}/bin"
fi
Expand All @@ -92,9 +95,9 @@ _setup() {
"dev" )
fromImage="${FROM_IMAGE_OVERRIDE:-$osBaseImage}"
context="etc"
buildArgs=""
buildArgs="-save-deps-prefixes=${depsPrefixesFile}"
if [[ "${isLocal}" == "yes" ]]; then
buildArgs="-prefix=${LOCAL_PATH}"
buildArgs="${buildArgs} -prefix=${LOCAL_PATH}"
fi
if [[ "${equivalenceDeps}" == "yes" ]]; then
buildArgs="${buildArgs} -eqy"
Expand Down Expand Up @@ -244,7 +247,10 @@ while [ "$#" -gt 0 ]; do
-tag=* )
tag="${1#*=}"
;;
-os | -target | -compiler | -threads | -username | -password | -tag )
-deps-prefixes-path=* )
depsPrefixesFile="${1#-deps-prefixes-path=}"
;;
-os | -target | -compiler | -threads | -username | -password | -tag | -deps-prefixes-path )
echo "${1} requires an argument" >&2
_help
;;
Expand Down
6 changes: 3 additions & 3 deletions src/ant/include/ant/AntennaChecker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include <map>
#include <queue>
#include <unordered_set>
#include <set>

#include "odb/db.h"
#include "odb/dbWireGraph.h"
Expand Down Expand Up @@ -127,11 +127,11 @@ struct Violation

using LayerToNodeInfo = std::map<odb::dbTechLayer*, NodeInfo>;
using GraphNodes = std::vector<std::unique_ptr<GraphNode>>;
using LayerToGraphNodes = std::unordered_map<odb::dbTechLayer*, GraphNodes>;
using LayerToGraphNodes = std::map<odb::dbTechLayer*, GraphNodes>;
using GateToLayerToNodeInfo = std::map<odb::dbITerm*, LayerToNodeInfo>;
using Violations = std::vector<Violation>;
using GateToViolationLayers
= std::unordered_map<odb::dbITerm*, std::unordered_set<odb::dbTechLayer*>>;
= std::map<odb::dbITerm*, std::set<odb::dbTechLayer*>>;

class AntennaChecker
{
Expand Down
Loading

0 comments on commit bce80f5

Please sign in to comment.