From 5357ec3372ac060cc3e97a9fdc2d501e709833ad Mon Sep 17 00:00:00 2001 From: rasapala Date: Wed, 24 Apr 2024 16:24:11 +0200 Subject: [PATCH 1/3] Adding lib to bazel --- text_generation/causal_lm/cpp/CMakeLists.txt | 18 ------------------ .../continuous_batching/library/CMakeLists.txt | 10 ++++++++++ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index 6b5cc57a17..eef707aa31 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -27,24 +27,6 @@ FetchContent_MakeAvailable(nlohmann_json) # end of dependencies -set(TARGET_NAME continuous_batching_sample) -add_executable(${TARGET_NAME} continuous_batching/main.cpp continuous_batching/paged_attention.cpp) -target_include_directories(${TARGET_NAME} PRIVATE continuous_batching) -target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") -find_package(OpenVINO REQUIRED COMPONENTS Runtime) -target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime) -set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 20) -set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON) - -set(TARGET_NAME benchmark_sample) -add_executable(${TARGET_NAME} continuous_batching/benchmark.cpp continuous_batching/paged_attention.cpp) -target_include_directories(${TARGET_NAME} PRIVATE continuous_batching "${nlohmann_json_SOURCE_DIR}/include") -target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") -find_package(OpenVINO REQUIRED COMPONENTS Runtime) -target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime cxxopts::cxxopts) -set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 20) -set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON) - set(TARGET_NAME greedy_sample) add_executable(${TARGET_NAME} greedy_causal_lm.cpp) target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") diff --git a/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt b/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt index 385e59f7a6..f005ccda1e 100644 --- a/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt @@ -1,6 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +cmake_minimum_required(VERSION 3.15) # start of dependencies add_subdirectory(../../../../../thirdparty/openvino_tokenizers/ "${CMAKE_CURRENT_BINARY_DIR}/openvino_tokenizers/") @@ -31,4 +32,13 @@ target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/s target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) +file(GLOB headers include/*.hpp) +set_target_properties(${TARGET_NAME} PROPERTIES PUBLIC_HEADER "${headers}") + target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime nlohmann_json::nlohmann_json) + +install(TARGETS ${TARGET_NAME} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + PUBLIC_HEADER DESTINATION include) From 053e4227998b6e7a5738f4de69c6ee0be6ca7062 Mon Sep 17 00:00:00 2001 From: rasapala Date: Thu, 25 Apr 2024 10:41:21 +0200 Subject: [PATCH 2/3] Code review --- .../continuous_batching/library/CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt b/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt index f005ccda1e..2841208035 100644 --- a/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt @@ -37,8 +37,14 @@ set_target_properties(${TARGET_NAME} PROPERTIES PUBLIC_HEADER "${headers}") target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime nlohmann_json::nlohmann_json) -install(TARGETS ${TARGET_NAME} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin - PUBLIC_HEADER DESTINATION include) +# +# Installation +# + +include(GNUInstallDirs) + +install(TARGETS ${TARGET_NAME} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) From e5502c37647a5a0b47560337b7852f82703aba11 Mon Sep 17 00:00:00 2001 From: rasapala Date: Thu, 25 Apr 2024 14:14:08 +0200 Subject: [PATCH 3/3] Change to DIRECTORY --- .../cpp/continuous_batching/library/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt b/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt index 2841208035..db77269827 100644 --- a/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt @@ -32,9 +32,6 @@ target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/s target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) -file(GLOB headers include/*.hpp) -set_target_properties(${TARGET_NAME} PROPERTIES PUBLIC_HEADER "${headers}") - target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime nlohmann_json::nlohmann_json) # @@ -46,5 +43,6 @@ include(GNUInstallDirs) install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + +install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.hpp")