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

feat: Python Deployment of Triton Inference Server #7501

Merged
merged 98 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
c9de538
Basic Interface and Bindings
KrishnanPrash Jul 3, 2024
a5bb38f
testing
KrishnanPrash Jul 8, 2024
2215e58
Adding stuff
KrishnanPrash Jul 13, 2024
c450c0d
Working MVP for wheel
KrishnanPrash Jul 20, 2024
aab5e82
Remove _deps
KrishnanPrash Jul 20, 2024
6c2d9b2
Working MVP (No linking issues)
KrishnanPrash Jul 22, 2024
819262f
Working server HTTP bindings
KrishnanPrash Jul 23, 2024
7a141b7
Not working pybind->dict stuff
KrishnanPrash Jul 25, 2024
62ce8db
Get logic not working
KrishnanPrash Jul 25, 2024
d388614
Update
KrishnanPrash Jul 29, 2024
47bde5b
GRPC basic working
KrishnanPrash Jul 30, 2024
ff2c919
Working http and grpc frontends
KrishnanPrash Aug 3, 2024
a7d17bd
Removing unecessary changes
KrishnanPrash Aug 5, 2024
06147cd
Adding testing and cleaning up code
KrishnanPrash Aug 5, 2024
d35dce4
Adding/Updating copyright
KrishnanPrash Aug 5, 2024
fc40f50
removing extra space
KrishnanPrash Aug 5, 2024
ca29a19
spacing
KrishnanPrash Aug 5, 2024
44c81b7
Adding back CMake compile_feature
KrishnanPrash Aug 5, 2024
745ff6a
modify cmake
KrishnanPrash Aug 5, 2024
bf6f871
Removing print statements
KrishnanPrash Aug 5, 2024
b30ced3
Extra spacing
KrishnanPrash Aug 5, 2024
30067a8
Formatting
KrishnanPrash Aug 5, 2024
33afc53
Running pre-commit
KrishnanPrash Aug 5, 2024
ef1f602
Updates
KrishnanPrash Aug 5, 2024
554ed4a
Standardizing function names
KrishnanPrash Aug 5, 2024
2de88e2
Fixing potential file handling error
KrishnanPrash Aug 5, 2024
de734bd
fixing order of output arguments
KrishnanPrash Aug 6, 2024
c412a60
Removing unecessary code/Standardizing
KrishnanPrash Aug 7, 2024
95ceb33
Changing shared_ptr deleter name
KrishnanPrash Aug 7, 2024
e1548cb
Cleaning up CMake
KrishnanPrash Aug 7, 2024
ff2a6e9
Removing unecessary code / fixing function names
KrishnanPrash Aug 7, 2024
22cc785
Working Triton-specfic Error Handling
KrishnanPrash Aug 7, 2024
ccabc08
Removing unused import
KrishnanPrash Aug 7, 2024
879d3da
Migrating from Custom Validation to Pydantic
KrishnanPrash Aug 8, 2024
f3f3a1d
Error checking added to get_value<T>()
KrishnanPrash Aug 8, 2024
d538f13
Working test suite and Error Handling
KrishnanPrash Aug 12, 2024
89a59ca
Moved CMake instructions
KrishnanPrash Aug 12, 2024
a76cc19
Removed unused import
KrishnanPrash Aug 12, 2024
42d34ec
Working logging
KrishnanPrash Aug 13, 2024
1971215
Update src/common.h
KrishnanPrash Aug 13, 2024
70b80a3
Consistent returns
KrishnanPrash Aug 13, 2024
21bb999
streamlined client
KrishnanPrash Aug 13, 2024
fc9a7f4
Adding const
KrishnanPrash Aug 13, 2024
c14febd
Broken CMake
KrishnanPrash Aug 15, 2024
c25162b
Merge branch 'kprashanth-python-deployment' of https://github.com/tri…
KrishnanPrash Aug 15, 2024
a704589
Working CMake
KrishnanPrash Aug 16, 2024
45089b3
Working variant
KrishnanPrash Aug 16, 2024
47e207f
updates to CMake and core bindings
KrishnanPrash Aug 16, 2024
25cf153
Merge remote-tracking branch 'origin/main' into kprashanth-python-dep…
KrishnanPrash Aug 16, 2024
0c8d5d4
Cleaning up Repo
KrishnanPrash Aug 18, 2024
1a830d2
moved test cases
KrishnanPrash Aug 18, 2024
c90255f
change log verbose
KrishnanPrash Aug 19, 2024
fc273eb
revisions
KrishnanPrash Aug 19, 2024
52c6b61
Updated `README.md`
KrishnanPrash Aug 19, 2024
76e199a
Conditional inclusion of tracer.cc
KrishnanPrash Aug 20, 2024
2c57e71
Removed redundancy to CMakeLists.txt
KrishnanPrash Aug 20, 2024
3fac830
Fixing spelling mistake
KrishnanPrash Aug 20, 2024
ca8f717
Merge branch 'kprashanth-python-deployment' of https://github.com/tri…
KrishnanPrash Aug 20, 2024
c02ee75
Reverting unnecessary changes
KrishnanPrash Aug 20, 2024
35b606f
Completed test suite
KrishnanPrash Aug 20, 2024
448e6b4
Add check for HTTP and gRPC endpoint flags
KrishnanPrash Aug 21, 2024
0f765e8
Documentation and comments
KrishnanPrash Aug 21, 2024
d7b5c6b
Update src/python/README.md
KrishnanPrash Aug 21, 2024
83c4ee8
removing unecessary comments
KrishnanPrash Aug 21, 2024
a16d23e
Adding build instructions
KrishnanPrash Aug 21, 2024
8fb3cae
Using CMake generator expressions and adding LICENSE.txt to python whl
KrishnanPrash Aug 21, 2024
cff480d
Making examples and README.md more user-friendly
KrishnanPrash Aug 21, 2024
5247dbc
Removing unused import
KrishnanPrash Aug 21, 2024
10dafdf
tritonfrontend stubs generated
KrishnanPrash Aug 21, 2024
a4c5bd3
Removing comment
KrishnanPrash Aug 21, 2024
5a83f7c
Update CMakeLists.txt
KrishnanPrash Aug 21, 2024
6bf3c10
Update qa/L0_python_api/test_kserve_frontend.py
KrishnanPrash Aug 21, 2024
d762af1
Update src/common.h
KrishnanPrash Aug 21, 2024
4c74272
updates
KrishnanPrash Aug 25, 2024
8b33c1c
Update Dockerfile.QA
KrishnanPrash Aug 26, 2024
1d07314
fixing
KrishnanPrash Aug 26, 2024
9e540ec
updated CMake messaging
KrishnanPrash Aug 26, 2024
609c151
updated testing
KrishnanPrash Aug 27, 2024
a8ab882
Revamped error handling and test suite
KrishnanPrash Aug 28, 2024
3025f1a
cleaning up error handling
KrishnanPrash Aug 28, 2024
0cedd48
Minor changes
KrishnanPrash Aug 28, 2024
c904300
Adding static decorator
KrishnanPrash Aug 28, 2024
a7a7f58
Attempting to fix faulty pip install for tritonfrontend wheel
KrishnanPrash Aug 28, 2024
ef3197e
Reverting to previous pip install command
KrishnanPrash Aug 28, 2024
0ead5fc
Adding comments
KrishnanPrash Aug 28, 2024
f92e270
comments and copyright
KrishnanPrash Aug 28, 2024
5c7cd0d
cleaning up
KrishnanPrash Aug 28, 2024
86ba0fd
updating filename in bash script
KrishnanPrash Aug 28, 2024
57d441e
updating filename in bash script
KrishnanPrash Aug 28, 2024
79e67db
refactoring tests and moving docs
KrishnanPrash Aug 28, 2024
74e8193
Making function name consistent
KrishnanPrash Aug 28, 2024
94062b1
Making parameter names more descriptive
KrishnanPrash Aug 28, 2024
4625935
Removing redundant code
KrishnanPrash Aug 28, 2024
e87930f
Removing unnecessary use of
KrishnanPrash Aug 28, 2024
4ca394b
Merge branch 'kprashanth-python-deployment' of https://github.com/tri…
KrishnanPrash Aug 28, 2024
69bd5d3
updates to Readme.md
KrishnanPrash Aug 28, 2024
0d34f60
Merge branch 'main' into kprashanth-python-deployment
KrishnanPrash Aug 29, 2024
d95527a
update parameter names
KrishnanPrash Aug 29, 2024
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
60 changes: 57 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -105,8 +105,18 @@ add_executable(
common.h
shared_memory_manager.h
triton_signal.h
server_interface.h
)

