Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a tool to query ORAssistant #6226

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
fdd34df
ora: add basic orassistant api call command
palaniappan-r Oct 21, 2024
13453ac
ora: add boost json lib
palaniappan-r Oct 29, 2024
ad67b3a
ora: remove context flag
palaniappan-r Oct 29, 2024
59108fd
ora: remove context flag, use boost json to parse response
palaniappan-r Oct 29, 2024
c03c44d
ora: remove context flag
palaniappan-r Oct 29, 2024
0dd9809
ora: install boost json in docker container
palaniappan-r Oct 29, 2024
972e8d8
ora: add tool entry in logger
palaniappan-r Oct 29, 2024
3608133
ora: add set_bothost command
palaniappan-r Oct 29, 2024
11e1fb4
ora: save bothost url to file
palaniappan-r Oct 30, 2024
581f947
Merge branch 'The-OpenROAD-Project:master' into master
palaniappan-r Oct 30, 2024
a885998
ora: update dockerfile
palaniappan-r Oct 30, 2024
68096d7
ora: revert builder dockerfile
palaniappan-r Oct 31, 2024
119617e
ora: add curl to dependency installer script
palaniappan-r Oct 31, 2024
ec4c653
ora: add curl and openssl to dependency installer script
palaniappan-r Nov 2, 2024
a5c7e96
style: fix formatting
palaniappan-r Nov 10, 2024
a167887
ora: remove default tests
palaniappan-r Nov 10, 2024
504d82c
Merge branch 'The-OpenROAD-Project:master' into master
palaniappan-r Nov 10, 2024
fb30cf7
Merge branch 'The-OpenROAD-Project:master' into master
palaniappan-r Nov 24, 2024
4cf083c
ora: remove log statement
palaniappan-r Nov 24, 2024
72de8cd
ora: add tests
palaniappan-r Nov 24, 2024
e64dd2b
ora: add mock API server initialization in regression tests
palaniappan-r Nov 24, 2024
68e8156
ora: replace FastAPI mock server with HTTPServer implementation
palaniappan-r Nov 24, 2024
056562f
ora: add regression test script definition for 'ora' tool
palaniappan-r Nov 24, 2024
c44816c
ora: update copyright year to 2024
palaniappan-r Nov 24, 2024
d2ac50f
ora: update copyright year to 2024 and remove host url file
palaniappan-r Nov 24, 2024
c2b240c
ora: use dev versions of openssl and curl
palaniappan-r Nov 25, 2024
0d310e4
Merge branch 'The-OpenROAD-Project:master' into master
palaniappan-r Nov 26, 2024
2f51f9e
Merge branch 'The-OpenROAD-Project:master' into master
palaniappan-r Dec 5, 2024
b9b8839
ora: display host file path for ORAssistant host configuration
palaniappan-r Dec 5, 2024
26f18fa
ora: add libcurl and boost dependencies for RHEL and Debian packages
palaniappan-r Dec 5, 2024
2825ff3
ora: remove libboost-json-dev from Debian package installation
palaniappan-r Dec 5, 2024
144d8c7
ora: update set_bothost log message
palaniappan-r Dec 5, 2024
6819aa0
ora: update set_bothost test
palaniappan-r Dec 5, 2024
d97ee0b
ora: update ORAssistant host file path to use ~/.local directory and …
palaniappan-r Dec 7, 2024
598212e
ora: silence logs and implement auto shutdown after 15 seconds for mo…
palaniappan-r Dec 7, 2024
1664333
Merge branch 'The-OpenROAD-Project:master' into master
palaniappan-r Dec 7, 2024
9d0e2c5
Merge remote-tracking branch 'upstream/master'
palaniappan-r Dec 19, 2024
a29904d
ora: add consent management and local directory checks
palaniappan-r Dec 19, 2024
e367e39
ora: update regression tests
palaniappan-r Dec 19, 2024
efb1e27
Merge branch 'The-OpenROAD-Project:master' into master
palaniappan-r Dec 27, 2024
408c945
ora: update copyright year to 2025
palaniappan-r Dec 27, 2024
b80a499
ora: fix stray changes
palaniappan-r Dec 27, 2024
dc94695
Merge branch 'The-OpenROAD-Project:master' into master
palaniappan-r Jan 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ WORKDIR /OpenROAD
ENV PATH=${LOCAL_PATH}:${PATH}
RUN ./etc/Build.sh -compiler=${compiler} -threads=${numThreads} -deps-prefixes-file=${depsPrefixFile}
RUN ./etc/Build.sh -compiler=${compiler} -threads=${numThreads} -deps-prefixes-file=${depsPrefixFile}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is there a change here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

