Skip to content

Commit

Permalink
Fixed Android build (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov authored Sep 4, 2024
1 parent 6a41498 commit d30f62f
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 23 deletions.
8 changes: 5 additions & 3 deletions samples/cpp/beam_search_causal_lm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright (C) 2023-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

find_package(OpenVINOGenAI REQUIRED PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
find_package(OpenVINOGenAI REQUIRED
HINTS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
NO_CMAKE_FIND_ROOT_PATH
)

add_executable(beam_search_causal_lm beam_search_causal_lm.cpp)
Expand Down
8 changes: 5 additions & 3 deletions samples/cpp/benchmark_genai/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright (C) 2023-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

find_package(OpenVINOGenAI REQUIRED PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
find_package(OpenVINOGenAI REQUIRED
PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
NO_CMAKE_FIND_ROOT_PATH
)

include(FetchContent)
Expand Down
8 changes: 5 additions & 3 deletions samples/cpp/chat_sample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright (C) 2023-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

find_package(OpenVINOGenAI REQUIRED PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
find_package(OpenVINOGenAI REQUIRED
PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
NO_CMAKE_FIND_ROOT_PATH
)

add_executable(chat_sample chat_sample.cpp)
Expand Down
8 changes: 5 additions & 3 deletions samples/cpp/greedy_causal_lm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright (C) 2023-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

find_package(OpenVINOGenAI REQUIRED PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
find_package(OpenVINOGenAI REQUIRED
PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
NO_CMAKE_FIND_ROOT_PATH
)

add_executable(greedy_causal_lm greedy_causal_lm.cpp)
Expand Down
8 changes: 5 additions & 3 deletions samples/cpp/multinomial_causal_lm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright (C) 2023-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

find_package(OpenVINOGenAI REQUIRED PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
find_package(OpenVINOGenAI REQUIRED
PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
NO_CMAKE_FIND_ROOT_PATH
)

add_executable(multinomial_causal_lm multinomial_causal_lm.cpp)
Expand Down
8 changes: 5 additions & 3 deletions samples/cpp/prompt_lookup_decoding_lm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

find_package(OpenVINO REQUIRED COMPONENTS Runtime Threading)

find_package(OpenVINOGenAI REQUIRED PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
find_package(OpenVINOGenAI REQUIRED
PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
NO_CMAKE_FIND_ROOT_PATH
)

add_executable(prompt_lookup_decoding_lm prompt_lookup_decoding_lm.cpp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ int main(int argc, char* argv[]) try {
ov::Tensor position_ids = model.get_tensor("position_ids");
position_ids.set_shape(input_ids.get_shape());
std::iota(position_ids.data<int64_t>(), position_ids.data<int64_t>() + position_ids.get_size(), 0);
uint64_t seq_len = input_ids.get_shape()[1];
size_t seq_len = input_ids.get_shape()[1];

// set beam_idx for stateful model: no beam search is used and BATCH_SIZE = 1
model.get_tensor("beam_idx").set_shape({BATCH_SIZE});
Expand Down
8 changes: 5 additions & 3 deletions samples/cpp/speculative_decoding_lm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

find_package(OpenVINO REQUIRED COMPONENTS Runtime Threading)

find_package(OpenVINOGenAI REQUIRED PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
find_package(OpenVINOGenAI REQUIRED
PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
NO_CMAKE_FIND_ROOT_PATH
)

add_executable(speculative_decoding_lm speculative_decoding_lm.cpp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int main(int argc, char* argv[]) try {

ov::InferRequest draft_model = core.compile_model(ov_draft_model, "CPU").create_infer_request();

uint64_t seq_len = input_ids.get_shape()[1];
size_t seq_len = input_ids.get_shape()[1];

// main model (which is bigger, more accurate but slower)
std::shared_ptr<ov::Model> ov_main_model = core.read_model(std::string{argv[2]} + "/openvino_model.xml");
Expand Down
3 changes: 3 additions & 0 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ function(ov_genai_build_jinja2cpp)
set(JINJA2CPP_STRICT_WARNINGS OFF CACHE BOOL "")
set(JINJA2CPP_PIC ON CACHE BOOL "")

# TMP WA:
set(RapidJSON_DIR "${CMAKE_BINARY_DIR}/_deps/rapidjson-build")

# options for Jinja2Cpp dependencies
option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." OFF)

Expand Down

0 comments on commit d30f62f

Please sign in to comment.