set(CMAKE_CXX_STANDARD_REQUIRED True)
add_library(server-interface-library server_interface.h)
KrishnanPrash marked this conversation as resolved.
Show resolved Hide resolved
set_target_properties(server-interface-library
KrishnanPrash marked this conversation as resolved.
Show resolved Hide resolved
PROPERTIES
POSITION_INDEPENDENT_CODE ON
LINKER_LANGUAGE CXX)
target_compile_features(server-interface-library PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD})
target_compile_definitions(server-interface-library PRIVATE TRITON_MIN_COMPUTE_CAPABILITY=${TRITON_MIN_COMPUTE_CAPABILITY})

# On windows a *.lib file can be generated for a exe. When creating
# tritonserver.exe if we try to create tritonserver.lib it will fail
# because there is already a trtionserver.lib for tritonserver.dll,
Expand Down Expand Up @@ -352,7 +362,7 @@ if(${TRITON_ENABLE_HTTP}
http-endpoint-library EXCLUDE_FROM_ALL
${HTTP_ENDPOINT_SRCS} ${HTTP_ENDPOINT_HDRS}
)

target_compile_features(http-endpoint-library PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD})
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(
Expand All @@ -367,7 +377,7 @@ if(${TRITON_ENABLE_HTTP}
-Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Werror
)
endif()

set_target_properties(
http-endpoint-library
PROPERTIES
Expand Down Expand Up @@ -777,3 +787,47 @@ endif() # NOT WIN32
if ( NOT WIN32)
add_subdirectory(test test)
endif() # NOT WIN32

find_package(CUDAToolkit REQUIRED)

# TODO: Remove excess stuff
add_library(
python-binding-dependency
EXCLUDE_FROM_ALL
shared_memory_manager.h
shared_memory_manager.cc
data_compressor.h
common.h
common.cc
restricted_features.h
tracer.h
classification.cc
)

target_link_libraries(
python-binding-dependency
PUBLIC
http-endpoint-library
grpc-endpoint-library
CUDA::cudart
triton-core-serverapi # from repo-core
triton-core-serverstub # from repo-core
triton-common-json # from repo-common
)


set_target_properties(python-binding-dependency PROPERTIES POSITION_INDEPENDENT_CODE ON)

target_compile_features(python-binding-dependency PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD})

target_compile_definitions(
python-binding-dependency
PRIVATE TRITON_ENABLE_GPU=1
PRIVATE TRITON_MIN_COMPUTE_CAPABILITY=${TRITON_MIN_COMPUTE_CAPABILITY}
)

# Add the -fPIC flag
# set_target_properties(server-src-lib PROPERTIES POSITION_INDEPENDENT_CODE ON)


KrishnanPrash marked this conversation as resolved.
Show resolved Hide resolved
add_subdirectory(python python)
51 changes: 51 additions & 0 deletions src/grpc/grpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2435,6 +2435,57 @@ Server::Create(
return nullptr; // success
}

bool
Server::Create_Wrapper(
std::shared_ptr<TRITONSERVER_Server>& server,
UnorderedMapType& data,
std::unique_ptr<triton::server::grpc::Server>* service,
const RestrictedFeatures& restricted_features) {

std::string address = get_value<std::string>(data, "address");
int port = get_value<int>(data, "port");
bool reuse_port = get_value<int>(data, "reuse_port");

SocketOptions socket_selection{address, port, reuse_port};

bool use_ssl = get_value<int>(data, "use_ssl");
std::string server_cert = get_value<std::string>(data, "server_cert");
std::string server_key = get_value<std::string>(data, "server_key");
std::string root_cert = get_value<std::string>(data, "root_cert");
bool use_mutual_auth = get_value<int>(data, "use_mutual_auth");

SslOptions ssl_selection{use_ssl, server_cert, server_key, root_cert, use_mutual_auth};

int keepalive_time_ms = get_value<int>(data, "keepalive_time_ms");
int keepalive_timeout_ms = get_value<int>(data, "keepalive_timeout_ms");
bool keepalive_permit_without_calls = get_value<int>(data, "keepalive_permit_without_calls");
int http2_max_pings_without_data = get_value<int>(data, "http2_max_pings_without_data");
int http2_min_recv_ping_interval_without_data_ms = get_value<int>(data, "http2_min_recv_ping_interval_without_data_ms");
int http2_max_ping_strikes = get_value<int>(data, "http2_max_ping_strikes");
int max_connection_age_ms = get_value<int>(data, "max_connection_age_ms");
int max_connection_age_grace_ms = get_value<int>(data, "max_connection_age_grace_ms");

KeepAliveOptions keep_alive_selection{keepalive_time_ms, keepalive_timeout_ms,
keepalive_permit_without_calls, http2_max_pings_without_data,
http2_min_recv_ping_interval_without_data_ms, http2_max_ping_strikes,
max_connection_age_ms, max_connection_age_grace_ms};

grpc_compression_level infer_compression_level = static_cast<grpc_compression_level>(get_value<int>(data, "infer_compression_level"));
int infer_allocation_pool_size = get_value<int>(data, "infer_allocation_pool_size");
std::string forward_header_pattern = get_value<std::string>(data, "forward_header_pattern");


Options grpc_options{socket_selection, ssl_selection, keep_alive_selection,
infer_compression_level, infer_allocation_pool_size,
restricted_features, forward_header_pattern};

TRITONSERVER_Error* err = Create(server, nullptr, nullptr,
grpc_options, service);
if(err == nullptr) {return true;}

return false;
}

TRITONSERVER_Error*
Server::Start()
{
Expand Down
20 changes: 20 additions & 0 deletions src/grpc/grpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "infer_handler.h"
#include "stream_infer_handler.h"
#include "triton/core/tritonserver.h"
// #include "../server_interface.h"

namespace triton { namespace server { namespace grpc {

Expand Down Expand Up @@ -92,13 +93,32 @@ struct Options {
std::string forward_header_pattern_;
};

using VariantType = std::variant<int, bool, std::string>;
using UnorderedMapType = std::unordered_map<std::string, VariantType>;

template <typename T>
T get_value(const UnorderedMapType& options, const std::string& key) {
auto curr = options.find(key);
bool is_present = (curr != options.end());
bool correct_type = std::holds_alternative<T>(curr->second);

return std::get<T>(curr->second);
}

class Server {
public:
static TRITONSERVER_Error* Create(
const std::shared_ptr<TRITONSERVER_Server>& tritonserver,
triton::server::TraceManager* trace_manager,
const std::shared_ptr<SharedMemoryManager>& shm_manager,
const Options& server_options, std::unique_ptr<Server>* server);

static bool Create_Wrapper(
std::shared_ptr<TRITONSERVER_Server>& server,
UnorderedMapType& data,
std::unique_ptr<triton::server::grpc::Server>* service,
KrishnanPrash marked this conversation as resolved.
Show resolved Hide resolved
const RestrictedFeatures& restricted_features);


~Server();

Expand Down
39 changes: 37 additions & 2 deletions src/http_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
#define TRITONJSON_STATUSSUCCESS nullptr
#include "triton/common/triton_json.h"

#include <unistd.h> // For sleep

// #define LOG_VERBOSE_IS_ON ... something like that
// TODO: hard code log verbose mode to see output in Handle()
KrishnanPrash marked this conversation as resolved.
Show resolved Hide resolved

extern "C" {
#include <b64/cdecode.h>
}
Expand Down Expand Up @@ -228,6 +233,9 @@ HTTPServer::Start()
event_add(break_ev_, NULL);
worker_ = std::thread(event_base_loop, evbase_, 0);

const std::string addr = address_ + ":" + std::to_string(port_);
LOG_INFO << "Started HTTPService at " << addr;

return nullptr;
}

Expand Down Expand Up @@ -1181,6 +1189,7 @@ HTTPAPIServer::HTTPAPIServer(

HTTPAPIServer::~HTTPAPIServer()
{
LOG_VERBOSE(2) << "~HTTPAPIServer()";
KrishnanPrash marked this conversation as resolved.
Show resolved Hide resolved
if (server_metadata_err_ != nullptr) {
TRITONSERVER_ErrorDelete(server_metadata_err_);
}
Expand Down Expand Up @@ -4688,12 +4697,37 @@ HTTPAPIServer::Create(
server, trace_manager, shm_manager, port, reuse_port, address,
header_forward_pattern, thread_cnt, restricted_features));

const std::string addr = address + ":" + std::to_string(port);
LOG_INFO << "Started HTTPService at " << addr;

return nullptr;
}


bool
HTTPAPIServer::Create_Wrapper(
std::shared_ptr<TRITONSERVER_Server>& server,
UnorderedMapType& data,
std::unique_ptr<HTTPServer>* service,
const RestrictedFeatures& restricted_features)
{
int port = get_value<int>(data, "port");
bool reuse_port = get_value<int>(data, "reuse_port");
std::string address = get_value<std::string>(data, "address");
std::string header_forward_pattern = get_value<std::string>(data, "header_forward_pattern");
int thread_count = get_value<int>(data, "thread_count");

TRITONSERVER_Error* err = Create(server, // shared_ptr<TRITONSERVER_Server>
nullptr, nullptr, // TraceManager, SharedMemoryManager
port, reuse_port, address, // port, reuse_port, address
header_forward_pattern, thread_count, // header_forward_pattern, thread_count
restricted_features, // RestrictedFeatures
service); // HTTPServer instance

if(err == nullptr) return true;

return false;
}


bool
HTTPAPIServer::RespondIfRestricted(
evhtp_request_t* req, const Restriction& restriction)
Expand All @@ -4712,4 +4746,5 @@ HTTPAPIServer::RespondIfRestricted(
return false;
}


}} // namespace triton::server
22 changes: 20 additions & 2 deletions src/http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <queue>
#include <string>
#include <thread>
#include <unordered_map>

#include "common.h"
#include "data_compressor.h"
Expand Down Expand Up @@ -183,6 +182,18 @@ using HttpTextMapCarrier = void*;
#endif


using VariantType = std::variant<int, bool, std::string>;
using UnorderedMapType = std::unordered_map<std::string, VariantType>;

template <typename T>
T get_value(const UnorderedMapType& options, const std::string& key) {
auto curr = options.find(key);
bool is_present = (curr != options.end());
bool correct_type = std::holds_alternative<T>(curr->second);

return std::get<T>(curr->second);
}
KrishnanPrash marked this conversation as resolved.
Show resolved Hide resolved

// HTTP API server that implements KFServing community standard inference
// protocols and extensions used by Triton.
class HTTPAPIServer : public HTTPServer {
Expand All @@ -196,6 +207,13 @@ class HTTPAPIServer : public HTTPServer {
const RestrictedFeatures& restricted_apis,
std::unique_ptr<HTTPServer>* http_server);


static bool Create_Wrapper(
std::shared_ptr<TRITONSERVER_Server>& server,
UnorderedMapType& data,
std::unique_ptr<HTTPServer>* service,
const RestrictedFeatures& restricted_features);

virtual ~HTTPAPIServer();

//
Expand Down Expand Up @@ -627,4 +645,4 @@ class HTTPAPIServer : public HTTPServer {
evhtp_request_t* req, const Restriction& restriction);
};

}} // namespace triton::server
}} // namespace triton::server
78 changes: 78 additions & 0 deletions src/python/CMakeLists.txt
KrishnanPrash marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Copyright 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
rmccorm4 marked this conversation as resolved.
Show resolved Hide resolved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cmake_minimum_required(VERSION 3.18)