12 changes: 8 additions & 4 deletions etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ _installCommonDev() {
tar -xf boost_${boostVersionUnderscore}.tar.gz
cd boost_${boostVersionUnderscore}
./bootstrap.sh --prefix="${boostPrefix}"
./b2 install --with-iostreams --with-test --with-serialization --with-system --with-thread -j $(nproc)
./b2 install --with-iostreams --with-test --with-serialization --with-system --with-thread --with-json -j $(nproc)
else
echo "Boost already installed."
fi
Expand Down Expand Up @@ -332,6 +332,7 @@ _installUbuntuPackages() {
git \
groff \
lcov \
libcurl4-openssl-dev \
libffi-dev \
libgomp1 \
libomp-dev \
Expand Down Expand Up @@ -424,7 +425,9 @@ _installRHELPackages() {
tcl-thread-devel \
tcllib \
wget \
zlib-devel
zlib-devel \
libcurl-devel \
boost-devel

yum install -y \
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/bison-3.7.4-5.el9.x86_64.rpm \
Expand Down Expand Up @@ -570,6 +573,7 @@ _installDebianPackages() {
libpcre3-dev \
libreadline-dev \
libtcl${tclver} \
libcurl4-openssl-dev \
pandoc \
python3-dev \
qt5-image-formats-plugins \
Expand All @@ -579,7 +583,7 @@ _installDebianPackages() {
unzip \
wget \
zlib1g-dev

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray change?

if [[ $1 == 10 ]]; then
apt-get install -y --no-install-recommends \
libpython3.7 \
Expand Down Expand Up @@ -920,4 +924,4 @@ esac
if [[ ! -z ${saveDepsPrefixes} ]]; then
mkdir -p "$(dirname $saveDepsPrefixes)"
echo "$CMAKE_PACKAGE_ROOT_ARGS" > $saveDepsPrefixes
fi
fi
6 changes: 6 additions & 0 deletions include/ord/OpenRoad.hh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ namespace dft {
class Dft;
}

namespace ora{
class Ora;
}

namespace ord {

using std::string;
Expand Down Expand Up @@ -198,6 +202,7 @@ class OpenRoad
dst::Distributed* getDistributed() { return distributer_; }
stt::SteinerTreeBuilder* getSteinerTreeBuilder() { return stt_builder_; }
dft::Dft* getDft() { return dft_; }
ora::Ora* getOra() { return ora_; }

// Return the bounding box of the db rows.
odb::Rect getCore();
Expand Down Expand Up @@ -294,6 +299,7 @@ class OpenRoad
dst::Distributed* distributer_ = nullptr;
stt::SteinerTreeBuilder* stt_builder_ = nullptr;
dft::Dft* dft_ = nullptr;
ora::Ora* ora_ = nullptr;

std::set<OpenRoadObserver*> observers_;

Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ add_subdirectory(pdn)
add_subdirectory(dft)
add_subdirectory(mpl2)
add_subdirectory(par)
add_subdirectory(ora)

################################################################

Expand Down Expand Up @@ -372,6 +373,7 @@ target_link_libraries(openroad
dft
mpl2
par
ora
${ABC_LIBRARY}
${TCL_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
Expand Down
4 changes: 4 additions & 0 deletions src/OpenRoad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
#include "utl/Logger.h"
#include "utl/MakeLogger.h"
#include "utl/ScopedTemporaryFile.h"
#include "ora/MakeOra.hh"

namespace sta {
extern const char* openroad_swig_tcl_inits[];
Expand Down Expand Up @@ -147,6 +148,7 @@ OpenRoad::~OpenRoad()
deleteDistributed(distributer_);
deleteSteinerTreeBuilder(stt_builder_);
dft::deleteDft(dft_);
deleteOra(ora_);
delete logger_;
}

Expand Down Expand Up @@ -213,6 +215,7 @@ void OpenRoad::init(Tcl_Interp* tcl_interp,
distributer_ = makeDistributed();
stt_builder_ = makeSteinerTreeBuilder();
dft_ = dft::makeDft();
ora_ = makeOra();

// Init components.
Openroad_swig_Init(tcl_interp);
Expand Down Expand Up @@ -249,6 +252,7 @@ void OpenRoad::init(Tcl_Interp* tcl_interp,
initDistributed(this);
initSteinerTreeBuilder(this);
dft::initDft(this);
initOra(this);

// Import exported commands to global namespace.
Tcl_Eval(tcl_interp, "sta::define_sta_cmds");
Expand Down
1 change: 1 addition & 0 deletions src/ora/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/results
59 changes: 59 additions & 0 deletions src/ora/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright (c) 2024, The Regents of the University of
# California
# All rights reserved.
#
# This program is free software: you can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General
# Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
include("openroad")

project(ora)

swig_lib(NAME ora
NAMESPACE ora
I_FILE src/Ora.i
SCRIPTS src/Ora.tcl
)

target_sources(ora
PRIVATE
src/MakeOra.cc
src/Ora.cc
)

target_include_directories(ora
PUBLIC
include
)

find_package(CURL REQUIRED)
find_package(Boost REQUIRED COMPONENTS json)

target_include_directories(ora
PUBLIC ${CURL_INCLUDE_DIRS}
PUBLIC ${Boost_INCLUDE_DIRS}
)

target_link_libraries(ora
OpenSTA
odb
${CURL_LIBRARIES}
Boost::json
)

messages(
TARGET ora
)

33 changes: 33 additions & 0 deletions src/ora/include/ora/MakeOra.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2024, The Regents of the University of California
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#ifndef MAKE_ORA_H
#define MAKE_ORA_H

namespace ora {
class Ora;
}

namespace ord {

class OpenRoad;

ora::Ora* makeOra();
void deleteOra(ora::Ora* ora);
void initOra(OpenRoad* openroad);

} // namespace ord
#endif
53 changes: 53 additions & 0 deletions src/ora/include/ora/Ora.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright (c) 2024, The Regents of the University of California
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#include <curl/curl.h>
#include <tcl.h>

#include <boost/json.hpp>

#include "odb/db.h"

namespace utl {
class Logger;
}

namespace ora {

using utl::Logger;

class Ora
{
public:
Ora();
~Ora();
void init(Tcl_Interp* tcl_interp, odb::dbDatabase* db, utl::Logger* logger);
void askbot(const char* pos_arg1);
void setBotHost(const char* host);
void setSourceFlag(bool sourceFlag);
void setConsent(const char* consent);

private:
odb::dbDatabase* db_;
bool sourceFlag_;
std::string hostUrl;
std::string localDirPath;
void checkLocalDir();

Logger* logger_ = nullptr;
};

} // namespace ora
40 changes: 40 additions & 0 deletions src/ora/src/MakeOra.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) 2024, The Regents of the University of California
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#include "ora/MakeOra.hh"

#include "ora/Ora.hh"
#include "ord/OpenRoad.hh"

namespace ord {

ora::Ora* makeOra()
{
return new ora::Ora;
}

void deleteOra(ora::Ora* ora)
{
delete ora;
}

void initOra(OpenRoad* openroad)
{
utl::Logger* logger = openroad->getLogger();
openroad->getOra()->init(openroad->tclInterp(), openroad->getDb(), logger);
}

} // namespace ord
Loading