From 10694c929afa3082bc9a30ac3fca4ddc14e270d4 Mon Sep 17 00:00:00 2001 From: Ryan McCormick Date: Tue, 27 Feb 2024 14:54:14 -0800 Subject: [PATCH] Add boilerplate for parsing, testing, and wrapping PA (#471) * Add boilerplate code with placeholder for running PA * Add return value for codeql --- src/c++/perf_analyzer/genai-pa/README.md | 30 ++++ .../genai-pa/genai_pa/.gitignore | 2 + .../genai-pa/genai_pa/__init__.py | 27 ++++ .../genai-pa/genai_pa/constants.py | 28 ++++ .../perf_analyzer/genai-pa/genai_pa/main.py | 58 +++++++ .../perf_analyzer/genai-pa/genai_pa/parser.py | 146 ++++++++++++++++++ .../genai-pa/genai_pa/wrapper.py | 56 +++++++ src/c++/perf_analyzer/genai-pa/pyproject.toml | 85 ++++++++++ .../perf_analyzer/genai-pa/tests/test_cli.py | 37 +++++ .../genai-pa/tests/test_library.py | 32 ++++ 10 files changed, 501 insertions(+) create mode 100644 src/c++/perf_analyzer/genai-pa/README.md create mode 100644 src/c++/perf_analyzer/genai-pa/genai_pa/.gitignore create mode 100644 src/c++/perf_analyzer/genai-pa/genai_pa/__init__.py create mode 100644 src/c++/perf_analyzer/genai-pa/genai_pa/constants.py create mode 100755 src/c++/perf_analyzer/genai-pa/genai_pa/main.py create mode 100755 src/c++/perf_analyzer/genai-pa/genai_pa/parser.py create mode 100644 src/c++/perf_analyzer/genai-pa/genai_pa/wrapper.py create mode 100644 src/c++/perf_analyzer/genai-pa/pyproject.toml create mode 100644 src/c++/perf_analyzer/genai-pa/tests/test_cli.py create mode 100644 src/c++/perf_analyzer/genai-pa/tests/test_library.py diff --git a/src/c++/perf_analyzer/genai-pa/README.md b/src/c++/perf_analyzer/genai-pa/README.md new file mode 100644 index 000000000..07f17bf2d --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/README.md @@ -0,0 +1,30 @@ +# genai-pa + +## Installation + +### Install from Source + +```bash +pip install . +``` + +## Quickstart + +```bash +# Explore the commands +genai-pa -h +``` + +## Examples + +``` +# Profile an LLM with hard-coded inputs +genai-pa -m my_llm_model +``` + +## Test + +``` +pip install . +pytest tests/ +``` diff --git a/src/c++/perf_analyzer/genai-pa/genai_pa/.gitignore b/src/c++/perf_analyzer/genai-pa/genai_pa/.gitignore new file mode 100644 index 000000000..973a71df2 --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/genai_pa/.gitignore @@ -0,0 +1,2 @@ +*.json +*.cache diff --git a/src/c++/perf_analyzer/genai-pa/genai_pa/__init__.py b/src/c++/perf_analyzer/genai-pa/genai_pa/__init__.py new file mode 100644 index 000000000..4d50bae64 --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/genai_pa/__init__.py @@ -0,0 +1,27 @@ +# Copyright 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 +# 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. + +__version__ = "0.0.1" diff --git a/src/c++/perf_analyzer/genai-pa/genai_pa/constants.py b/src/c++/perf_analyzer/genai-pa/genai_pa/constants.py new file mode 100644 index 000000000..09686f38f --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/genai_pa/constants.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +# Copyright 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 +# 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. + +LOGGER_NAME: str = "genai-pa" diff --git a/src/c++/perf_analyzer/genai-pa/genai_pa/main.py b/src/c++/perf_analyzer/genai-pa/genai_pa/main.py new file mode 100755 index 000000000..79748df50 --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/genai_pa/main.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +# Copyright 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 +# 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. + +import logging +import sys + +from genai_pa import parser +from genai_pa.constants import LOGGER_NAME + +logging.basicConfig(level=logging.INFO, format="%(name)s - %(levelname)s - %(message)s") +logger = logging.getLogger(LOGGER_NAME) + + +# Separate function that can raise exceptions used for testing +# to assert correct errors and messages. +# Optional argv used for testing - will default to sys.argv if None. +def run(argv=None): + args = parser.parse_args(argv) + args.func(args) + + +def main(): + # Interactive use will catch exceptions and log formatted errors rather than tracebacks. + try: + run() + except Exception as e: + logger.error(f"{e}") + return 1 + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/c++/perf_analyzer/genai-pa/genai_pa/parser.py b/src/c++/perf_analyzer/genai-pa/genai_pa/parser.py new file mode 100755 index 000000000..236891b78 --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/genai_pa/parser.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +# Copyright 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 +# 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. + +import argparse +import logging + +from genai_pa.constants import LOGGER_NAME + +logger = logging.getLogger(LOGGER_NAME) + +### Handlers ### + + +# NOTE: Placeholder +def handler(args): + from genai_pa.wrapper import Profiler + + Profiler.run( + model=args.model, + ) + + +### Parsers ### + + +def add_model_args(parser): + parser.add_argument( + "-m", + "--model", + type=str, + required=True, + help=f"The name of the model to benchmark.", + ) + + +def add_profile_args(parser): + parser.add_argument( + "-b", + "--batch-size", + type=int, + default=1, + required=False, + help="The batch size / concurrency to benchmark. (Default: 1)", + ) + parser.add_argument( + "--input-length", + type=int, + default=128, + required=False, + help="The input length (tokens) to use for benchmarking LLMs. (Default: 128)", + ) + parser.add_argument( + "--output-length", + type=int, + default=128, + required=False, + help="The output length (tokens) to use for benchmarking LLMs. (Default: 128)", + ) + + +def add_endpoint_args(parser): + parser.add_argument( + "--url", + type=str, + default="localhost:8001", + required=False, + help="URL of the endpoint to target for benchmarking.", + ) + parser.add_argument( + "--provider", + type=str, + choices=["triton", "openai"], + required=False, + help="Provider format/schema to use for benchmarking.", + ) + + +def add_dataset_args(parser): + parser.add_argument( + "--dataset", + type=str, + default="OpenOrca", + choices=["OpenOrca", "cnn_dailymail"], + required=False, + help="HuggingFace dataset to use for the benchmark.", + ) + parser.add_argument( + "--tokenizer", + type=str, + default="auto", + choices=["auto"], + required=False, + help="The HuggingFace tokenizer to use to interpret token metrics from final text results", + ) + + +### Entrypoint ### + + +# Optional argv used for testing - will default to sys.argv if None. +def parse_args(argv=None): + parser = argparse.ArgumentParser( + prog="genai-pa", + description="CLI to profile LLMs and Generative AI models with PA", + ) + parser.set_defaults(func=handler) + + # Conceptually group args for easier visualization + model_group = parser.add_argument_group("Model") + add_model_args(model_group) + + profile_group = parser.add_argument_group("Profiling") + add_profile_args(profile_group) + + endpoint_group = parser.add_argument_group("Endpoint") + add_endpoint_args(endpoint_group) + + dataset_group = parser.add_argument_group("Dataset") + add_dataset_args(dataset_group) + + args = parser.parse_args(argv) + return args diff --git a/src/c++/perf_analyzer/genai-pa/genai_pa/wrapper.py b/src/c++/perf_analyzer/genai-pa/genai_pa/wrapper.py new file mode 100644 index 000000000..8e466b1fd --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/genai_pa/wrapper.py @@ -0,0 +1,56 @@ +# Copyright 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 +# 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. + +import json +import logging +import subprocess + +from genai_pa.constants import LOGGER_NAME + +logger = logging.getLogger(LOGGER_NAME) + + +class Profiler: + @staticmethod + def run(model): + # TODO: Replace with other plumbing + input_file = "/tmp/input_data.json" + with open(input_file, "w") as f: + data = {"data": [{"text_input": ["hi"]}]} + json.dump(data, f) + + cmd = [ + "perf_analyzer", + "-i", + "grpc", + "--streaming", + "-m", + model, + "--input-data", + input_file, + ] + logger.info(f"Running Perf Analyzer : '{cmd}'") + subprocess.run(cmd) diff --git a/src/c++/perf_analyzer/genai-pa/pyproject.toml b/src/c++/perf_analyzer/genai-pa/pyproject.toml new file mode 100644 index 000000000..f6bfc850c --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/pyproject.toml @@ -0,0 +1,85 @@ +# Copyright 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 +# 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. + +[project] +name = "genai-pa" +readme = "README.md" +description = "GenAI Perf Analyzer CLI - CLI tool to simplify profiling LLMs and Generative AI models with Perf Analyzer" +dynamic = ["version"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "Topic :: Software Development", + "Topic :: Scientific/Engineering", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.10", + "Operating System :: Unix", +] +authors = [] +maintainers = [] +keywords = [] +requires-python = ">=3.8,<4" +dependencies = [ + "numpy", + "rich" +] + +# CLI Entrypoint +[project.scripts] +genai-pa = "genai_pa.main:main" + +[project.urls] +"Homepage" = "https://github.com/triton-inference-server/" +"Bug Tracker" = "https://github.com/triton-inference-server/server/issues" + +# Build +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.version] +path = "genai_pa/__init__.py" + +# Pre-commit hook tool configs +[tool.codespell] +# note: pre-commit passes explicit lists of files here, which this skip file list doesn't override - +# this is only to allow you to run codespell interactively +skip = "./.git,./.github" +# ignore short words, and typename parameters like OffsetT +ignore-regex = "\\b(.{1,4}|[A-Z]\\w*T)\\b" +# use the 'clear' dictionary for unambiguous spelling mistakes +builtin = "clear" +# disable warnings about binary files and wrong encoding +quiet-level = 3 + +# Linting/formatting +[tool.ruff] +# Same as Black. +line-length = 88 +indent-width = 4 diff --git a/src/c++/perf_analyzer/genai-pa/tests/test_cli.py b/src/c++/perf_analyzer/genai-pa/tests/test_cli.py new file mode 100644 index 000000000..cddbb70f9 --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/tests/test_cli.py @@ -0,0 +1,37 @@ +# Copyright 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 +# 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. + +import pytest +from genai_pa.main import run + + +# NOTE: Placeholder +class TestHelp: + @pytest.mark.parametrize("arg", ["-h", "--help"]) + def test_help(self, arg): + args = [arg] + with pytest.raises(SystemExit): + run(args) diff --git a/src/c++/perf_analyzer/genai-pa/tests/test_library.py b/src/c++/perf_analyzer/genai-pa/tests/test_library.py new file mode 100644 index 000000000..36c7624b1 --- /dev/null +++ b/src/c++/perf_analyzer/genai-pa/tests/test_library.py @@ -0,0 +1,32 @@ +# Copyright 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 +# 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. + +import genai_pa + + +# Placeholder to add real tests in the future +def test_version(): + print(genai_pa.__version__)