add_subdirectory(tritonfrontend)

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/TRITON_VERSION ${TRITON_VERSION})
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we trying to override this file?

Copy link
Contributor Author

@KrishnanPrash KrishnanPrash Aug 28, 2024

Choose a reason for hiding this comment

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

I believe this guarantees that TRITON_VERSION is present in the current directory level, but @nnshah1 might be able to shed so more light onto this. I have created a follow-up ticket with the hopes of:

  1. Moving python out of src
  2. Streamlining the current CMake instructions to build the tritonfrontend wheel
    Through the streamlining process I hope to remove the need of adding unnecessary source/header files and any redundant CMake instructions in the wheel build process.

# configure_file(../LICENSE LICENSE.txt COPYONLY)
configure_file(setup.py setup.py @ONLY)
file(COPY test/ DESTINATION ./test/.)

set(WHEEL_DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/TRITON_VERSION
# ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt
${CMAKE_CURRENT_BINARY_DIR}/setup.py
${CMAKE_CURRENT_BINARY_DIR}/tritonfrontend
py-bindings
)

set(wheel_stamp_file "stamp.whl")

add_custom_command(
OUTPUT "${wheel_stamp_file}"
COMMAND python3
ARGS
"${CMAKE_CURRENT_SOURCE_DIR}/build_wheel.py"
--dest-dir "${CMAKE_CURRENT_BINARY_DIR}/generic"
--binding-path $<TARGET_FILE:py-bindings>
DEPENDS ${WHEEL_DEPENDS}
)

add_custom_target(
KrishnanPrash marked this conversation as resolved.
Show resolved Hide resolved
frontend-server-wheel ALL
DEPENDS
"${wheel_stamp_file}"
)


# Wheel
set(WHEEL_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/generic/wheel/dist/")
install(
DIRECTORY
${WHEEL_OUT_DIR}
DESTINATION "${CMAKE_INSTALL_PREFIX}/python"
)


# Tests
set(TEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/test")
install(
DIRECTORY
${TEST_DIR}
DESTINATION "${CMAKE_INSTALL_PREFIX}/python"
)
Loading
Loading