Skip to content

Commit bb21d68

Browse files
committed
add sample test in python_tests and update comments in src files
1 parent d7ead62 commit bb21d68

File tree

8 files changed

+15
-4
lines changed

8 files changed

+15
-4
lines changed

.github/workflows/linux.yml

+1
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ jobs:
380380
LD_LIBRARY_PATH: "${{ env.INSTALL_DIR }}/runtime/lib/intel64:${{ env.INSTALL_DIR }}/runtime/3rdparty/tbb/lib:$LD_LIBRARY_PATH" # Required for C++ samples
381381
SAMPLES_PY_DIR: "${{ env.INSTALL_DIR }}/samples/python"
382382
SAMPLES_CPP_DIR: "${{ env.INSTALL_DIR }}/samples_bin"
383+
SAMPLES_C_DIR: "${{ env.INSTALL_DIR }}/samples/c"
383384

384385
genai_build_nodejs_bindings:
385386
name: Build Node.js bindings

.github/workflows/mac.yml

+1
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ jobs:
396396
env:
397397
SAMPLES_PY_DIR: "${{ env.INSTALL_DIR }}/samples/python"
398398
SAMPLES_CPP_DIR: "${{ env.INSTALL_DIR }}/samples_bin"
399+
SAMPLES_C_DIR: "${{ env.INSTALL_DIR }}/samples/c"
399400

400401
Overall_Status:
401402
name: ci/gha_overall_status_macos

.github/workflows/windows.yml

+1
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ jobs:
475475
PATH: "${{ env.INSTALL_DIR }}/runtime/bin/intel64/${{ matrix.build-type }};${{ env.INSTALL_DIR }}/runtime/3rdparty/tbb/bin;%PATH%" # Required for C++ samples
476476
SAMPLES_PY_DIR: "${{ env.INSTALL_DIR }}/samples/python"
477477
SAMPLES_CPP_DIR: "${{ env.INSTALL_DIR }}/samples_bin"
478+
SAMPLES_C_DIR: "${{ env.INSTALL_DIR }}/samples/c"
478479

479480
genai_nodejs_tests:
480481
name: Node.js bindings tests

src/c/include/openvino/genai/c/llm_pipeline_c.h

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ OPENVINO_GENAI_C_EXPORTS ov_status_e ov_genai_llm_pipeline_create(const char* mo
7575
const char* device,
7676
ov_genai_llm_pipeline** pipe);
7777

78+
// TODO: Add 'const ov::AnyMap& properties' as an input argument when creating ov_genai_llm_pipeline.
79+
7880
/**
7981
* @brief Release the memory allocated by ov_genai_llm_pipeline.
8082
* @param model A pointer to the ov_genai_llm_pipeline.

src/c/include/openvino/genai/c/perf_metrics_c.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ ov_genai_perf_metrics_get_detokenization_duration(const ov_genai_perf_metrics* m
132132
/**
133133
* @brief C interface for PerfMetrics& operator+=(const PerfMetrics& right)
134134
*
135-
* This function adds the PerfMetrics from 'right' to 'left' in place.
135+
* This function adds the PerfMetrics from 'right' to 'left' in place. Equivalent to ov::genai::PerfMetrics&
136+
* operator+=(const ov::genai::PerfMetrics&);
136137
*
137138
* @param left A pointer to the ov_genai_perf_metrics that will be updated.
138139
* @param right A pointer to the ov_genai_perf_metrics whose metrics will be added to 'left'.

src/c/src/perf_metrics_c.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ ov_status_e ov_genai_perf_metrics_get_detokenization_duration(const ov_genai_per
166166
}
167167
return ov_status_e::OK;
168168
}
169-
170-
// PerfMetrics& operator+=(const PerfMetrics& right);
171169
ov_status_e ov_genai_perf_metrics_add_in_place(ov_genai_perf_metrics* left, const ov_genai_perf_metrics* right) {
172170
if (!left || !(left->object) || !right || !(right->object)) {
173171
return ov_status_e::INVALID_C_PARAM;

tests/python_tests/samples/conftest.py

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262

6363
SAMPLES_PY_DIR = os.environ.get("SAMPLES_PY_DIR", os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../samples/python")))
6464
SAMPLES_CPP_DIR = os.environ.get("SAMPLES_CPP_DIR", os.getcwd())
65+
SAMPLES_C_DIR = os.environ.get("SAMPLES_C_DIR", os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../samples/c")))
6566

6667
@pytest.fixture(scope="session", autouse=True)
6768
def setup_and_teardown(request, tmp_path_factory):

tests/python_tests/samples/test_greedy_causal_lm.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66
import sys
77

8-
from conftest import SAMPLES_PY_DIR, SAMPLES_CPP_DIR
8+
from conftest import SAMPLES_PY_DIR, SAMPLES_CPP_DIR, SAMPLES_C_DIR
99
from test_utils import run_sample
1010

1111
class TestGreedyCausalLM:
@@ -31,5 +31,11 @@ def test_sample_greedy_causal_lm(self, convert_model, sample_args):
3131
cpp_command =[cpp_sample, convert_model, sample_args]
3232
cpp_result = run_sample(cpp_command)
3333

34+
# Test C sample
35+
c_sample = os.path.join(SAMPLES_C_DIR, "text_generation/greedy_causal_lm_c")
36+
c_command =[c_sample, convert_model, sample_args]
37+
c_result = run_sample(c_command)
38+
3439
# Compare results
3540
assert py_result.stdout == cpp_result.stdout, f"Results should match"
41+
assert cpp_result.stdout == c_result.stdout, f"Results should match"

0 commit comments

Comments
 (0)