diff --git a/.clang-format b/.clang-format index 500df0bbe0..72452caa72 100644 --- a/.clang-format +++ b/.clang-format @@ -58,7 +58,6 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 2 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true -DerivePointerAlignment: true DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true @@ -158,7 +157,7 @@ SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: c++17 +Standard: c++20 StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION diff --git a/.clang-tidy b/.clang-tidy index 16b33553ac..590f1a05b7 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -181,7 +181,7 @@ CheckOptions: - key: readability-identifier-naming.TypeTemplateParameterCase value: CamelCase - key: readability-identifier-naming.TypeTemplateParameterIgnoredRegexp - value: ^[A-Z]$ + value: '^([A-Z]|expr-type)$' - key: readability-identifier-naming.TypeTemplateParameterPrefix value: '' - key: readability-identifier-naming.TypeTemplateParameterSuffix diff --git a/CMakeLists.txt b/CMakeLists.txt index 881a895c17..cf17c51229 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ set(MORPHEUS_PY_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/wheel" CACHE STRING "Lo set(MORPHEUS_CACHE_DIR "${CMAKE_SOURCE_DIR}/.cache" CACHE PATH "Directory to contain all CPM and CCache data") mark_as_advanced(MORPHEUS_CACHE_DIR) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/ci/conda/recipes/morpheus/morpheus_build.sh b/ci/conda/recipes/morpheus/morpheus_build.sh index 08fe262fd5..9f1202c57f 100644 --- a/ci/conda/recipes/morpheus/morpheus_build.sh +++ b/ci/conda/recipes/morpheus/morpheus_build.sh @@ -23,7 +23,7 @@ CMAKE_ARGS=${CMAKE_ARGS:-""} export CCACHE_BASEDIR=$(realpath ${SRC_DIR}/..) export USE_SCCACHE=${USE_SCCACHE:-""} -# Check for some srf environment variables. Append to front of args to allow users to overwrite them +# Check for some mrc environment variables. Append to front of args to allow users to overwrite them if [[ -n "${MORPHEUS_CACHE_DIR}" ]]; then # Set the cache variable, then set the Staging prefix to allow for host searching CMAKE_ARGS="-DMORPHEUS_CACHE_DIR=${MORPHEUS_CACHE_DIR} ${CMAKE_ARGS}" diff --git a/ci/iwyu/mappings.imp b/ci/iwyu/mappings.imp index 2fa46c3a69..7390bc26a2 100644 --- a/ci/iwyu/mappings.imp +++ b/ci/iwyu/mappings.imp @@ -1,11 +1,11 @@ [ ## Include mappings -# srf protos -{ "include": [ "\"srf/protos/architect.pb.h\"", private, "", "public" ] }, -{ "include": [ "\"srf/protos/codable.pb.h\"", private, "", "public" ] }, -{ "include": [ "\"srf/protos/remote_descriptor.pb.h\"", private, "", "public" ] }, -{ "include": [ "\"srf/protos/tensor_meta_data.pb.h\"", private, "", "public" ] }, +# mrc protos +{ "include": [ "\"mrc/protos/architect.pb.h\"", private, "", "public" ] }, +{ "include": [ "\"mrc/protos/codable.pb.h\"", private, "", "public" ] }, +{ "include": [ "\"mrc/protos/remote_descriptor.pb.h\"", private, "", "public" ] }, +{ "include": [ "\"mrc/protos/tensor_meta_data.pb.h\"", private, "", "public" ] }, # stdlib { "include": [ "", private, "", "public" ] }, @@ -138,7 +138,7 @@ # xtensor { "symbol": ["xt::no_ownership", "private", "", "public"] }, -# srf -{ "symbol": ["std::__decay_and_strip &>::__type" , "private", "", "public"] }, +# mrc +{ "symbol": ["std::__decay_and_strip &>::__type" , "private", "", "public"] }, ] diff --git a/ci/scripts/common.sh b/ci/scripts/common.sh index 575c6d915e..74de0d779c 100644 --- a/ci/scripts/common.sh +++ b/ci/scripts/common.sh @@ -45,11 +45,18 @@ export BUILD_DIR=${BUILD_DIR:-"${REPO_DIR}/build"} # Speficy the clang-tools version to use. Default 14 export CLANG_TOOLS_VERSION=${CLANG_TOOLS_VERSION:-14} +# Returns the `branch-YY.MM` that is used as the base for merging +function get_base_branch() { + local major_minor_version=$(git describe --tags | grep -o -E '[0-9][0-9]\.[0-9][0-9]') + + echo "branch-${major_minor_version}" +} + # Determine the merge base as the root to compare against. Optionally pass in a # result variable otherwise the output is printed to stdout function get_merge_base() { local __resultvar=$1 - local result=$(git merge-base ${BASE_SHA:-main} ${COMMIT_SHA:-HEAD}) + local result=$(git merge-base ${BASE_SHA:-$(get_merge_base)} ${COMMIT_SHA:-HEAD}) if [[ "$__resultvar" ]]; then eval $__resultvar="'${result}'" diff --git a/ci/scripts/gitutils.py b/ci/scripts/gitutils.py index 59cfe11b30..97c6d31782 100755 --- a/ci/scripts/gitutils.py +++ b/ci/scripts/gitutils.py @@ -1,4 +1,4 @@ -#! /bin/env python3 +#!/usr/bin/env python3 # SPDX-FileCopyrightText: Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 8976d8dcc3..62a16d78c6 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -101,10 +101,10 @@ include(deps/Configure_pybind11) set(RDKAFKA_VERSION 1.6.2) include(deps/Configure_rdkafka) -# SRF (Should come after all third party but before NVIDIA repos) +# MRC (Should come after all third party but before NVIDIA repos) # ===== -set(SRF_VERSION 22.11 CACHE STRING "Which version of SRF to use") -include(deps/Configure_srf) +set(MRC_VERSION 23.01 CACHE STRING "Which version of MRC to use") +include(deps/Configure_mrc) # CuDF # ===== diff --git a/cmake/deps/Configure_srf.cmake b/cmake/deps/Configure_mrc.cmake similarity index 54% rename from cmake/deps/Configure_srf.cmake rename to cmake/deps/Configure_mrc.cmake index fc3a7c2b0f..971bf54465 100644 --- a/cmake/deps/Configure_srf.cmake +++ b/cmake/deps/Configure_mrc.cmake @@ -14,36 +14,36 @@ # limitations under the License. #============================================================================= -function(find_and_configure_srf version) +function(find_and_configure_mrc version) - list(APPEND CMAKE_MESSAGE_CONTEXT "srf") + list(APPEND CMAKE_MESSAGE_CONTEXT "mrc") - rapids_cpm_find(srf ${version} + rapids_cpm_find(mrc ${version} CONFIG REQUIRED GLOBAL_TARGETS - srf::srf srf::pysrf + mrc::mrc mrc::pymrc BUILD_EXPORT_SET ${PROJECT_NAME}-exports INSTALL_EXPORT_SET ${PROJECT_NAME}-exports CPM_ARGS - GIT_REPOSITORY https://github.com/nv-morpheus/SRF.git + GIT_REPOSITORY https://github.com/nv-morpheus/MRC.git GIT_TAG branch-${version} GIT_SHALLOW TRUE - OPTIONS "SRF_BUILD_EXAMPLES OFF" - "SRF_BUILD_TESTS OFF" - "SRF_BUILD_BENCHMARKS OFF" - "SRF_BUILD_PYTHON ON" - "SRF_ENABLE_XTENSOR ON" - "SRF_ENABLE_MATX ON" - "SRF_USE_CONDA ${MORPHEUS_USE_CONDA}" - "SRF_USE_CCACHE ${MORPHEUS_USE_CCACHE}" - "SRF_USE_CLANG_TIDY ${MORPHEUS_USE_CLANG_TIDY}" - "SRF_PYTHON_INPLACE_BUILD OFF" - "SRF_PYTHON_PERFORM_INSTALL ON" - "SRF_PYTHON_BUILD_STUBS ${MORPHEUS_BUILD_PYTHON_STUBS}" + OPTIONS "MRC_BUILD_EXAMPLES OFF" + "MRC_BUILD_TESTS OFF" + "MRC_BUILD_BENCHMARKS OFF" + "MRC_BUILD_PYTHON ON" + "MRC_ENABLE_XTENSOR ON" + "MRC_ENABLE_MATX ON" + "MRC_USE_CONDA ${MORPHEUS_USE_CONDA}" + "MRC_USE_CCACHE ${MORPHEUS_USE_CCACHE}" + "MRC_USE_CLANG_TIDY ${MORPHEUS_USE_CLANG_TIDY}" + "MRC_PYTHON_INPLACE_BUILD OFF" + "MRC_PYTHON_PERFORM_INSTALL ON" + "MRC_PYTHON_BUILD_STUBS ${MORPHEUS_BUILD_PYTHON_STUBS}" "RMM_VERSION ${MORPHEUS_RAPIDS_VERSION}" ) endfunction() -find_and_configure_srf(${SRF_VERSION}) +find_and_configure_MRC(${MRC_VERSION}) diff --git a/docker/conda/environments/cuda11.5_dev.yml b/docker/conda/environments/cuda11.5_dev.yml index 9b9716fec2..ec75273112 100644 --- a/docker/conda/environments/cuda11.5_dev.yml +++ b/docker/conda/environments/cuda11.5_dev.yml @@ -29,10 +29,10 @@ dependencies: - ccache>=3.7 - clangdev=14 - click >=8 - - cmake=3.22 + - cmake=3.24 - configargparse=1.5 - cuda-nvml-dev=11.5 - - cuda-python<=11.7.0 # Remove when Issue #251 is closed + - cuda-python<=11.5.0 # Remove when Issue #251 is closed - cudatoolkit=11.5 - cudf 22.08 - cupy=9.5.0 @@ -43,30 +43,32 @@ dependencies: - faker=12.3.0 - flake8 - flatbuffers=2.0 - - gcc_linux-64=9.4 + - gcc_linux-64=11.2 - gflags=2.2 - - git>=2.35.3 # Needed for wildcards on safe.directory - git-lfs=3.2 + - git>=2.35.3 # Needed for wildcards on safe.directory - glog=0.6 - gmock=1.10 - gputil - grpc-cpp>=1.43 - grpcio - gtest=1.10 - - gxx_linux-64=9.4 + - gxx_linux-64=11.2 - include-what-you-use=0.18 - isort - librdkafka=1.7.0 - mlflow>1.29,<2 + - mrc=23.01 - myst-parser==0.17 - networkx=2.8 - ninja=1.10 - nodejs=17.4.0 - numba==0.55 - numpydoc=1.4 + - nvcc_linux-64=11.5 - pandas=1.3 - pip - - pkg-config # for srf cmake + - pkg-config # for mrc cmake - pluggy=1.0 - protobuf=3.20 - pybind11-stubgen=0.10.5 @@ -81,7 +83,6 @@ dependencies: - scikit-build=0.13 - sphinx - sphinx_rtd_theme - - srf 22.11.* - sysroot_linux-64=2.17 - tqdm=4 - typing_utils=0.1 diff --git a/docs/source/developer_guide/guides/1_simple_python_stage.md b/docs/source/developer_guide/guides/1_simple_python_stage.md index 99790e7313..20166ea322 100644 --- a/docs/source/developer_guide/guides/1_simple_python_stage.md +++ b/docs/source/developer_guide/guides/1_simple_python_stage.md @@ -34,7 +34,7 @@ We start our class definition with a few basic imports: ```python import typing -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.pipeline.single_port_stage import SinglePortStage @@ -75,7 +75,7 @@ Our `on_data` method accepts the incoming message and returns a message. The ret Finally, the `_build_single` method will be used at build time to wire our stage into the pipeline. `_build_single` receives an instance of the SRF pipeline segment along with a `StreamPair` instance. We will be using the segment instance to build a node from our stage and add it to the pipeline segment. The `StreamPair` argument is a tuple; the first element is our parent node, and the second is our parent node's output type. The return type of this method is also a `StreamPair`. Typically, we will be returning our newly constructed node along with our output type. ```python - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_node(self.unique_name, self.on_data) builder.make_edge(input_stream[0], node) @@ -101,7 +101,7 @@ return node, input_stream[1] ```python import typing -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.pipeline.single_port_stage import SinglePortStage @@ -128,7 +128,7 @@ class PassThruStage(SinglePortStage): # Return the message for the next stage return message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_node(self.unique_name, self.on_data) builder.make_edge(input_stream[0], node) diff --git a/docs/source/developer_guide/guides/2_real_world_phishing.md b/docs/source/developer_guide/guides/2_real_world_phishing.md index 5cb4dcde45..d5f78d7155 100644 --- a/docs/source/developer_guide/guides/2_real_world_phishing.md +++ b/docs/source/developer_guide/guides/2_real_world_phishing.md @@ -84,7 +84,7 @@ Our `_build_single` method remains unchanged; even though we are modifying the i ```python import typing -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.messages.message_meta import MessageMeta @@ -125,7 +125,7 @@ class RecipientFeaturesStage(SinglePortStage): # Return the message for the next stage return message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_node(self.unique_name, self.on_data) builder.make_edge(input_stream[0], node) @@ -455,7 +455,7 @@ In this example, we will create a source that reads messages from a [RabbitMQ](h The `_build_source` method is similar to the `_build_single` method; it receives an instance of the pipeline segment and returns a `StreamPair`. However, unlike in the previous examples, source stages do not have parent stages and therefore do not receive a `StreamPair` as input. We also will no longer build our node by calling `make_node`. Instead, we will call `make_source` with the parameter `self.source_generator`, which is a method that we will define next. ```python -def _build_source(self, builder: srf.Builder) -> StreamPair: +def _build_source(self, builder: mrc.Builder) -> StreamPair: node = builder.make_source(self.unique_name, self.source_generator) return node, MessageMeta ``` @@ -498,7 +498,7 @@ from io import StringIO import cudf import pandas as pd import pika -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -568,7 +568,7 @@ class RabbitMQSourceStage(SingleOutputSource): return super().stop() - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: node = builder.make_source(self.unique_name, self.source_generator) return node, MessageMeta @@ -605,7 +605,7 @@ class WriteToRabbitMQStage(SinglePortStage): In our `_build_single` we will be making use of the `make_sink` method rather than `make_node` or `make_source` ```python -def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: +def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_sink(self.unique_name, self.on_data, self.on_error, self.on_complete) builder.make_edge(input_stream[0], node) return input_stream @@ -647,7 +647,7 @@ import typing from io import StringIO import pika -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -697,7 +697,7 @@ class WriteToRabbitMQStage(SinglePortStage): def supports_cpp_node(self) -> bool: return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_sink(self.unique_name, self.on_data, self.on_error, self.on_complete) builder.make_edge(input_stream[0], node) return input_stream diff --git a/docs/source/developer_guide/guides/3_simple_cpp_stage.md b/docs/source/developer_guide/guides/3_simple_cpp_stage.md index f384f347ed..91209575c2 100644 --- a/docs/source/developer_guide/guides/3_simple_cpp_stage.md +++ b/docs/source/developer_guide/guides/3_simple_cpp_stage.md @@ -59,7 +59,7 @@ template // by default, emit type == class PythonNode : ... ``` -Both the `PythonSource` and `PythonNode` classes are defined in the `pysrf/node.hpp` header. +Both the `PythonSource` and `PythonNode` classes are defined in the `pymrc/node.hpp` header. Note: `SourceT` and `SinkT` types are typically `shared_ptr`s to a Morpheus message type. For example, `std::shared_ptr`. This allows the reference counting mechanisms used in Python and C++ to share the same count, properly cleaning up the objects when they are no longer referenced. @@ -77,9 +77,9 @@ To start with, we have our Morpheus and SRF-specific includes: ```cpp #include // for MultiMessage -#include // for PythonNode -#include // for Segment Builder -#include // for Segment Object +#include // for PythonNode +#include // for Segment Builder +#include // for Segment Object ``` We'll want to define our stage in its own namespace. In this case, we will name it `morpheus_example`, giving us a namespace and class definition like: @@ -92,10 +92,10 @@ namespace morpheus_example { using namespace morpheus; -class PassThruStage : public srf::pysrf::PythonNode, std::shared_ptr> +class PassThruStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: - using base_t = srf::pysrf::PythonNode, std::shared_ptr>; + using base_t = mrc::pymrc::PythonNode, std::shared_ptr>; using base_t::sink_type_t; using base_t::source_type_t; using base_t::subscribe_fn_t; @@ -123,7 +123,7 @@ We will also define an interface proxy object to keep the class definition separ ```cpp struct PassThruStageInterfaceProxy { - static std::shared_ptr> init(srf::segment::Builder &builder, + static std::shared_ptr> init(mrc::segment::Builder &builder, const std::string &name); }; ``` @@ -136,9 +136,9 @@ Putting it all together, our header file looks like this: #pragma once #include // for MultiMessage -#include // for PythonNode -#include // for Segment Builder -#include // for Segment Object +#include // for PythonNode +#include // for Segment Builder +#include // for Segment Object #include #include @@ -150,10 +150,10 @@ namespace morpheus_example { using namespace morpheus; -class PassThruStage : public srf::pysrf::PythonNode, std::shared_ptr> +class PassThruStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: - using base_t = srf::pysrf::PythonNode, std::shared_ptr>; + using base_t = mrc::pymrc::PythonNode, std::shared_ptr>; using base_t::sink_type_t; using base_t::source_type_t; using base_t::subscribe_fn_t; @@ -165,7 +165,7 @@ class PassThruStage : public srf::pysrf::PythonNode> init(srf::segment::Builder &builder, + static std::shared_ptr> init(mrc::segment::Builder &builder, const std::string &name); }; @@ -181,7 +181,7 @@ Our includes section looks like: #include "pass_thru.hpp" #include -#include // for pysrf::import +#include // for pymrc::import #include ``` @@ -242,11 +242,11 @@ We scoped the acquisition of the GIL such that it is held only for the parts of ### Python Proxy and Interface The things that all proxy interfaces need to do are: -1. Construct the stage using the `srf::segment::Builder::construct_object` method -2. Return a `shared_ptr` to the stage wrapped in a `srf::segment::Object` +1. Construct the stage using the `mrc::segment::Builder::construct_object` method +2. Return a `shared_ptr` to the stage wrapped in a `mrc::segment::Object` ```cpp -std::shared_ptr> PassThruStageInterfaceProxy::init(srf::segment::Builder& builder, +std::shared_ptr> PassThruStageInterfaceProxy::init(mrc::segment::Builder& builder, const std::string& name) { return builder.construct_object(name); @@ -261,11 +261,11 @@ namespace py = pybind11; // Define the pybind11 module m. PYBIND11_MODULE(morpheus_example, m) { - srf::pysrf::import(m, "morpheus._lib.messages"); + mrc::pymrc::import(m, "morpheus._lib.messages"); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>(m, "PassThruStage", py::multiple_inheritance()) + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>(m, "PassThruStage", py::multiple_inheritance()) .def(py::init<>(&PassThruStageInterfaceProxy::init), py::arg("builder"), py::arg("name")); } ``` @@ -276,7 +276,7 @@ PYBIND11_MODULE(morpheus_example, m) #include "pass_thru.hpp" #include -#include // for pysrf::import +#include // for pymrc::import #include @@ -294,7 +294,7 @@ PassThruStage::subscribe_fn_t PassThruStage::build_operator() }; } -std::shared_ptr> PassThruStageInterfaceProxy::init(srf::segment::Builder& builder, +std::shared_ptr> PassThruStageInterfaceProxy::init(mrc::segment::Builder& builder, const std::string& name) { return builder.construct_object(name); @@ -305,11 +305,11 @@ namespace py = pybind11; // Define the pybind11 module m. PYBIND11_MODULE(morpheus_example, m) { - srf::pysrf::import(m, "morpheus._lib.messages"); + mrc::pymrc::import(m, "morpheus._lib.messages"); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>(m, "PassThruStage", py::multiple_inheritance()) + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>(m, "PassThruStage", py::multiple_inheritance()) .def(py::init<>(&PassThruStageInterfaceProxy::init), py::arg("builder"), py::arg("name")); } @@ -331,7 +331,7 @@ def supports_cpp_node(self): return True ``` ```python -def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: +def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: if self._build_cpp_node(): print("building C++ node") node = morpheus_example_cpp.PassThruStage(builder, self.unique_name) diff --git a/docs/source/developer_guide/guides/4_source_cpp_stage.md b/docs/source/developer_guide/guides/4_source_cpp_stage.md index 0eec6e9dde..787c66e0d8 100644 --- a/docs/source/developer_guide/guides/4_source_cpp_stage.md +++ b/docs/source/developer_guide/guides/4_source_cpp_stage.md @@ -29,9 +29,9 @@ Our includes section looks like: #include // for AmqpClient::Channel::ptr_t #include // for cudf::io::table_with_metadata #include // for MessageMeta -#include // for srf::pysrf::PythonSource -#include // for Segment Builder -#include // for Segment Object +#include // for mrc::pymrc::PythonSource +#include // for Segment Builder +#include // for Segment Object #include // for chrono::milliseconds #include // for shared_ptr @@ -51,10 +51,10 @@ namespace morpheus_rabbit { using namespace std::literals; using namespace morpheus; -class RabbitMQSourceStage : public srf::pysrf::PythonSource> +class RabbitMQSourceStage : public mrc::pymrc::PythonSource> { public: - using base_t = srf::pysrf::PythonSource>; + using base_t = mrc::pymrc::PythonSource>; using typename base_t::source_type_t; using typename base_t::subscriber_fn_t; ``` @@ -100,9 +100,9 @@ Wrapping it all together, our header file should be similar to: #include // for AmqpClient::Channel::ptr_t #include // for cudf::io::table_with_metadata #include // for MessageMeta -#include // for srf::pysrf::PythonSource -#include // for Segment Builder -#include // for Segment Object +#include // for mrc::pymrc::PythonSource +#include // for Segment Builder +#include // for Segment Object #include // for chrono::milliseconds #include // for shared_ptr @@ -116,10 +116,10 @@ namespace morpheus_rabbit { using namespace std::literals; using namespace morpheus; -class RabbitMQSourceStage : public srf::pysrf::PythonSource> +class RabbitMQSourceStage : public mrc::pymrc::PythonSource> { public: - using base_t = srf::pysrf::PythonSource>; + using base_t = mrc::pymrc::PythonSource>; using typename base_t::source_type_t; using typename base_t::subscriber_fn_t; @@ -151,7 +151,7 @@ struct RabbitMQSourceStageInterfaceProxy /** * @brief Create and initialize a RabbitMQSourceStage, and return the result. */ - static std::shared_ptr> init(srf::segment::Builder &builder, + static std::shared_ptr> init(mrc::segment::Builder &builder, const std::string &name, const std::string &host, const std::string &exchange, @@ -300,8 +300,8 @@ void RabbitMQSourceStage::close() ## Python Proxy & Interface ```cpp -std::shared_ptr> RabbitMQSourceStageInterfaceProxy::init( - srf::segment::Builder &builder, +std::shared_ptr> RabbitMQSourceStageInterfaceProxy::init( + mrc::segment::Builder &builder, const std::string &name, const std::string &host, const std::string &exchange, @@ -318,11 +318,11 @@ namespace py = pybind11; // Define the pybind11 module m. PYBIND11_MODULE(morpheus_rabbit, m) { - srf::pysrf::import(m, "morpheus._lib.messages"); + mrc::pymrc::import(m, "morpheus._lib.messages"); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "RabbitMQSourceStage", py::multiple_inheritance()) .def(py::init<>(&RabbitMQSourceStageInterfaceProxy::init), py::arg("builder"), @@ -428,8 +428,8 @@ void RabbitMQSourceStage::close() } } -std::shared_ptr> RabbitMQSourceStageInterfaceProxy::init( - srf::segment::Builder &builder, +std::shared_ptr> RabbitMQSourceStageInterfaceProxy::init( + mrc::segment::Builder &builder, const std::string &name, const std::string &host, const std::string &exchange, @@ -446,11 +446,11 @@ namespace py = pybind11; // Define the pybind11 module m. PYBIND11_MODULE(morpheus_rabbit, m) { - srf::pysrf::import(m, "morpheus._lib.messages"); + mrc::pymrc::import(m, "morpheus._lib.messages"); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "RabbitMQSourceStage", py::multiple_inheritance()) .def(py::init<>(&RabbitMQSourceStageInterfaceProxy::init), py::arg("builder"), @@ -509,7 +509,7 @@ def connect(self): Lastly, our `_build_source` method needs to be updated to build a C++ node when `morpheus.config.CppConfig.get_should_use_cpp()` is configured to `True` by using the `self._build_cpp_node()` method. ```python -def _build_source(self, builder: srf.Builder) -> StreamPair: +def _build_source(self, builder: mrc.Builder) -> StreamPair: if self._build_cpp_node(): print("building C++ node") node = morpheus_rabbit_cpp.RabbitMQSourceStage(builder, diff --git a/examples/abp_pcap_detection/abp_pcap_preprocessing.py b/examples/abp_pcap_detection/abp_pcap_preprocessing.py index bfc1c94ded..865d8587b7 100644 --- a/examples/abp_pcap_detection/abp_pcap_preprocessing.py +++ b/examples/abp_pcap_detection/abp_pcap_preprocessing.py @@ -16,8 +16,8 @@ from functools import partial import cupy as cp +import mrc import numpy as np -import srf import cudf @@ -203,5 +203,5 @@ def _get_preprocess_fn(self) -> typing.Callable[[MultiMessage], MultiInferenceMe fea_cols=self.features, ) - def _get_preprocess_node(self, builder: srf.Builder): + def _get_preprocess_node(self, builder: mrc.Builder): return _stages.AbpPcapPreprocessingStage(builder, self.unique_name) diff --git a/examples/developer_guide/1_simple_python_stage/pass_thru.py b/examples/developer_guide/1_simple_python_stage/pass_thru.py index 1f53bdd7b4..8072af617a 100644 --- a/examples/developer_guide/1_simple_python_stage/pass_thru.py +++ b/examples/developer_guide/1_simple_python_stage/pass_thru.py @@ -15,7 +15,7 @@ import typing -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.pipeline.single_port_stage import SinglePortStage @@ -42,7 +42,7 @@ def on_data(self, message: typing.Any): # Return the message for the next stage return message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_node(self.unique_name, self.on_data) builder.make_edge(input_stream[0], node) diff --git a/examples/developer_guide/2_1_real_world_phishing/recipient_features_stage.py b/examples/developer_guide/2_1_real_world_phishing/recipient_features_stage.py index e7c25f699c..331dcdd293 100644 --- a/examples/developer_guide/2_1_real_world_phishing/recipient_features_stage.py +++ b/examples/developer_guide/2_1_real_world_phishing/recipient_features_stage.py @@ -15,7 +15,7 @@ import typing -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -75,7 +75,7 @@ def on_data(self, message: MessageMeta) -> MessageMeta: # Return the message for the next stage return message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_node(self.unique_name, self.on_data) builder.make_edge(input_stream[0], node) diff --git a/examples/developer_guide/2_2_rabbitmq/rabbitmq_source_stage.py b/examples/developer_guide/2_2_rabbitmq/rabbitmq_source_stage.py index c1659a3dc3..a0093aaf55 100644 --- a/examples/developer_guide/2_2_rabbitmq/rabbitmq_source_stage.py +++ b/examples/developer_guide/2_2_rabbitmq/rabbitmq_source_stage.py @@ -17,9 +17,9 @@ import time from io import StringIO +import mrc import pandas as pd import pika -import srf import cudf @@ -91,7 +91,7 @@ def stop(self): return super().stop() - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: node = builder.make_source(self.unique_name, self.source_generator) return node, MessageMeta diff --git a/examples/developer_guide/2_2_rabbitmq/write_to_rabbitmq_stage.py b/examples/developer_guide/2_2_rabbitmq/write_to_rabbitmq_stage.py index b20ffac516..fa98dd4810 100644 --- a/examples/developer_guide/2_2_rabbitmq/write_to_rabbitmq_stage.py +++ b/examples/developer_guide/2_2_rabbitmq/write_to_rabbitmq_stage.py @@ -17,8 +17,8 @@ import typing from io import StringIO +import mrc import pika -import srf from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -68,7 +68,7 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self) -> bool: return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_sink(self.unique_name, self.on_data, self.on_error, self.on_complete) builder.make_edge(input_stream[0], node) return input_stream diff --git a/examples/developer_guide/3_simple_cpp_stage/CMakeLists.txt b/examples/developer_guide/3_simple_cpp_stage/CMakeLists.txt index bea81f4a55..a055a1593a 100644 --- a/examples/developer_guide/3_simple_cpp_stage/CMakeLists.txt +++ b/examples/developer_guide/3_simple_cpp_stage/CMakeLists.txt @@ -26,7 +26,7 @@ add_library(${PROJECT_NAME}::morpheus_example ALIAS morpheus_example) target_link_libraries(morpheus_example PUBLIC morpheus - srf::pysrf + mrc::pymrc ) target_include_directories(morpheus_example diff --git a/examples/developer_guide/3_simple_cpp_stage/_lib/pass_thru.cpp b/examples/developer_guide/3_simple_cpp_stage/_lib/pass_thru.cpp index a8ae2dbc4c..ce62edc829 100644 --- a/examples/developer_guide/3_simple_cpp_stage/_lib/pass_thru.cpp +++ b/examples/developer_guide/3_simple_cpp_stage/_lib/pass_thru.cpp @@ -18,7 +18,7 @@ #include "pass_thru.hpp" #include -#include // for pysrf::import +#include // for pymrc::import #include @@ -36,7 +36,7 @@ PassThruStage::subscribe_fn_t PassThruStage::build_operator() }; } -std::shared_ptr> PassThruStageInterfaceProxy::init(srf::segment::Builder& builder, +std::shared_ptr> PassThruStageInterfaceProxy::init(mrc::segment::Builder& builder, const std::string& name) { return builder.construct_object(name); @@ -47,11 +47,11 @@ namespace py = pybind11; // Define the pybind11 module m. PYBIND11_MODULE(morpheus_example, m) { - srf::pysrf::import(m, "morpheus._lib.messages"); + mrc::pymrc::import(m, "morpheus._lib.messages"); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>(m, "PassThruStage", py::multiple_inheritance()) + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>(m, "PassThruStage", py::multiple_inheritance()) .def(py::init<>(&PassThruStageInterfaceProxy::init), py::arg("builder"), py::arg("name")); } diff --git a/examples/developer_guide/3_simple_cpp_stage/_lib/pass_thru.hpp b/examples/developer_guide/3_simple_cpp_stage/_lib/pass_thru.hpp index e38b5d558c..406e01c7d1 100644 --- a/examples/developer_guide/3_simple_cpp_stage/_lib/pass_thru.hpp +++ b/examples/developer_guide/3_simple_cpp_stage/_lib/pass_thru.hpp @@ -18,9 +18,9 @@ #pragma once #include // for MultiMessage -#include // for PythonNode -#include // for Segment Builder -#include // for Segment Object +#include // for PythonNode +#include // for Segment Builder +#include // for Segment Object #include #include @@ -32,10 +32,10 @@ namespace morpheus_example { using namespace morpheus; -class PassThruStage : public srf::pysrf::PythonNode, std::shared_ptr> +class PassThruStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: - using base_t = srf::pysrf::PythonNode, std::shared_ptr>; + using base_t = mrc::pymrc::PythonNode, std::shared_ptr>; using base_t::sink_type_t; using base_t::source_type_t; using base_t::subscribe_fn_t; @@ -47,7 +47,7 @@ class PassThruStage : public srf::pysrf::PythonNode> init(srf::segment::Builder &builder, + static std::shared_ptr> init(mrc::segment::Builder &builder, const std::string &name); }; diff --git a/examples/developer_guide/3_simple_cpp_stage/pass_thru.py b/examples/developer_guide/3_simple_cpp_stage/pass_thru.py index cf9fc7cc47..83eb29c5a2 100644 --- a/examples/developer_guide/3_simple_cpp_stage/pass_thru.py +++ b/examples/developer_guide/3_simple_cpp_stage/pass_thru.py @@ -15,7 +15,7 @@ import typing -import srf +import mrc from _lib import morpheus_example as morpheus_example_cpp from morpheus.cli.register_stage import register_stage @@ -40,7 +40,7 @@ def on_data(self, message: typing.Any): # Return the message for the next stage return message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: if self._build_cpp_node(): node = morpheus_example_cpp.PassThruStage(builder, self.unique_name) else: diff --git a/examples/developer_guide/4_rabbitmq_cpp_stage/CMakeLists.txt b/examples/developer_guide/4_rabbitmq_cpp_stage/CMakeLists.txt index a16165fa1a..149afe9e2d 100644 --- a/examples/developer_guide/4_rabbitmq_cpp_stage/CMakeLists.txt +++ b/examples/developer_guide/4_rabbitmq_cpp_stage/CMakeLists.txt @@ -32,7 +32,7 @@ target_link_libraries(morpheus_rabbit morpheus rabbitmq SimpleAmqpClient - srf::pysrf + mrc::pymrc ) target_include_directories(morpheus_rabbit diff --git a/examples/developer_guide/4_rabbitmq_cpp_stage/_lib/rabbitmq_source.cpp b/examples/developer_guide/4_rabbitmq_cpp_stage/_lib/rabbitmq_source.cpp index 7148281bff..c1f1907377 100644 --- a/examples/developer_guide/4_rabbitmq_cpp_stage/_lib/rabbitmq_source.cpp +++ b/examples/developer_guide/4_rabbitmq_cpp_stage/_lib/rabbitmq_source.cpp @@ -106,8 +106,8 @@ void RabbitMQSourceStage::close() } } -std::shared_ptr> RabbitMQSourceStageInterfaceProxy::init( - srf::segment::Builder &builder, +std::shared_ptr> RabbitMQSourceStageInterfaceProxy::init( + mrc::segment::Builder &builder, const std::string &name, const std::string &host, const std::string &exchange, @@ -124,11 +124,11 @@ namespace py = pybind11; // Define the pybind11 module m. PYBIND11_MODULE(morpheus_rabbit, m) { - srf::pysrf::import(m, "morpheus._lib.messages"); + mrc::pymrc::import(m, "morpheus._lib.messages"); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "RabbitMQSourceStage", py::multiple_inheritance()) .def(py::init<>(&RabbitMQSourceStageInterfaceProxy::init), py::arg("builder"), diff --git a/examples/developer_guide/4_rabbitmq_cpp_stage/_lib/rabbitmq_source.hpp b/examples/developer_guide/4_rabbitmq_cpp_stage/_lib/rabbitmq_source.hpp index ece26df6d9..3428577e0d 100644 --- a/examples/developer_guide/4_rabbitmq_cpp_stage/_lib/rabbitmq_source.hpp +++ b/examples/developer_guide/4_rabbitmq_cpp_stage/_lib/rabbitmq_source.hpp @@ -20,9 +20,9 @@ #include // for AmqpClient::Channel::ptr_t #include // for cudf::io::table_with_metadata #include // for MessageMeta -#include // for srf::pysrf::PythonSource -#include // for Segment Builder -#include // for Segment Object +#include // for mrc::pymrc::PythonSource +#include // for Segment Builder +#include // for Segment Object #include // for chrono::milliseconds #include // for shared_ptr @@ -36,10 +36,10 @@ namespace morpheus_rabbit { using namespace std::literals; using namespace morpheus; -class RabbitMQSourceStage : public srf::pysrf::PythonSource> +class RabbitMQSourceStage : public mrc::pymrc::PythonSource> { public: - using base_t = srf::pysrf::PythonSource>; + using base_t = mrc::pymrc::PythonSource>; using typename base_t::source_type_t; using typename base_t::subscriber_fn_t; @@ -71,7 +71,7 @@ struct RabbitMQSourceStageInterfaceProxy /** * @brief Create and initialize a RabbitMQSourceStage, and return the result. */ - static std::shared_ptr> init(srf::segment::Builder &builder, + static std::shared_ptr> init(mrc::segment::Builder &builder, const std::string &name, const std::string &host, const std::string &exchange, diff --git a/examples/developer_guide/4_rabbitmq_cpp_stage/rabbitmq_source_stage.py b/examples/developer_guide/4_rabbitmq_cpp_stage/rabbitmq_source_stage.py index d65b93e2a5..e557102ca1 100755 --- a/examples/developer_guide/4_rabbitmq_cpp_stage/rabbitmq_source_stage.py +++ b/examples/developer_guide/4_rabbitmq_cpp_stage/rabbitmq_source_stage.py @@ -17,9 +17,9 @@ import time from io import StringIO +import mrc import pandas as pd import pika -import srf import cudf @@ -83,7 +83,7 @@ def name(self) -> str: def supports_cpp_node(cls) -> bool: return True - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: if self._build_cpp_node(): node = morpheus_rabbit_cpp.RabbitMQSourceStage(builder, self.unique_name, diff --git a/examples/developer_guide/4_rabbitmq_cpp_stage/write_to_rabbitmq_stage.py b/examples/developer_guide/4_rabbitmq_cpp_stage/write_to_rabbitmq_stage.py index b20ffac516..fa98dd4810 100644 --- a/examples/developer_guide/4_rabbitmq_cpp_stage/write_to_rabbitmq_stage.py +++ b/examples/developer_guide/4_rabbitmq_cpp_stage/write_to_rabbitmq_stage.py @@ -17,8 +17,8 @@ import typing from io import StringIO +import mrc import pika -import srf from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -68,7 +68,7 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self) -> bool: return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_sink(self.unique_name, self.on_data, self.on_error, self.on_complete) builder.make_edge(input_stream[0], node) return input_stream diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_file_batcher_stage.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_file_batcher_stage.py index 65d2c266fe..e99770f4cc 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_file_batcher_stage.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_file_batcher_stage.py @@ -18,9 +18,9 @@ from datetime import datetime import fsspec +import mrc import pandas as pd -import srf -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus.config import Config from morpheus.pipeline.single_port_stage import SinglePortStage @@ -127,9 +127,9 @@ def on_data(self, file_objects: fsspec.core.OpenFiles): return output_batches - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self.on_data), ops.flatten()).subscribe(sub) stream = builder.make_node_full(self.unique_name, node_fn) diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_file_to_df.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_file_to_df.py index a6b60c6132..e7a0204978 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_file_to_df.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_file_to_df.py @@ -22,9 +22,9 @@ from functools import partial import fsspec +import mrc import pandas as pd -import srf -from srf.core import operators as ops +from mrc.core import operators as ops import dask from dask.distributed import Client @@ -244,9 +244,9 @@ def convert_to_dataframe(self, s3_object_batch: typing.Tuple[fsspec.core.OpenFil logger.exception("Error while converting S3 buckets to DF.") raise - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self.convert_to_dataframe), ops.on_completed(self._close_dask_cluster)).subscribe(sub) stream = builder.make_node_full(self.unique_name, node_fn) diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_inference_stage.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_inference_stage.py index fe65105c25..adcb114687 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_inference_stage.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_inference_stage.py @@ -16,7 +16,7 @@ import time import typing -import srf +import mrc from mlflow.tracking.client import MlflowClient from morpheus.config import Config @@ -108,7 +108,7 @@ def on_data(self, message: MultiDFPMessage): return output_message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_node(self.unique_name, self.on_data) builder.make_edge(input_stream[0], node) diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_mlflow_model_writer.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_mlflow_model_writer.py index a37855a745..bbafed8b5f 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_mlflow_model_writer.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_mlflow_model_writer.py @@ -19,8 +19,8 @@ import urllib.parse import mlflow +import mrc import requests -import srf from dfencoder import AutoEncoder from mlflow.exceptions import MlflowException from mlflow.models.signature import ModelSignature @@ -32,7 +32,7 @@ from mlflow.types import Schema from mlflow.types.utils import _infer_pandas_column from mlflow.types.utils import _infer_schema -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus.config import Config from morpheus.messages.multi_ae_message import MultiAEMessage @@ -248,9 +248,9 @@ def on_data(self, message: MultiAEMessage): return message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self.on_data)).subscribe(sub) stream = builder.make_node_full(self.unique_name, node_fn) diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_postprocessing_stage.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_postprocessing_stage.py index 933188b2ac..f6d54095d2 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_postprocessing_stage.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_postprocessing_stage.py @@ -17,9 +17,9 @@ import typing from datetime import datetime +import mrc import numpy as np -import srf -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus.config import Config from morpheus.messages.multi_ae_message import MultiAEMessage @@ -85,9 +85,9 @@ def on_data(self, message: MultiAEMessage): return DFPMessageMeta(extracted_events, user_id=message.meta.user_id) - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self.on_data), ops.filter(lambda x: x is not None)).subscribe(sub) stream = builder.make_node_full(self.unique_name, node_fn) diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_preprocessing_stage.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_preprocessing_stage.py index 8b7a083863..88ad39f2cd 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_preprocessing_stage.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_preprocessing_stage.py @@ -16,8 +16,8 @@ import time import typing -import srf -from srf.core import operators as ops +import mrc +from mrc.core import operators as ops from morpheus.config import Config from morpheus.pipeline.single_port_stage import SinglePortStage @@ -70,9 +70,9 @@ def process_features(self, message: MultiDFPMessage): return message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self.process_features)).subscribe(sub) node = builder.make_node_full(self.unique_name, node_fn) diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_rolling_window_stage.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_rolling_window_stage.py index 77aebfd156..d753b72ff1 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_rolling_window_stage.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_rolling_window_stage.py @@ -22,9 +22,9 @@ from datetime import timedelta from datetime import timezone +import mrc import pandas as pd -import srf -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus.config import Config from morpheus.pipeline.single_port_stage import SinglePortStage @@ -315,9 +315,9 @@ def on_data(self, message: DFPMessageMeta): return result - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self.on_data), ops.filter(lambda x: x is not None)).subscribe(sub) stream = builder.make_node_full(self.unique_name, node_fn) diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_split_users_stage.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_split_users_stage.py index f35f3b6f94..e294667a71 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_split_users_stage.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_split_users_stage.py @@ -15,9 +15,9 @@ import logging import typing +import mrc import numpy as np -import srf -from srf.core import operators as ops +from mrc.core import operators as ops import cudf @@ -128,9 +128,9 @@ def extract_users(self, message: cudf.DataFrame): return output_messages - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self.extract_users), ops.flatten()).subscribe(sub) stream = builder.make_node_full(self.unique_name, node_fn) diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_training.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_training.py index 1852be263c..5b2a66dd0d 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_training.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_training.py @@ -15,9 +15,9 @@ import logging import typing -import srf +import mrc from dfencoder import AutoEncoder -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus.config import Config from morpheus.messages.multi_ae_message import MultiAEMessage @@ -87,9 +87,9 @@ def on_data(self, message: MultiDFPMessage): return output_message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self.on_data), ops.filter(lambda x: x is not None)).subscribe(sub) stream = builder.make_node_full(self.unique_name, node_fn) diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_viz_postproc.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_viz_postproc.py index 4b8dd38102..239e522150 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_viz_postproc.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/dfp_viz_postproc.py @@ -16,8 +16,8 @@ import os import typing +import mrc import pandas as pd -import srf from morpheus.config import Config from morpheus.io import serializers @@ -92,7 +92,7 @@ def _postprocess(self, x: MultiAEMessage): return MessageMeta(df=viz_pdf) - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/multi_file_source.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/multi_file_source.py index 52de85a239..eb064a7609 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/multi_file_source.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/multi_file_source.py @@ -17,7 +17,7 @@ import fsspec import fsspec.utils -import srf +import mrc from morpheus.config import Config from morpheus.pipeline.single_output_source import SingleOutputSource @@ -77,7 +77,7 @@ def _generate_frames_fsspec(self): yield files - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: if self._build_cpp_node(): raise RuntimeError("Does not support C++ nodes") diff --git a/examples/digital_fingerprinting/production/morpheus/dfp/stages/write_to_s3_stage.py b/examples/digital_fingerprinting/production/morpheus/dfp/stages/write_to_s3_stage.py index 86f6123a64..8bcdfd55f3 100644 --- a/examples/digital_fingerprinting/production/morpheus/dfp/stages/write_to_s3_stage.py +++ b/examples/digital_fingerprinting/production/morpheus/dfp/stages/write_to_s3_stage.py @@ -14,7 +14,7 @@ import typing -import srf +import mrc from morpheus.config import Config from morpheus.pipeline.single_port_stage import SinglePortStage @@ -58,7 +58,7 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self): return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] node = builder.make_node(self.unique_name, self._s3_writer) diff --git a/examples/gnn_fraud_detection_pipeline/stages/classification_stage.py b/examples/gnn_fraud_detection_pipeline/stages/classification_stage.py index 795c4b5415..2c605953be 100644 --- a/examples/gnn_fraud_detection_pipeline/stages/classification_stage.py +++ b/examples/gnn_fraud_detection_pipeline/stages/classification_stage.py @@ -15,7 +15,7 @@ import typing -import srf +import mrc import cuml @@ -69,7 +69,7 @@ def _process_message(self, message: GraphSAGEMultiMessage): return message - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_node(self.unique_name, self._process_message) builder.make_edge(input_stream[0], node) return node, MultiMessage diff --git a/examples/gnn_fraud_detection_pipeline/stages/graph_construction_stage.py b/examples/gnn_fraud_detection_pipeline/stages/graph_construction_stage.py index dbb0258894..4eb4f5ebc1 100644 --- a/examples/gnn_fraud_detection_pipeline/stages/graph_construction_stage.py +++ b/examples/gnn_fraud_detection_pipeline/stages/graph_construction_stage.py @@ -17,9 +17,9 @@ import pathlib import typing +import mrc import networkx as nx import pandas as pd -import srf import cudf @@ -116,7 +116,7 @@ def _process_message(self, message: MultiMessage): mess_offset=message.mess_offset, mess_count=message.mess_count) - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_node(self.unique_name, self._process_message) builder.make_edge(input_stream[0], node) return node, FraudGraphMultiMessage diff --git a/examples/gnn_fraud_detection_pipeline/stages/graph_sage_stage.py b/examples/gnn_fraud_detection_pipeline/stages/graph_sage_stage.py index aa972b93ef..0d14854a93 100644 --- a/examples/gnn_fraud_detection_pipeline/stages/graph_sage_stage.py +++ b/examples/gnn_fraud_detection_pipeline/stages/graph_sage_stage.py @@ -16,7 +16,7 @@ import dataclasses import typing -import srf +import mrc import cudf @@ -106,7 +106,7 @@ def _process_message(self, message: FraudGraphMultiMessage): mess_offset=message.mess_offset, mess_count=message.mess_count) - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: node = builder.make_node(self.unique_name, self._process_message) builder.make_edge(input_stream[0], node) return node, GraphSAGEMultiMessage diff --git a/examples/log_parsing/inference.py b/examples/log_parsing/inference.py index ce18d2246f..248dd0d705 100644 --- a/examples/log_parsing/inference.py +++ b/examples/log_parsing/inference.py @@ -17,11 +17,11 @@ from functools import partial import cupy as cp +import mrc import numpy as np -import srf import tritonclient.grpc as tritonclient +from mrc.core import operators as ops from scipy.special import softmax -from srf.core import operators as ops from messages import MultiPostprocLogParsingMessage from messages import MultiResponseLogParsingMessage @@ -197,12 +197,12 @@ def supports_cpp_node(self): # Get the value from the worker class return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] out_type = MultiResponseLogParsingMessage - def py_inference_fn(obs: srf.Observable, sub: srf.Subscriber): + def py_inference_fn(obs: mrc.Observable, sub: mrc.Subscriber): worker = self._get_inference_worker(self._inf_queue) @@ -224,9 +224,9 @@ def on_next(x: MultiInferenceMessage): for batch in batches: outstanding_requests += 1 - fut = srf.Future() + fut = mrc.Future() - def set_output_fut(resp: ResponseMemoryLogParsing, b, f: srf.Future): + def set_output_fut(resp: ResponseMemoryLogParsing, b, f: mrc.Future): nonlocal outstanding_requests m = self._convert_one_response(memory, b, resp) diff --git a/examples/log_parsing/postprocessing.py b/examples/log_parsing/postprocessing.py index 5141110bf3..98fe3368af 100644 --- a/examples/log_parsing/postprocessing.py +++ b/examples/log_parsing/postprocessing.py @@ -17,9 +17,9 @@ import typing from collections import defaultdict +import mrc import numpy as np import pandas as pd -import srf from messages import MultiPostprocLogParsingMessage from messages import MultiResponseLogParsingMessage @@ -156,7 +156,7 @@ def __decode_cleanup(self, df): return df - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: # Convert the messages to rows of strings stream = builder.make_node(self.unique_name, self._postprocess) diff --git a/examples/log_parsing/preprocessing.py b/examples/log_parsing/preprocessing.py index 366c090c0a..c7bf327aa9 100644 --- a/examples/log_parsing/preprocessing.py +++ b/examples/log_parsing/preprocessing.py @@ -17,7 +17,7 @@ import typing from functools import partial -import srf +import mrc import cudf @@ -180,7 +180,7 @@ def _get_preprocess_fn(self) -> typing.Callable[[MultiMessage], MultiInferenceMe add_special_tokens=self._add_special_tokens, column=self._column) - def _get_preprocess_node(self, builder: srf.Builder): + def _get_preprocess_node(self, builder: mrc.Builder): return _stages.PreprocessNLPStage(builder, self.unique_name, self._vocab_hash_file, diff --git a/examples/ransomware_detection/stages/create_features.py b/examples/ransomware_detection/stages/create_features.py index 6be400deb6..c2d84a54c3 100644 --- a/examples/ransomware_detection/stages/create_features.py +++ b/examples/ransomware_detection/stages/create_features.py @@ -14,10 +14,10 @@ import typing -import srf +import mrc from common.data_models import FeatureConfig from common.feature_extractor import FeatureExtractor -from srf.core import operators as ops +from mrc.core import operators as ops from dask.distributed import Client @@ -83,11 +83,11 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self): return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] - def node_fn(input: srf.Observable, output: srf.Subscriber): + def node_fn(input: mrc.Observable, output: mrc.Subscriber): def on_next(x: AppShieldMessageMeta): diff --git a/examples/ransomware_detection/stages/preprocessing.py b/examples/ransomware_detection/stages/preprocessing.py index fe6169d14f..ad30e98b2e 100644 --- a/examples/ransomware_detection/stages/preprocessing.py +++ b/examples/ransomware_detection/stages/preprocessing.py @@ -15,8 +15,8 @@ import typing import cupy as cp +import mrc import pandas as pd -import srf from common.data_models import SnapshotData from morpheus.cli.register_stage import register_stage @@ -192,5 +192,5 @@ def _get_preprocess_fn(self) -> typing.Callable[[MultiMessage], MultiInferenceMe pre_process_batch_fn = self._pre_process_batch return pre_process_batch_fn - def _get_preprocess_node(self, builder: srf.Builder): + def _get_preprocess_node(self, builder: mrc.Builder): raise NotImplementedError("No C++ node supported") diff --git a/examples/sid_visualization/run.py b/examples/sid_visualization/run.py index eba7f653bc..f3761eb5be 100644 --- a/examples/sid_visualization/run.py +++ b/examples/sid_visualization/run.py @@ -17,7 +17,7 @@ import typing import click -import srf +import mrc from morpheus._lib.file_types import FileTypes from morpheus._lib.messages import MessageMeta @@ -96,7 +96,7 @@ def input_count(self) -> int: def supports_cpp_node(self): return False - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: if self._build_cpp_node(): raise RuntimeError("Does not support C++ nodes") diff --git a/morpheus/_lib/cmake/libraries/cuda_utils.cmake b/morpheus/_lib/cmake/libraries/cuda_utils.cmake index 8ee728c8c6..3783281c09 100644 --- a/morpheus/_lib/cmake/libraries/cuda_utils.cmake +++ b/morpheus/_lib/cmake/libraries/cuda_utils.cmake @@ -18,15 +18,16 @@ find_package(pybind11 REQUIRED) # Place the two cuda sources in their own target and disable IWYU for that target. add_library(cuda_utils_objs -OBJECT - ${MORPHEUS_LIB_ROOT}/src/utilities/matx_util.cu - ${MORPHEUS_LIB_ROOT}/src/utilities/type_util.cu + OBJECT + ${MORPHEUS_LIB_ROOT}/src/utilities/matx_util.cu + ${MORPHEUS_LIB_ROOT}/src/utilities/type_util.cu ) - set_target_properties( - cuda_utils_objs + cuda_utils_objs PROPERTIES + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON C_INCLUDE_WHAT_YOU_USE "" CXX_INCLUDE_WHAT_YOU_USE "" EXPORT_COMPILE_COMMANDS OFF @@ -37,14 +38,14 @@ target_include_directories(cuda_utils_objs "${MORPHEUS_LIB_ROOT}/include" cudf::cudf matx::matx - srf::pysrf + mrc::pymrc ) target_link_libraries(cuda_utils_objs PUBLIC cudf::cudf matx::matx - srf::pysrf + mrc::pymrc ) add_library(cuda_utils @@ -64,13 +65,20 @@ target_include_directories(cuda_utils target_link_libraries(cuda_utils PUBLIC - srf::pysrf + mrc::pymrc matx::matx cudf::cudf Python3::NumPy pybind11::pybind11 ) +set_target_properties( + cuda_utils + PROPERTIES + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON +) + set_target_properties(cuda_utils PROPERTIES OUTPUT_NAME ${PROJECT_NAME}_utils ) diff --git a/morpheus/_lib/cmake/python_modules/common.cmake b/morpheus/_lib/cmake/python_modules/common.cmake index c5e1845b79..1e583e201f 100644 --- a/morpheus/_lib/cmake/python_modules/common.cmake +++ b/morpheus/_lib/cmake/python_modules/common.cmake @@ -22,7 +22,7 @@ morpheus_add_pybind11_module( "${MORPHEUS_LIB_ROOT}/include" LINK_TARGETS morpheus - srf::pysrf + mrc::pymrc OUTPUT_TARGET common_target INSTALL_DEST diff --git a/morpheus/_lib/cmake/python_modules/file_types.cmake b/morpheus/_lib/cmake/python_modules/file_types.cmake index d89906d057..4f8881d8f2 100644 --- a/morpheus/_lib/cmake/python_modules/file_types.cmake +++ b/morpheus/_lib/cmake/python_modules/file_types.cmake @@ -22,7 +22,7 @@ morpheus_add_pybind11_module( "${MORPHEUS_LIB_ROOT}/include" LINK_TARGETS morpheus - srf::pysrf + mrc::pymrc OUTPUT_TARGET file_types_target INSTALL_DEST diff --git a/morpheus/_lib/cmake/python_modules/messages.cmake b/morpheus/_lib/cmake/python_modules/messages.cmake index c2e26d4fc2..4d59e5ed91 100644 --- a/morpheus/_lib/cmake/python_modules/messages.cmake +++ b/morpheus/_lib/cmake/python_modules/messages.cmake @@ -22,7 +22,7 @@ morpheus_add_pybind11_module( "${MORPHEUS_LIB_ROOT}/include" LINK_TARGETS morpheus - srf::pysrf + mrc::pymrc OUTPUT_TARGET messages_target INSTALL_DEST diff --git a/morpheus/_lib/cmake/python_modules/stages.cmake b/morpheus/_lib/cmake/python_modules/stages.cmake index edec24f416..b941fc4a56 100644 --- a/morpheus/_lib/cmake/python_modules/stages.cmake +++ b/morpheus/_lib/cmake/python_modules/stages.cmake @@ -22,7 +22,7 @@ morpheus_add_pybind11_module( "${MORPHEUS_LIB_ROOT}/include" LINK_TARGETS morpheus - srf::pysrf + mrc::pymrc OUTPUT_TARGET stages_target INSTALL_DEST diff --git a/morpheus/_lib/include/morpheus/objects/tensor_object.hpp b/morpheus/_lib/include/morpheus/objects/tensor_object.hpp index f56a4c6bbb..d63209f3bd 100644 --- a/morpheus/_lib/include/morpheus/objects/tensor_object.hpp +++ b/morpheus/_lib/include/morpheus/objects/tensor_object.hpp @@ -22,8 +22,8 @@ #include // for cudaMemcpyDeviceToHost & cudaMemcpy #include // for CHECK +#include #include -#include #include #include @@ -124,10 +124,13 @@ struct MemoryDescriptor struct ITensorStorage { - virtual ~ITensorStorage() = default; + virtual ~ITensorStorage() = default; + virtual void* data() const = 0; + // virtual const void* data() const = 0; - virtual std::size_t bytes() const = 0; + virtual std::size_t bytes() const = 0; + virtual std::shared_ptr get_memory() const = 0; // virtual TensorStorageType storage_type() const = 0; }; @@ -153,11 +156,14 @@ struct ITensor : public ITensorStorage, public ITensorOperations { ~ITensor() override = default; - virtual RankType rank() const = 0; + virtual RankType rank() const = 0; + virtual std::size_t count() const = 0; - virtual DataType dtype() const = 0; - virtual std::size_t shape(std::size_t) const = 0; + virtual DataType dtype() const = 0; + + virtual std::size_t shape(std::size_t) const = 0; + virtual std::size_t stride(std::size_t) const = 0; virtual bool is_compact() const = 0; @@ -192,6 +198,7 @@ struct TensorObject final m_md(std::move(md)), m_tensor(std::move(tensor)) {} + TensorObject(std::shared_ptr tensor) : TensorObject(tensor->get_memory(), tensor) {} TensorObject(const TensorObject& other) = default; @@ -217,6 +224,7 @@ struct TensorObject final { return m_tensor->count(); } + std::size_t bytes() const { return m_tensor->bytes(); @@ -226,6 +234,7 @@ struct TensorObject final { return m_tensor->rank(); } + std::size_t dtype_size() const { return m_tensor->dtype().item_size(); @@ -245,6 +254,7 @@ struct TensorObject final { return m_tensor->shape(idx); } + TensorIndex stride(std::uint32_t idx) const { return m_tensor->stride(idx); @@ -265,19 +275,19 @@ struct TensorObject final return d < 0 ? s : d; }); - return TensorObject(m_md, m_tensor->slice(min_dims, max_dims)); + return {m_md, m_tensor->slice(min_dims, max_dims)}; } TensorObject reshape(const std::vector& dims) const { - return TensorObject(m_md, m_tensor->reshape(dims)); + return {m_md, m_tensor->reshape(dims)}; } TensorObject deep_copy() const { std::shared_ptr copy = m_tensor->deep_copy(); - return TensorObject(copy); + return {copy}; } template @@ -289,7 +299,7 @@ struct TensorObject final out_data.resize(this->bytes() / sizeof(T)); - SRF_CHECK_CUDA(cudaMemcpy(&out_data[0], this->data(), this->bytes(), cudaMemcpyDeviceToHost)); + MRC_CHECK_CUDA(cudaMemcpy(&out_data[0], this->data(), this->bytes(), cudaMemcpyDeviceToHost)); return out_data; } @@ -318,7 +328,7 @@ struct TensorObject final T output; - SRF_CHECK_CUDA( + MRC_CHECK_CUDA( cudaMemcpy(&output, static_cast(this->data()) + offset, sizeof(T), cudaMemcpyDeviceToHost)); return output; @@ -348,7 +358,7 @@ struct TensorObject final T output; - SRF_CHECK_CUDA( + MRC_CHECK_CUDA( cudaMemcpy(&output, static_cast(this->data()) + offset, sizeof(T), cudaMemcpyDeviceToHost)); return output; @@ -394,17 +404,17 @@ struct TensorObject final DCHECK(this->bytes() == other.bytes()) << "Left and right bytes should be the same if all other test passed"; // Perform the copy operation - SRF_CHECK_CUDA(cudaMemcpy(this->data(), other.data(), this->bytes(), cudaMemcpyDeviceToDevice)); + MRC_CHECK_CUDA(cudaMemcpy(this->data(), other.data(), this->bytes(), cudaMemcpyDeviceToDevice)); return *this; } - std::shared_ptr get_tensor() const + [[maybe_unused]] std::shared_ptr get_tensor() const { return m_tensor; } - std::shared_ptr get_memory() const + [[maybe_unused]] std::shared_ptr get_memory() const { return m_md; } @@ -419,10 +429,10 @@ struct TensorObject final if (dtype == m_tensor->dtype()) { // Shallow copy - return TensorObject(*this); + return {*this}; } - return TensorObject(m_tensor->as_type(dtype)); + return {m_tensor->as_type(dtype)}; } /** @@ -436,11 +446,11 @@ struct TensorObject final TensorObject copy_rows(const std::vector>& selected_rows, TensorIndex num_rows) const { - return TensorObject(m_tensor->copy_rows(selected_rows, num_rows)); + return {m_tensor->copy_rows(selected_rows, num_rows)}; } protected: - void throw_on_invalid_storage(); + [[maybe_unused]] void throw_on_invalid_storage(); private: std::shared_ptr m_md; diff --git a/morpheus/_lib/include/morpheus/stages/add_classification.hpp b/morpheus/_lib/include/morpheus/stages/add_classification.hpp index 9143829289..affa145b14 100644 --- a/morpheus/_lib/include/morpheus/stages/add_classification.hpp +++ b/morpheus/_lib/include/morpheus/stages/add_classification.hpp @@ -19,13 +19,13 @@ #include "morpheus/messages/multi_response_probs.hpp" -#include +#include // for Status +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include -#include // for Status -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include // for size_t #include @@ -48,12 +48,12 @@ namespace morpheus { * @brief Add detected classifications to each message. Classification labels based on probabilities calculated in * inference stage. Label indexes will be looked up in the idx2label property. */ -class AddClassificationsStage : public srf::pysrf::PythonNode, +class AddClassificationsStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: using base_t = - srf::pysrf::PythonNode, std::shared_ptr>; + mrc::pymrc::PythonNode, std::shared_ptr>; using typename base_t::sink_type_t; using typename base_t::source_type_t; using typename base_t::subscribe_fn_t; @@ -95,11 +95,11 @@ struct AddClassificationStageInterfaceProxy * @param threshold : Threshold to consider true/false for each class * @param num_class_labels : Number of classification labels * @param idx2label : Index to classification labels map - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init( - srf::segment::Builder &builder, - const std::string &name, + static std::shared_ptr> init( + mrc::segment::Builder& builder, + const std::string& name, float threshold, std::size_t num_class_labels, std::map idx2label); diff --git a/morpheus/_lib/include/morpheus/stages/add_scores.hpp b/morpheus/_lib/include/morpheus/stages/add_scores.hpp index f3431629fc..c89b8443e2 100644 --- a/morpheus/_lib/include/morpheus/stages/add_scores.hpp +++ b/morpheus/_lib/include/morpheus/stages/add_scores.hpp @@ -19,13 +19,13 @@ #include "morpheus/messages/multi_response_probs.hpp" -#include +#include // for Status +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include // for apply, make_subscriber, observable_member, is_on_error<>::not_void, is_on_next_of<>::not_void, trace_activity -#include // for Status -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include // for size_t #include @@ -48,12 +48,12 @@ namespace morpheus { * @brief Add probability scores to each message. Score labels based on probabilities calculated in inference stage. * Label indexes will be looked up in the idx2label property. */ -class AddScoresStage : public srf::pysrf::PythonNode, +class AddScoresStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: using base_t = - srf::pysrf::PythonNode, std::shared_ptr>; + mrc::pymrc::PythonNode, std::shared_ptr>; using typename base_t::sink_type_t; using typename base_t::source_type_t; using typename base_t::subscribe_fn_t; @@ -88,10 +88,10 @@ struct AddScoresStageInterfaceProxy * @param name : Name of a stage reference * @param num_class_labels : Number of classification labels * @param idx2label : Index to classification labels map - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init(srf::segment::Builder &builder, - const std::string &name, + static std::shared_ptr> init(mrc::segment::Builder& builder, + const std::string& name, std::size_t num_class_labels, std::map idx2label); }; diff --git a/morpheus/_lib/include/morpheus/stages/deserialize.hpp b/morpheus/_lib/include/morpheus/stages/deserialize.hpp index 6744601ad5..367192b1db 100644 --- a/morpheus/_lib/include/morpheus/stages/deserialize.hpp +++ b/morpheus/_lib/include/morpheus/stages/deserialize.hpp @@ -20,13 +20,13 @@ #include "morpheus/messages/meta.hpp" #include "morpheus/messages/multi.hpp" -#include +#include // for Status +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include -#include // for Status -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include // for size_t #include @@ -49,10 +49,10 @@ namespace morpheus { * from `FileSourceStage`/`KafkaSourceStage` stages breaking them up into into `MultiMessage`'s. This should be one of * the first stages after the `Source` object. */ -class DeserializeStage : public srf::pysrf::PythonNode, std::shared_ptr> +class DeserializeStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: - using base_t = srf::pysrf::PythonNode, std::shared_ptr>; + using base_t = mrc::pymrc::PythonNode, std::shared_ptr>; using typename base_t::sink_type_t; using typename base_t::source_type_t; using typename base_t::subscribe_fn_t; @@ -85,10 +85,10 @@ struct DeserializeStageInterfaceProxy * @param builder : Pipeline context object reference * @param name : Name of a stage reference * @param batch_size : Number of messages to be divided into each batch - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init(srf::segment::Builder &builder, - const std::string &name, + static std::shared_ptr> init(mrc::segment::Builder& builder, + const std::string& name, size_t batch_size); }; #pragma GCC visibility pop diff --git a/morpheus/_lib/include/morpheus/stages/file_source.hpp b/morpheus/_lib/include/morpheus/stages/file_source.hpp index 4ea7115d8d..8c1c8b9c0b 100644 --- a/morpheus/_lib/include/morpheus/stages/file_source.hpp +++ b/morpheus/_lib/include/morpheus/stages/file_source.hpp @@ -19,13 +19,13 @@ #include "morpheus/messages/meta.hpp" -#include // for table_with_metadata -#include +#include // for table_with_metadata +#include // for Status +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include // for apply, make_subscriber, observable_member, is_on_error<>::not_void, is_on_next_of<>::not_void, trace_activity -#include // for Status -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include #include @@ -46,10 +46,10 @@ namespace morpheus { * @brief Load messages from a file. Source stage is used to load messages from a file and * dumping the contents into the pipeline immediately. Useful for testing performance and accuracy of a pipeline. */ -class FileSourceStage : public srf::pysrf::PythonSource> +class FileSourceStage : public mrc::pymrc::PythonSource> { public: - using base_t = srf::pysrf::PythonSource>; + using base_t = mrc::pymrc::PythonSource>; using typename base_t::source_type_t; using typename base_t::subscriber_fn_t; @@ -81,10 +81,10 @@ struct FileSourceStageInterfaceProxy * @param name : Name of a stage reference * @param filename : Name of the file from which the messages will be read. * @param repeat : Repeats the input dataset multiple times. Useful to extend small datasets for debugging. - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init(srf::segment::Builder &builder, - const std::string &name, + static std::shared_ptr> init(mrc::segment::Builder& builder, + const std::string& name, std::string filename, int repeat = 1); }; diff --git a/morpheus/_lib/include/morpheus/stages/filter_detection.hpp b/morpheus/_lib/include/morpheus/stages/filter_detection.hpp index 0b8f923bf4..c52fa61ed7 100644 --- a/morpheus/_lib/include/morpheus/stages/filter_detection.hpp +++ b/morpheus/_lib/include/morpheus/stages/filter_detection.hpp @@ -19,13 +19,13 @@ #include "morpheus/messages/multi_response_probs.hpp" -#include +#include // for Status +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include -#include // for Status -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include // for size_t #include @@ -68,12 +68,12 @@ namespace morpheus { * Depending on the downstream stages, this can cause performance issues, especially if those stages need to acquire * the Python GIL. */ -class FilterDetectionsStage : public srf::pysrf::PythonNode, +class FilterDetectionsStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: using base_t = - srf::pysrf::PythonNode, std::shared_ptr>; + mrc::pymrc::PythonNode, std::shared_ptr>; using typename base_t::sink_type_t; using typename base_t::source_type_t; using typename base_t::subscribe_fn_t; @@ -108,10 +108,10 @@ struct FilterDetectionStageInterfaceProxy * @param name : Name of a stage reference * @param threshold : Threshold to classify * @param copy : Whether or not to perform a copy default=true - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init(srf::segment::Builder &builder, - const std::string &name, + static std::shared_ptr> init(mrc::segment::Builder& builder, + const std::string& name, float threshold, bool copy = true); }; diff --git a/morpheus/_lib/include/morpheus/stages/kafka_source.hpp b/morpheus/_lib/include/morpheus/stages/kafka_source.hpp index b3928a31b3..f5d2df64a5 100644 --- a/morpheus/_lib/include/morpheus/stages/kafka_source.hpp +++ b/morpheus/_lib/include/morpheus/stages/kafka_source.hpp @@ -21,12 +21,12 @@ #include #include -#include +#include // for Status +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include // for apply, make_subscriber, observable_member, is_on_error<>::not_void, is_on_next_of<>::not_void, trace_activity -#include // for Status -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include // for size_t #include // for int32_t, uint32_t @@ -50,10 +50,10 @@ namespace morpheus { /** * This class loads messages from the Kafka cluster by serving as a Kafka consumer. */ -class KafkaSourceStage : public srf::pysrf::PythonSource> +class KafkaSourceStage : public mrc::pymrc::PythonSource> { public: - using base_t = srf::pysrf::PythonSource>; + using base_t = mrc::pymrc::PythonSource>; using typename base_t::source_type_t; using typename base_t::subscriber_fn_t; @@ -171,8 +171,8 @@ struct KafkaSourceStageInterfaceProxy * Useful for testing. Disabled if `0` * @param async_commits : Asynchronously acknowledge consuming Kafka messages */ - static std::shared_ptr> init(srf::segment::Builder &builder, - const std::string &name, + static std::shared_ptr> init(mrc::segment::Builder& builder, + const std::string& name, size_t max_batch_size, std::string topic, int32_t batch_timeout_ms, diff --git a/morpheus/_lib/include/morpheus/stages/preprocess_fil.hpp b/morpheus/_lib/include/morpheus/stages/preprocess_fil.hpp index 18303dda9e..6ca9fc81f5 100644 --- a/morpheus/_lib/include/morpheus/stages/preprocess_fil.hpp +++ b/morpheus/_lib/include/morpheus/stages/preprocess_fil.hpp @@ -20,13 +20,13 @@ #include "morpheus/messages/multi.hpp" #include "morpheus/messages/multi_inference.hpp" -#include +#include // for Status +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include // for apply, make_subscriber, observable_member, is_on_error<>::not_void, is_on_next_of<>::not_void, from -#include // for Status -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include #include @@ -47,10 +47,10 @@ namespace morpheus { * @brief FIL input data for inference */ class PreprocessFILStage - : public srf::pysrf::PythonNode, std::shared_ptr> + : public mrc::pymrc::PythonNode, std::shared_ptr> { public: - using base_t = srf::pysrf::PythonNode, std::shared_ptr>; + using base_t = mrc::pymrc::PythonNode, std::shared_ptr>; using typename base_t::sink_type_t; using typename base_t::source_type_t; using typename base_t::subscribe_fn_t; @@ -84,9 +84,9 @@ struct PreprocessFILStageInterfaceProxy * @param builder : Pipeline context object reference * @param name : Name of a stage reference * @param features : Reference to the features that are required for model inference - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init(srf::segment::Builder& builder, + static std::shared_ptr> init(mrc::segment::Builder& builder, const std::string& name, const std::vector& features); }; diff --git a/morpheus/_lib/include/morpheus/stages/preprocess_nlp.hpp b/morpheus/_lib/include/morpheus/stages/preprocess_nlp.hpp index b7ce79207b..0200d79e39 100644 --- a/morpheus/_lib/include/morpheus/stages/preprocess_nlp.hpp +++ b/morpheus/_lib/include/morpheus/stages/preprocess_nlp.hpp @@ -20,13 +20,13 @@ #include "morpheus/messages/multi.hpp" #include "morpheus/messages/multi_inference.hpp" -#include +#include // for Status +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include // for apply, make_subscriber, observable_member, is_on_error<>::not_void, is_on_next_of<>::not_void, from -#include // for Status -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include // for uint32_t #include @@ -48,10 +48,10 @@ namespace morpheus { * @brief NLP input data for inference */ class PreprocessNLPStage - : public srf::pysrf::PythonNode, std::shared_ptr> + : public mrc::pymrc::PythonNode, std::shared_ptr> { public: - using base_t = srf::pysrf::PythonNode, std::shared_ptr>; + using base_t = mrc::pymrc::PythonNode, std::shared_ptr>; using typename base_t::sink_type_t; using typename base_t::source_type_t; using typename base_t::subscribe_fn_t; @@ -122,10 +122,10 @@ struct PreprocessNLPStageInterfaceProxy * equal to stride there are no duplicated-id tokens. If stride is 80% of max_length, 20% of the first sequence will * be repeated on the second sequence and so on until the entire sentence is encoded. * @param column : Name of the string column to operate on, defaults to "data". - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init(srf::segment::Builder &builder, - const std::string &name, + static std::shared_ptr> init(mrc::segment::Builder& builder, + const std::string& name, std::string vocab_hash_file, uint32_t sequence_length, bool truncation, diff --git a/morpheus/_lib/include/morpheus/stages/serialize.hpp b/morpheus/_lib/include/morpheus/stages/serialize.hpp index 2d44d13e65..08a050bc92 100644 --- a/morpheus/_lib/include/morpheus/stages/serialize.hpp +++ b/morpheus/_lib/include/morpheus/stages/serialize.hpp @@ -21,13 +21,13 @@ #include "morpheus/messages/multi.hpp" #include "morpheus/objects/table_info.hpp" // for TableInfo -#include +#include // for Status +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include // for apply, make_subscriber, observable_member, is_on_error<>::not_void, is_on_next_of<>::not_void, from -#include // for Status -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include #include @@ -49,10 +49,10 @@ namespace morpheus { * @brief Include & exclude columns from messages. This class filters columns from a `MultiMessage` object emitting a * `MessageMeta`. */ -class SerializeStage : public srf::pysrf::PythonNode, std::shared_ptr> +class SerializeStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: - using base_t = srf::pysrf::PythonNode, std::shared_ptr>; + using base_t = mrc::pymrc::PythonNode, std::shared_ptr>; using typename base_t::sink_type_t; using typename base_t::source_type_t; using typename base_t::subscribe_fn_t; @@ -103,12 +103,12 @@ struct SerializeStageInterfaceProxy * @param exclude : Reference to the attributes that are not required send to downstream stage. * @param fixed_columns : When `True` `SerializeStage` will assume that the Dataframe in all messages contain * the same columns as the first message received. - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init(srf::segment::Builder &builder, - const std::string &name, - const std::vector &include, - const std::vector &exclude, + static std::shared_ptr> init(mrc::segment::Builder& builder, + const std::string& name, + const std::vector& include, + const std::vector& exclude, bool fixed_columns = true); }; diff --git a/morpheus/_lib/include/morpheus/stages/triton_inference.hpp b/morpheus/_lib/include/morpheus/stages/triton_inference.hpp index 9edcee3ff2..43d1ff8263 100644 --- a/morpheus/_lib/include/morpheus/stages/triton_inference.hpp +++ b/morpheus/_lib/include/morpheus/stages/triton_inference.hpp @@ -22,13 +22,13 @@ #include "morpheus/objects/triton_in_out.hpp" #include -#include +#include // for Status +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include // for apply, make_subscriber, observable_member, is_on_error<>::not_void, is_on_next_of<>::not_void, from -#include // for Status -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include #include @@ -51,11 +51,11 @@ namespace morpheus { * This class specifies which inference implementation category (Ex: NLP/FIL) is needed for inferencing. */ class InferenceClientStage - : public srf::pysrf::PythonNode, std::shared_ptr> + : public mrc::pymrc::PythonNode, std::shared_ptr> { public: using base_t = - srf::pysrf::PythonNode, std::shared_ptr>; + mrc::pymrc::PythonNode, std::shared_ptr>; using typename base_t::sink_type_t; using typename base_t::source_type_t; using typename base_t::subscribe_fn_t; @@ -133,11 +133,11 @@ struct InferenceClientStageInterfaceProxy * @param needs_logits : Determines if logits are required. * @param inout_mapping : Dictionary used to map pipeline input/output names to Triton input/output names. Use this * if the Morpheus names do not match the model. - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init( - srf::segment::Builder &builder, - const std::string &name, + static std::shared_ptr> init( + mrc::segment::Builder& builder, + const std::string& name, std::string model_name, std::string server_url, bool force_convert_inputs, diff --git a/morpheus/_lib/include/morpheus/stages/write_to_file.hpp b/morpheus/_lib/include/morpheus/stages/write_to_file.hpp index 4cdc646f6d..2c5aa5e114 100644 --- a/morpheus/_lib/include/morpheus/stages/write_to_file.hpp +++ b/morpheus/_lib/include/morpheus/stages/write_to_file.hpp @@ -20,13 +20,13 @@ #include "morpheus/messages/meta.hpp" #include "morpheus/objects/file_types.hpp" -#include +#include // for Status +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include +#include // for Object +#include #include -#include // for Status -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include -#include // for Object #include #include // for function @@ -49,10 +49,10 @@ namespace morpheus { * @brief Write all messages to a file. Messages are written to a file by this class. * This class does not maintain an open file or buffer messages. */ -class WriteToFileStage : public srf::pysrf::PythonNode, std::shared_ptr> +class WriteToFileStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: - using base_t = srf::pysrf::PythonNode, std::shared_ptr>; + using base_t = mrc::pymrc::PythonNode, std::shared_ptr>; using typename base_t::sink_type_t; using typename base_t::source_type_t; using typename base_t::subscribe_fn_t; @@ -92,7 +92,7 @@ class WriteToFileStage : public srf::pysrf::PythonNode m_write_func; @@ -113,12 +113,12 @@ struct WriteToFileStageInterfaceProxy * @param mode : Reference to the mode for opening a file * @param file_type : FileTypes * @param include_index_col : Write out the index as a column, by default true - * @return std::shared_ptr> + * @return std::shared_ptr> */ - static std::shared_ptr> init(srf::segment::Builder &builder, - const std::string &name, - const std::string &filename, - const std::string &mode = "w", + static std::shared_ptr> init(mrc::segment::Builder& builder, + const std::string& name, + const std::string& filename, + const std::string& mode = "w", FileTypes file_type = FileTypes::Auto, bool include_index_col = true); }; diff --git a/morpheus/_lib/include/morpheus/utilities/tensor_util.hpp b/morpheus/_lib/include/morpheus/utilities/tensor_util.hpp index ebf9f0dfcf..ccc1c35856 100644 --- a/morpheus/_lib/include/morpheus/utilities/tensor_util.hpp +++ b/morpheus/_lib/include/morpheus/utilities/tensor_util.hpp @@ -41,7 +41,7 @@ namespace morpheus { */ struct TensorUtils { - using shape_type = std::vector; + using shape_type_t = std::vector; /** * @brief Write a formatted shape to a stream @@ -49,7 +49,7 @@ struct TensorUtils * @param shape * @param os */ - static void write_shape_to_stream(const shape_type& shape, std::ostream& os); + static void write_shape_to_stream(const shape_type_t& shape, std::ostream& os); /** * @brief Convenience method to get a string from write_shape_to_stream @@ -57,7 +57,7 @@ struct TensorUtils * @param shape * @return std::string */ - static std::string shape_to_string(const shape_type& shape); + static std::string shape_to_string(const shape_type_t& shape); /** * @brief Set stride to be contiguous with respect to row-major layouts @@ -73,7 +73,7 @@ struct TensorUtils * @note A tensor whose values are laid out in the storage starting from the rightmost * dimension onward (that is, moving along rows for a 2D tensor) is defined as contiguous. */ - static bool has_contiguous_stride(const std::vector& shape, const shape_type& stride); + static bool has_contiguous_stride(const std::vector& shape, const shape_type_t& stride); /** * @brief Validate the shape and stride are compatible @@ -91,7 +91,7 @@ struct TensorUtils * elements. * * @param stride - * @return shape_type + * @return shape_type_t */ template static std::vector get_element_stride(const std::vector& stride) diff --git a/morpheus/_lib/include/morpheus/utilities/type_util_detail.hpp b/morpheus/_lib/include/morpheus/utilities/type_util_detail.hpp index 60e6bbe858..13b296f77e 100644 --- a/morpheus/_lib/include/morpheus/utilities/type_util_detail.hpp +++ b/morpheus/_lib/include/morpheus/utilities/type_util_detail.hpp @@ -105,47 +105,47 @@ struct DataType { if constexpr (std::is_integral_v && std::is_signed_v && size_in_bits() == 8) { - return DataType(TypeId::INT8); + return {TypeId::INT8}; } else if constexpr (std::is_integral_v && std::is_signed_v && size_in_bits() == 16) { - return DataType(TypeId::INT16); + return {TypeId::INT16}; } else if constexpr (std::is_integral_v && std::is_signed_v && size_in_bits() == 32) { - return DataType(TypeId::INT32); + return {TypeId::INT32}; } else if constexpr (std::is_integral_v && std::is_signed_v && size_in_bits() == 64) { - return DataType(TypeId::INT64); + return {TypeId::INT64}; } else if constexpr (std::is_integral_v && std::is_unsigned_v && size_in_bits() == 8) { - return DataType(TypeId::UINT8); + return {TypeId::UINT8}; } else if constexpr (std::is_integral_v && std::is_unsigned_v && size_in_bits() == 16) { - return DataType(TypeId::UINT16); + return {TypeId::UINT16}; } else if constexpr (std::is_integral_v && std::is_unsigned_v && size_in_bits() == 32) { - return DataType(TypeId::UINT32); + return {TypeId::UINT32}; } else if constexpr (std::is_integral_v && std::is_unsigned_v && size_in_bits() == 64) { - return DataType(TypeId::UINT64); + return {TypeId::UINT64}; } else if constexpr (std::is_floating_point_v && size_in_bits() == 32) { - return DataType(TypeId::FLOAT32); + return {TypeId::FLOAT32}; } else if constexpr (std::is_floating_point_v && size_in_bits() == 64) { - return DataType(TypeId::FLOAT64); + return {TypeId::FLOAT64}; } else if constexpr (std::is_same_v) { - return DataType(TypeId::BOOL8); + return {TypeId::BOOL8}; } else { @@ -153,7 +153,7 @@ struct DataType } // To hide compiler warnings - return DataType(TypeId::EMPTY); + return {TypeId::EMPTY}; } // From numpy diff --git a/morpheus/_lib/src/messages/multi.cpp b/morpheus/_lib/src/messages/multi.cpp index 491220273f..ee0b5a017e 100644 --- a/morpheus/_lib/src/messages/multi.cpp +++ b/morpheus/_lib/src/messages/multi.cpp @@ -29,10 +29,10 @@ #include #include #include +#include // for MRC_CHECK_CUDA #include #include #include // for get_current_device_resource -#include // for SRF_CHECK_CUDA #include // for transform #include // needed for pybind11::make_tuple @@ -152,11 +152,11 @@ void MultiMessage::set_meta(const std::vector &column_names, const if (row_stride == 1) { // column major just use cudaMemcpy - SRF_CHECK_CUDA(cudaMemcpy(data_start, tensors[i].data(), tensors[i].bytes(), cudaMemcpyDeviceToDevice)); + MRC_CHECK_CUDA(cudaMemcpy(data_start, tensors[i].data(), tensors[i].bytes(), cudaMemcpyDeviceToDevice)); } else { - SRF_CHECK_CUDA(cudaMemcpy2D(data_start, + MRC_CHECK_CUDA(cudaMemcpy2D(data_start, item_size, tensors[i].data(), row_stride * item_size, diff --git a/morpheus/_lib/src/objects/rmm_tensor.cpp b/morpheus/_lib/src/objects/rmm_tensor.cpp index 79bfcf28a8..f9f770918f 100644 --- a/morpheus/_lib/src/objects/rmm_tensor.cpp +++ b/morpheus/_lib/src/objects/rmm_tensor.cpp @@ -25,9 +25,9 @@ #include // for cudaMemcpy, cudaMemcpy2D, cudaMemcpyDeviceToDevice #include // for DCHECK_LT, COMPACT_GOOGLE_LOG_FATAL, DCHECK, DCHECK_EQ, LogMessageFatal +#include // for MRC_CHECK_CUDA #include // for cuda_stream_per_thread #include -#include // for SRF_CHECK_CUDA #include // for copy, transform #include @@ -205,12 +205,12 @@ std::shared_ptr RMMTensor::copy_rows(const std::vectordata(), slice_size, cudaMemcpyDeviceToDevice)); } else { - SRF_CHECK_CUDA(cudaMemcpy2D(output_offset, + MRC_CHECK_CUDA(cudaMemcpy2D(output_offset, item_size, sliced_input_tensor->data(), row_stride * item_size, diff --git a/morpheus/_lib/src/objects/table_info.cpp b/morpheus/_lib/src/objects/table_info.cpp index 8f3b3d7c81..5a11b984b1 100644 --- a/morpheus/_lib/src/objects/table_info.cpp +++ b/morpheus/_lib/src/objects/table_info.cpp @@ -187,6 +187,6 @@ TableInfo TableInfo::get_slice(cudf::size_type start, cudf::size_type stop, std: auto slice_cols = slice_rows.select(col_indices); - return TableInfo(m_parent, slice_cols, m_index_names, new_column_names); + return {m_parent, slice_cols, m_index_names, new_column_names}; } } // namespace morpheus diff --git a/morpheus/_lib/src/objects/tensor.cpp b/morpheus/_lib/src/objects/tensor.cpp index e9eb146edb..3cce1391d6 100644 --- a/morpheus/_lib/src/objects/tensor.cpp +++ b/morpheus/_lib/src/objects/tensor.cpp @@ -22,9 +22,9 @@ #include "morpheus/utilities/tensor_util.hpp" // for TensorUtils::get_element_stride #include "morpheus/utilities/type_util.hpp" -#include // for cudaMemcpy, cudaMemcpyDeviceToHost +#include // for cudaMemcpy, cudaMemcpyDeviceToHost +#include // for MRC_CHECK_CUDA #include -#include // for SRF_CHECK_CUDA #include #include @@ -62,7 +62,7 @@ std::vector Tensor::get_host_data() const out_data.resize(this->bytes_count()); - SRF_CHECK_CUDA(cudaMemcpy(&out_data[0], this->data(), this->bytes_count(), cudaMemcpyDeviceToHost)); + MRC_CHECK_CUDA(cudaMemcpy(&out_data[0], this->data(), this->bytes_count(), cudaMemcpyDeviceToHost)); return out_data; } @@ -86,6 +86,6 @@ TensorObject Tensor::create(std::shared_ptr buffer, } auto tensor = std::make_shared(buffer, offset, dtype, shape, strides); - return TensorObject(md, tensor); + return {md, tensor}; } } // namespace morpheus diff --git a/morpheus/_lib/src/objects/tensor_object.cpp b/morpheus/_lib/src/objects/tensor_object.cpp index 7d145822a8..dd5d563963 100644 --- a/morpheus/_lib/src/objects/tensor_object.cpp +++ b/morpheus/_lib/src/objects/tensor_object.cpp @@ -33,4 +33,6 @@ static void set_contiguous_stride(const std::vector& shape, std::ve } } +void TensorObject::throw_on_invalid_storage() {} + } // namespace morpheus diff --git a/morpheus/_lib/src/python_modules/messages.cpp b/morpheus/_lib/src/python_modules/messages.cpp index 2f250f9bf8..7689ff345d 100644 --- a/morpheus/_lib/src/python_modules/messages.cpp +++ b/morpheus/_lib/src/python_modules/messages.cpp @@ -31,17 +31,17 @@ #include "morpheus/objects/data_table.hpp" #include "morpheus/utilities/cudf_util.hpp" +#include // for Status +#include +#include #include // IWYU pragma: keep #include #include #include // IWYU pragma: keep -#include -#include -#include -#include // for pysrf::import -#include // for Status -#include -#include +#include +#include +#include +#include // for pymrc::import #include #include @@ -68,46 +68,46 @@ PYBIND11_MODULE(messages, m) // Load the cudf helpers load_cudf_helpers(); - srf::pysrf::import(m, "cupy"); - srf::pysrf::import(m, "morpheus._lib.common"); + mrc::pymrc::import(m, "cupy"); + mrc::pymrc::import(m, "morpheus._lib.common"); // Required for SegmentObject - srf::pysrf::import(m, "srf.core.node"); + mrc::pymrc::import(m, "mrc.core.node"); // Allows python objects to keep DataTable objects alive py::class_>(m, "DataTable"); - srf::pysrf::PortBuilderUtil::register_port_util>(); - srf::pysrf::PortBuilderUtil::register_port_util>(); - srf::pysrf::PortBuilderUtil::register_port_util>(); - srf::pysrf::PortBuilderUtil::register_port_util>(); - srf::pysrf::PortBuilderUtil::register_port_util>(); - srf::pysrf::PortBuilderUtil::register_port_util>(); - srf::pysrf::PortBuilderUtil::register_port_util>(); + mrc::pymrc::PortBuilderUtil::register_port_util>(); + mrc::pymrc::PortBuilderUtil::register_port_util>(); + mrc::pymrc::PortBuilderUtil::register_port_util>(); + mrc::pymrc::PortBuilderUtil::register_port_util>(); + mrc::pymrc::PortBuilderUtil::register_port_util>(); + mrc::pymrc::PortBuilderUtil::register_port_util>(); + mrc::pymrc::PortBuilderUtil::register_port_util>(); // EdgeConnectors for derived classes of MultiMessage to MultiMessage - srf::node::EdgeConnector, + mrc::node::EdgeConnector, std::shared_ptr>::register_converter(); - srf::node::EdgeConnector, + mrc::node::EdgeConnector, std::shared_ptr>::register_converter(); - srf::node::EdgeConnector, + mrc::node::EdgeConnector, std::shared_ptr>::register_converter(); - srf::node::EdgeConnector, + mrc::node::EdgeConnector, std::shared_ptr>::register_converter(); - srf::node::EdgeConnector, + mrc::node::EdgeConnector, std::shared_ptr>::register_converter(); - srf::node::EdgeConnector, + mrc::node::EdgeConnector, std::shared_ptr>::register_converter(); - srf::node::EdgeConnector, + mrc::node::EdgeConnector, std::shared_ptr>::register_converter(); - srf::node::EdgeConnector, + mrc::node::EdgeConnector, std::shared_ptr>::register_converter(); py::class_>(m, "MessageMeta") diff --git a/morpheus/_lib/src/python_modules/stages.cpp b/morpheus/_lib/src/python_modules/stages.cpp index 3e94ba9f61..84538a75e3 100644 --- a/morpheus/_lib/src/python_modules/stages.cpp +++ b/morpheus/_lib/src/python_modules/stages.cpp @@ -28,11 +28,11 @@ #include "morpheus/stages/write_to_file.hpp" #include "morpheus/utilities/cudf_util.hpp" +#include #include // for multiple_inheritance #include // for arg, init, class_, module_, str_attr_accessor, PYBIND11_MODULE, pybind11 #include // for dict, sequence -#include // for pysrf::import -#include +#include // for pymrc::import #include @@ -53,13 +53,13 @@ PYBIND11_MODULE(stages, m) // Load the cudf helpers load_cudf_helpers(); - srf::pysrf::import(m, "cupy"); - srf::pysrf::import(m, "morpheus._lib.messages"); - srf::pysrf::import(m, "morpheus._lib.file_types"); + mrc::pymrc::import(m, "cupy"); + mrc::pymrc::import(m, "morpheus._lib.messages"); + mrc::pymrc::import(m, "morpheus._lib.file_types"); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "AddClassificationsStage", py::multiple_inheritance()) .def(py::init<>(&AddClassificationStageInterfaceProxy::init), py::arg("builder"), @@ -68,36 +68,36 @@ PYBIND11_MODULE(stages, m) py::arg("num_class_labels"), py::arg("idx2label")); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>(m, "AddScoresStage", py::multiple_inheritance()) + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>(m, "AddScoresStage", py::multiple_inheritance()) .def(py::init<>(&AddScoresStageInterfaceProxy::init), py::arg("builder"), py::arg("name"), py::arg("num_class_labels"), py::arg("idx2label")); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "DeserializeStage", py::multiple_inheritance()) .def(py::init<>(&DeserializeStageInterfaceProxy::init), py::arg("builder"), py::arg("name"), py::arg("batch_size")); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>(m, "FileSourceStage", py::multiple_inheritance()) + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>(m, "FileSourceStage", py::multiple_inheritance()) .def(py::init<>(&FileSourceStageInterfaceProxy::init), py::arg("builder"), py::arg("name"), py::arg("filename"), py::arg("repeat")); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "FilterDetectionsStage", py::multiple_inheritance()) .def(py::init<>(&FilterDetectionStageInterfaceProxy::init), py::arg("builder"), @@ -105,9 +105,9 @@ PYBIND11_MODULE(stages, m) py::arg("threshold"), py::arg("copy") = true); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "InferenceClientStage", py::multiple_inheritance()) .def(py::init<>(&InferenceClientStageInterfaceProxy::init), py::arg("builder"), @@ -119,9 +119,9 @@ PYBIND11_MODULE(stages, m) py::arg("needs_logits"), py::arg("inout_mapping") = py::dict()); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "KafkaSourceStage", py::multiple_inheritance()) .def(py::init<>(&KafkaSourceStageInterfaceProxy::init), py::arg("builder"), @@ -135,18 +135,18 @@ PYBIND11_MODULE(stages, m) py::arg("stop_after") = 0, py::arg("async_commits") = true); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "PreprocessFILStage", py::multiple_inheritance()) .def(py::init<>(&PreprocessFILStageInterfaceProxy::init), py::arg("builder"), py::arg("name"), py::arg("features")); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "PreprocessNLPStage", py::multiple_inheritance()) .def(py::init<>(&PreprocessNLPStageInterfaceProxy::init), py::arg("builder"), @@ -159,9 +159,9 @@ PYBIND11_MODULE(stages, m) py::arg("stride"), py::arg("column")); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>(m, "SerializeStage", py::multiple_inheritance()) + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>(m, "SerializeStage", py::multiple_inheritance()) .def(py::init<>(&SerializeStageInterfaceProxy::init), py::arg("builder"), py::arg("name"), @@ -169,9 +169,9 @@ PYBIND11_MODULE(stages, m) py::arg("exclude"), py::arg("fixed_columns") = true); - py::class_, - srf::segment::ObjectProperties, - std::shared_ptr>>( + py::class_, + mrc::segment::ObjectProperties, + std::shared_ptr>>( m, "WriteToFileStage", py::multiple_inheritance()) .def(py::init<>(&WriteToFileStageInterfaceProxy::init), py::arg("builder"), diff --git a/morpheus/_lib/src/stages/add_classification.cpp b/morpheus/_lib/src/stages/add_classification.cpp index 270d16ddbd..c2eded0885 100644 --- a/morpheus/_lib/src/stages/add_classification.cpp +++ b/morpheus/_lib/src/stages/add_classification.cpp @@ -27,9 +27,9 @@ #include // for cudaMemcpy, cudaMemcpyDeviceToDevice #include +#include // for MRC_CHECK_CUDA #include // for cuda_stream_per_thread #include // for device_buffer -#include // for SRF_CHECK_CUDA #include // for min_element, transform #include @@ -75,7 +75,7 @@ AddClassificationsStage::subscribe_fn_t AddClassificationsStage::build_operator( // A bit ugly, but we cant get access to the rmm::device_buffer here. So make a copy auto tmp_buffer = std::make_shared(probs.bytes(), rmm::cuda_stream_per_thread); - SRF_CHECK_CUDA( + MRC_CHECK_CUDA( cudaMemcpy(tmp_buffer->data(), probs.data(), tmp_buffer->size(), cudaMemcpyDeviceToDevice)); // Depending on the input the stride is given in bytes or elements, convert to elements @@ -120,8 +120,8 @@ AddClassificationsStage::subscribe_fn_t AddClassificationsStage::build_operator( } // ************ AddClassificationStageInterfaceProxy ************* // -std::shared_ptr> AddClassificationStageInterfaceProxy::init( - srf::segment::Builder& builder, +std::shared_ptr> AddClassificationStageInterfaceProxy::init( + mrc::segment::Builder& builder, const std::string& name, float threshold, std::size_t num_class_labels, diff --git a/morpheus/_lib/src/stages/add_scores.cpp b/morpheus/_lib/src/stages/add_scores.cpp index 46dfa12b7c..ce81d964e3 100644 --- a/morpheus/_lib/src/stages/add_scores.cpp +++ b/morpheus/_lib/src/stages/add_scores.cpp @@ -21,9 +21,9 @@ #include "morpheus/objects/tensor_object.hpp" // for TensorIndex, TensorObject #include -#include // for SinkProperties<>::sink_type_t -#include // for SourceProperties<>::source_type_t -#include // for Object +#include // for SinkProperties<>::sink_type_t +#include // for SourceProperties<>::source_type_t +#include // for Object #include // for size_t #include @@ -86,8 +86,8 @@ AddScoresStage::subscribe_fn_t AddScoresStage::build_operator() } // ************ AddScoresStageInterfaceProxy ************* // -std::shared_ptr> AddScoresStageInterfaceProxy::init( - srf::segment::Builder& builder, +std::shared_ptr> AddScoresStageInterfaceProxy::init( + mrc::segment::Builder& builder, const std::string& name, std::size_t num_class_labels, std::map idx2label) diff --git a/morpheus/_lib/src/stages/deserialize.cpp b/morpheus/_lib/src/stages/deserialize.cpp index 3ca4ad0163..9919d62d5e 100644 --- a/morpheus/_lib/src/stages/deserialize.cpp +++ b/morpheus/_lib/src/stages/deserialize.cpp @@ -17,9 +17,9 @@ #include "morpheus/stages/deserialize.hpp" -#include +#include +#include #include -#include #include // for min #include @@ -58,8 +58,8 @@ DeserializeStage::subscribe_fn_t DeserializeStage::build_operator() } // ************ DeserializationStageInterfaceProxy ************* // -std::shared_ptr> DeserializeStageInterfaceProxy::init( - srf::segment::Builder &builder, const std::string &name, size_t batch_size) +std::shared_ptr> DeserializeStageInterfaceProxy::init( + mrc::segment::Builder& builder, const std::string& name, size_t batch_size) { auto stage = builder.construct_object(name, batch_size); diff --git a/morpheus/_lib/src/stages/file_source.cpp b/morpheus/_lib/src/stages/file_source.cpp index 46eda28522..45ca9a3250 100644 --- a/morpheus/_lib/src/stages/file_source.cpp +++ b/morpheus/_lib/src/stages/file_source.cpp @@ -28,11 +28,11 @@ #include // for table #include #include +#include #include // for object_api::operator() #include #include // for str_attr_accessor #include // for pybind11::int_ -#include #include // for find #include // for size_t @@ -114,8 +114,8 @@ FileSourceStage::subscriber_fn_t FileSourceStage::build() } // ************ FileSourceStageInterfaceProxy ************ // -std::shared_ptr> FileSourceStageInterfaceProxy::init( - srf::segment::Builder &builder, const std::string &name, std::string filename, int repeat) +std::shared_ptr> FileSourceStageInterfaceProxy::init( + mrc::segment::Builder& builder, const std::string& name, std::string filename, int repeat) { auto stage = builder.construct_object(name, filename, repeat); diff --git a/morpheus/_lib/src/stages/filter_detection.cpp b/morpheus/_lib/src/stages/filter_detection.cpp index 1040440642..80d618ac66 100644 --- a/morpheus/_lib/src/stages/filter_detection.cpp +++ b/morpheus/_lib/src/stages/filter_detection.cpp @@ -25,9 +25,9 @@ #include // for cudaMemcpy, cudaMemcpyDeviceToDevice, cudaMemcpyDeviceToHost #include // for CHECK +#include // for MRC_CHECK_CUDA #include // for cuda_stream_per_thread #include // for device_buffer -#include // for SRF_CHECK_CUDA #include #include // for uint8_t @@ -69,7 +69,7 @@ FilterDetectionsStage::subscribe_fn_t FilterDetectionsStage::build_operator() auto tmp_buffer = std::make_shared(probs.count() * probs.dtype_size(), rmm::cuda_stream_per_thread); - SRF_CHECK_CUDA( + MRC_CHECK_CUDA( cudaMemcpy(tmp_buffer->data(), probs.data(), tmp_buffer->size(), cudaMemcpyDeviceToDevice)); // Depending on the input the stride is given in bytes or elements, convert to elements @@ -86,7 +86,7 @@ FilterDetectionsStage::subscribe_fn_t FilterDetectionsStage::build_operator() std::vector host_bool_values(num_rows); // Copy bools back to host - SRF_CHECK_CUDA(cudaMemcpy(host_bool_values.data(), + MRC_CHECK_CUDA(cudaMemcpy(host_bool_values.data(), thresh_bool_buffer->data(), thresh_bool_buffer->size(), cudaMemcpyDeviceToHost)); @@ -149,8 +149,8 @@ FilterDetectionsStage::subscribe_fn_t FilterDetectionsStage::build_operator() } // ************ FilterDetectionStageInterfaceProxy ************* // -std::shared_ptr> FilterDetectionStageInterfaceProxy::init( - srf::segment::Builder &builder, const std::string &name, float threshold, bool copy) +std::shared_ptr> FilterDetectionStageInterfaceProxy::init( + mrc::segment::Builder& builder, const std::string& name, float threshold, bool copy) { auto stage = builder.construct_object(name, threshold, copy); diff --git a/morpheus/_lib/src/stages/kafka_source.cpp b/morpheus/_lib/src/stages/kafka_source.cpp index 665822ce40..15e35fe994 100644 --- a/morpheus/_lib/src/stages/kafka_source.cpp +++ b/morpheus/_lib/src/stages/kafka_source.cpp @@ -32,11 +32,11 @@ #include // for table #include #include +#include +#include +#include // for SharedFuture #include -#include -#include -#include -#include // for SharedFuture +#include #include // for find, min, transform #include @@ -77,7 +77,7 @@ class KafkaSourceStageStopAfter : public std::exception {}; // ************ KafkaSourceStage__Rebalancer *************************// -class KafkaSourceStage__Rebalancer : public RdKafka::RebalanceCb +class KafkaSourceStage__Rebalancer : public RdKafka::RebalanceCb // NOLINT { public: KafkaSourceStage__Rebalancer(std::function batch_timeout_fn, @@ -152,7 +152,7 @@ class KafkaSourceStage__Rebalancer : public RdKafka::RebalanceCb std::function> &)> m_process_fn; boost::fibers::recursive_mutex m_mutex; - srf::SharedFuture m_partition_future; + mrc::SharedFuture m_partition_future; }; KafkaSourceStage__Rebalancer::KafkaSourceStage__Rebalancer( @@ -279,10 +279,10 @@ KafkaSourceStage::subscriber_fn_t KafkaSourceStage::build() [this]() { return this->batch_timeout_ms(); }, [this]() { return this->max_batch_size(); }, [this](const std::string str_to_display) { - auto &ctx = srf::runnable::Context::get_runtime_context(); + auto& ctx = mrc::runnable::Context::get_runtime_context(); return MORPHEUS_CONCAT_STR(ctx.info() << " " << str_to_display); }, - [sub, &records_emitted, this](std::vector> &message_batch) { + [sub, &records_emitted, this](std::vector>& message_batch) { // If we are unsubscribed, throw an error to break the loops if (!sub.is_subscribed()) { @@ -316,7 +316,7 @@ KafkaSourceStage::subscriber_fn_t KafkaSourceStage::build() return m_requires_commit; }); - auto &context = srf::runnable::Context::get_runtime_context(); + auto& context = mrc::runnable::Context::get_runtime_context(); // Build consumer auto consumer = this->create_consumer(rebalancer); @@ -463,7 +463,7 @@ std::unique_ptr KafkaSourceStage::create_consumer(RdKafk std::map> topic_parts; - auto &ctx = srf::runnable::Context::get_runtime_context(); + auto& ctx = mrc::runnable::Context::get_runtime_context(); VLOG(10) << ctx.info() << MORPHEUS_CONCAT_STR(" Subscribed to " << md->topics()->size() << " topics:"); for (auto const &topic : *(md->topics())) @@ -510,7 +510,7 @@ std::unique_ptr KafkaSourceStage::create_consumer(RdKafk return MORPHEUS_CONCAT_STR("(" << std::get<0>(x) << ", " << std::get<1>(x) << ")"); }); - auto &ctx = srf::runnable::Context::get_runtime_context(); + auto& ctx = mrc::runnable::Context::get_runtime_context(); VLOG(10) << ctx.info() << MORPHEUS_CONCAT_STR( " Topic: '" << topic->topic() @@ -571,9 +571,9 @@ std::shared_ptr KafkaSourceStage::process_batch( } // ************ KafkaStageInterfaceProxy ************ // -std::shared_ptr> KafkaSourceStageInterfaceProxy::init( - srf::segment::Builder &builder, - const std::string &name, +std::shared_ptr> KafkaSourceStageInterfaceProxy::init( + mrc::segment::Builder& builder, + const std::string& name, size_t max_batch_size, std::string topic, int32_t batch_timeout_ms, diff --git a/morpheus/_lib/src/stages/preprocess_fil.cpp b/morpheus/_lib/src/stages/preprocess_fil.cpp index 20ca1875e2..4d72a42ac0 100644 --- a/morpheus/_lib/src/stages/preprocess_fil.cpp +++ b/morpheus/_lib/src/stages/preprocess_fil.cpp @@ -33,15 +33,15 @@ #include // for table_view #include #include +#include // for MRC_CHECK_CUDA +#include #include // for object_api::operator(), operator""_a #include #include // for str_attr_accessor, arg #include -#include +#include #include // for cuda_stream_per_thread #include // for device_buffer -#include // for SRF_CHECK_CUDA -#include #include #include @@ -54,7 +54,7 @@ namespace morpheus { // Component public implementations // ************ PreprocessFILStage ************************* // -PreprocessFILStage::PreprocessFILStage(const std::vector &features) : +PreprocessFILStage::PreprocessFILStage(const std::vector& features) : PythonNode(base_t::op_factory_from_sub_fn(build_operator())), m_fea_cols(std::move(features)) {} @@ -113,7 +113,7 @@ PreprocessFILStage::subscribe_fn_t PreprocessFILStage::build_operator() { auto curr_col = df_just_features.column(df_meta.num_indices() + i); - auto curr_ptr = static_cast(packed_data->data()) + i * df_just_features.num_rows(); + auto curr_ptr = static_cast(packed_data->data()) + i * df_just_features.num_rows(); // Check if we are something other than float if (curr_col.type().id() != cudf::type_id::FLOAT32) @@ -121,14 +121,14 @@ PreprocessFILStage::subscribe_fn_t PreprocessFILStage::build_operator() auto float_data = cudf::cast(curr_col, cudf::data_type(cudf::type_id::FLOAT32))->release(); // Do the copy here before it goes out of scope - SRF_CHECK_CUDA(cudaMemcpy(curr_ptr, + MRC_CHECK_CUDA(cudaMemcpy(curr_ptr, float_data.data->data(), df_just_features.num_rows() * sizeof(float), cudaMemcpyDeviceToDevice)); } else { - SRF_CHECK_CUDA(cudaMemcpy(curr_ptr, + MRC_CHECK_CUDA(cudaMemcpy(curr_ptr, curr_col.data(), df_just_features.num_rows() * sizeof(float), cudaMemcpyDeviceToDevice)); @@ -169,8 +169,8 @@ PreprocessFILStage::subscribe_fn_t PreprocessFILStage::build_operator() } // ************ PreprocessFILStageInterfaceProxy *********** // -std::shared_ptr> PreprocessFILStageInterfaceProxy::init( - srf::segment::Builder &builder, const std::string &name, const std::vector &features) +std::shared_ptr> PreprocessFILStageInterfaceProxy::init( + mrc::segment::Builder& builder, const std::string& name, const std::vector& features) { auto stage = builder.construct_object(name, features); diff --git a/morpheus/_lib/src/stages/preprocess_nlp.cpp b/morpheus/_lib/src/stages/preprocess_nlp.cpp index d16e7fa28d..30105fcafc 100644 --- a/morpheus/_lib/src/stages/preprocess_nlp.cpp +++ b/morpheus/_lib/src/stages/preprocess_nlp.cpp @@ -29,10 +29,10 @@ #include // for strings_column_view #include #include +#include #include -#include +#include #include // for device_buffer -#include #include #include @@ -138,9 +138,9 @@ PreprocessNLPStage::subscribe_fn_t PreprocessNLPStage::build_operator() } // ************ PreprocessNLPStageInterfaceProxy *********** // -std::shared_ptr> PreprocessNLPStageInterfaceProxy::init( - srf::segment::Builder &builder, - const std::string &name, +std::shared_ptr> PreprocessNLPStageInterfaceProxy::init( + mrc::segment::Builder& builder, + const std::string& name, std::string vocab_hash_file, uint32_t sequence_length, bool truncation, diff --git a/morpheus/_lib/src/stages/serialize.cpp b/morpheus/_lib/src/stages/serialize.cpp index 3dc533c77e..8f2a8c672d 100644 --- a/morpheus/_lib/src/stages/serialize.cpp +++ b/morpheus/_lib/src/stages/serialize.cpp @@ -121,11 +121,11 @@ SerializeStage::subscribe_fn_t SerializeStage::build_operator() } // ************ WriteToFileStageInterfaceProxy ************* // -std::shared_ptr> SerializeStageInterfaceProxy::init( - srf::segment::Builder &builder, - const std::string &name, - const std::vector &include, - const std::vector &exclude, +std::shared_ptr> SerializeStageInterfaceProxy::init( + mrc::segment::Builder& builder, + const std::string& name, + const std::vector& include, + const std::vector& exclude, bool fixed_columns) { auto stage = builder.construct_object(name, include, exclude, fixed_columns); diff --git a/morpheus/_lib/src/stages/triton_inference.cpp b/morpheus/_lib/src/stages/triton_inference.cpp index 434035f16f..f784fed057 100644 --- a/morpheus/_lib/src/stages/triton_inference.cpp +++ b/morpheus/_lib/src/stages/triton_inference.cpp @@ -34,11 +34,11 @@ #include // for cudaMemcpy, cudaMemcpy2D, cudaMemcpyDeviceToHost, cudaMemcpyHostToDevice #include #include +#include // for MRC_CHECK_CUDA #include -#include +#include #include // for cuda_stream_per_thread #include // for device_buffer -#include // for SRF_CHECK_CUDA #include // for min #include @@ -152,7 +152,7 @@ InferenceClientStage::subscribe_fn_t InferenceClientStage::build_operator() const auto item_size = seq_ids.dtype().item_size(); host_seq_ids = std::make_unique>(x->count); - SRF_CHECK_CUDA(cudaMemcpy2D(host_seq_ids->data(), + MRC_CHECK_CUDA(cudaMemcpy2D(host_seq_ids->data(), item_size, seq_ids.data(), seq_ids.stride(0) * item_size, @@ -258,7 +258,7 @@ InferenceClientStage::subscribe_fn_t InferenceClientStage::build_operator() auto output_buffer = std::make_shared(output_ptr_size, rmm::cuda_stream_per_thread); - SRF_CHECK_CUDA( + MRC_CHECK_CUDA( cudaMemcpy(output_buffer->data(), output_ptr, output_ptr_size, cudaMemcpyHostToDevice)); if (needs_seq_ids && output_shape[0] != mini_batch_output->count) @@ -474,9 +474,9 @@ bool InferenceClientStage::is_default_grpc_port(std::string &server_url) } // ************ InferenceClientStageInterfaceProxy********* // -std::shared_ptr> InferenceClientStageInterfaceProxy::init( - srf::segment::Builder &builder, - const std::string &name, +std::shared_ptr> InferenceClientStageInterfaceProxy::init( + mrc::segment::Builder& builder, + const std::string& name, std::string model_name, std::string server_url, bool force_convert_inputs, diff --git a/morpheus/_lib/src/stages/write_to_file.cpp b/morpheus/_lib/src/stages/write_to_file.cpp index b177bdb17b..19bf5d9c16 100644 --- a/morpheus/_lib/src/stages/write_to_file.cpp +++ b/morpheus/_lib/src/stages/write_to_file.cpp @@ -107,11 +107,11 @@ WriteToFileStage::subscribe_fn_t WriteToFileStage::build_operator() } // ************ WriteToFileStageInterfaceProxy ************* // -std::shared_ptr> WriteToFileStageInterfaceProxy::init( - srf::segment::Builder &builder, - const std::string &name, - const std::string &filename, - const std::string &mode, +std::shared_ptr> WriteToFileStageInterfaceProxy::init( + mrc::segment::Builder& builder, + const std::string& name, + const std::string& filename, + const std::string& mode, FileTypes file_type, bool include_index_col) { diff --git a/morpheus/_lib/src/utilities/cupy_util.cpp b/morpheus/_lib/src/utilities/cupy_util.cpp index 4b33b42bf5..af332e407a 100644 --- a/morpheus/_lib/src/utilities/cupy_util.cpp +++ b/morpheus/_lib/src/utilities/cupy_util.cpp @@ -49,7 +49,7 @@ pybind11::module_ CupyUtil::get_cp() cp_module = pybind11::module_::import("cupy"); } - pybind11::module_ m = pybind11::cast(cp_module); + auto m = pybind11::cast(cp_module); return m; } @@ -102,11 +102,11 @@ TensorObject CupyUtil::cupy_to_tensor(pybind11::object cupy_array) pybind11::print(shape_tup); auto shape = shape_tup.cast>(); - std::string typestr = arr_interface["typestr"].cast(); + auto typestr = arr_interface["typestr"].cast(); pybind11::tuple data_tup = arr_interface["data"]; - uintptr_t data_ptr = data_tup[0].cast(); + auto data_ptr = data_tup[0].cast(); std::vector strides{}; diff --git a/morpheus/_lib/src/utilities/matx_util.cu b/morpheus/_lib/src/utilities/matx_util.cu index dabc5d74b6..73ef1c4321 100644 --- a/morpheus/_lib/src/utilities/matx_util.cu +++ b/morpheus/_lib/src/utilities/matx_util.cu @@ -21,7 +21,7 @@ #include "morpheus/utilities/type_util.hpp" #include "morpheus/objects/tensor_object.hpp" -#include +#include #include @@ -299,7 +299,7 @@ namespace morpheus { input.data(), output->data()); - srf::enqueue_stream_sync_event(output->stream()).get(); + mrc::enqueue_stream_sync_event(output->stream()).get(); return output; } @@ -372,7 +372,7 @@ namespace morpheus { thresh_val, stride); - srf::enqueue_stream_sync_event(output->stream()).get(); + mrc::enqueue_stream_sync_event(output->stream()).get(); return output; } @@ -426,7 +426,7 @@ namespace morpheus { num_input_rows, seq_ids[start+seq_id_offset]-output_offset); - srf::enqueue_stream_sync_event(output->stream()).get(); + mrc::enqueue_stream_sync_event(output->stream()).get(); return output; } } diff --git a/morpheus/_lib/src/utilities/tensor_util.cpp b/morpheus/_lib/src/utilities/tensor_util.cpp index 0b11d089d5..9db33d5e9a 100644 --- a/morpheus/_lib/src/utilities/tensor_util.cpp +++ b/morpheus/_lib/src/utilities/tensor_util.cpp @@ -18,7 +18,7 @@ #include "morpheus/utilities/tensor_util.hpp" #include // for DCHECK_EQ -#include // for sort_indexes +#include // for sort_indexes // clang-format off // prevent from moving this into the third-party section @@ -33,14 +33,14 @@ #include // for vector namespace morpheus { -void TensorUtils::write_shape_to_stream(const shape_type& shape, std::ostream& os) +void TensorUtils::write_shape_to_stream(const shape_type_t& shape, std::ostream& os) { os << "("; std::copy(shape.begin(), shape.end(), std::experimental::make_ostream_joiner(os, ", ")); os << ")"; } -std::string TensorUtils::shape_to_string(const shape_type& shape) +std::string TensorUtils::shape_to_string(const shape_type_t& shape) { std::stringstream ss; write_shape_to_stream(shape, ss); @@ -59,7 +59,7 @@ void TensorUtils::set_contiguous_stride(const std::vector& shape, s } } -bool TensorUtils::has_contiguous_stride(const std::vector& shape, const shape_type& stride) +bool TensorUtils::has_contiguous_stride(const std::vector& shape, const shape_type_t& stride) { DCHECK_EQ(shape.size(), stride.size()); auto count = std::accumulate(std::begin(shape), std::end(shape), 1, std::multiplies<>()); @@ -74,7 +74,7 @@ bool TensorUtils::validate_shape_and_stride(const std::vector& shap return false; } - auto stride_sorted_idx = srf::sort_indexes(stride); + auto stride_sorted_idx = mrc::sort_indexes(stride); for (int i = 0; i < stride_sorted_idx.size() - 1; ++i) { diff --git a/morpheus/_lib/src/utilities/type_util_detail.cpp b/morpheus/_lib/src/utilities/type_util_detail.cpp index 670d89da19..fc58ac167c 100644 --- a/morpheus/_lib/src/utilities/type_util_detail.cpp +++ b/morpheus/_lib/src/utilities/type_util_detail.cpp @@ -127,7 +127,7 @@ DataType DataType::from_numpy(const std::string& numpy_str) CHECK(found_enum != found_type->second.end()) << "Type str '" << type_char << dtype_size << "' not supported"; - return DataType(found_enum->second); + return {found_enum->second}; } char DataType::type_char() const diff --git a/morpheus/_lib/tests/CMakeLists.txt b/morpheus/_lib/tests/CMakeLists.txt index fed24ba734..eec42f51d3 100644 --- a/morpheus/_lib/tests/CMakeLists.txt +++ b/morpheus/_lib/tests/CMakeLists.txt @@ -30,7 +30,7 @@ target_link_libraries(test_libmorpheus PRIVATE cuda_utils morpheus - srf::pysrf + mrc::pymrc GTest::gtest matx::matx pybind11::embed diff --git a/morpheus/_lib/tests/test_cuda.cu b/morpheus/_lib/tests/test_cuda.cu index 5370c1895a..984d6b5b4c 100644 --- a/morpheus/_lib/tests/test_cuda.cu +++ b/morpheus/_lib/tests/test_cuda.cu @@ -19,16 +19,16 @@ #include "morpheus/objects/tensor_object.hpp" -#include // for SRF_CHECK_CUDA -#include // for enqueue_stream_sync_event -#include -#include -#include -#include -#include -#include -#include -#include +#include // for MRC_CHECK_CUDA +#include // for enqueue_stream_sync_event +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -43,7 +43,7 @@ #include #include -using namespace srf::memory::literals; +using namespace mrc::memory::literals; using namespace morpheus; using RankType = int; @@ -54,19 +54,19 @@ class TestCuda : public ::testing::Test protected: void SetUp() override { - SRF_CHECK_CUDA(cudaStreamCreate(&stream)); + MRC_CHECK_CUDA(cudaStreamCreate(&stream)); - auto pinned = std::make_shared(); - auto device = std::make_shared(0); + auto pinned = std::make_shared(); + auto device = std::make_shared(0); - m_host_allocator = srf::memory::OldHostAllocator(pinned, nullptr).shared(); - m_device_allocator = srf::memory::OldDeviceAllocator(device, nullptr).shared(); + m_host_allocator = mrc::memory::OldHostAllocator(pinned, nullptr).shared(); + m_device_allocator = mrc::memory::OldDeviceAllocator(device, nullptr).shared(); } void TearDown() override { - SRF_CHECK_CUDA(cudaStreamSynchronize(stream)); - SRF_CHECK_CUDA(cudaStreamDestroy(stream)); + MRC_CHECK_CUDA(cudaStreamSynchronize(stream)); + MRC_CHECK_CUDA(cudaStreamDestroy(stream)); } template @@ -96,15 +96,15 @@ class TestCuda : public ::testing::Test cudaStream_t stream; // NOLINT - std::shared_ptr m_host_allocator; - std::shared_ptr m_device_allocator; + std::shared_ptr m_host_allocator; + std::shared_ptr m_device_allocator; }; template auto await_matx(matx::BaseOp& op, cudaStream_t stream) { op.run(stream); - return srf::enqueue_stream_sync_event(stream); + return mrc::enqueue_stream_sync_event(stream); } void test_1d(const TensorObject& one_d) diff --git a/morpheus/_lib/tests/test_matx_util.cpp b/morpheus/_lib/tests/test_matx_util.cpp index 307140809c..cc2bf5fbc0 100644 --- a/morpheus/_lib/tests/test_matx_util.cpp +++ b/morpheus/_lib/tests/test_matx_util.cpp @@ -29,13 +29,13 @@ #include #include // for data_type, size_type #include +#include // for MRC_CHECK_CUDA #include // for cuda_stream_per_thread #include -#include // for SRF_CHECK_CUDA #include // for int64_t, int32_t, uint8_t #include // for std::getenv -#include // for shared_ptr, make_shared, unique_ptr +#include // for shared_ptr, make_shared, unique_ptr #include #include @@ -55,7 +55,7 @@ TEST_F(TestMatxUtil, ReduceMax1d) auto input_buffer = std::make_shared(input.size() * dtype.item_size(), rmm::cuda_stream_per_thread); - SRF_CHECK_CUDA(cudaMemcpy(input_buffer->data(), input.data(), input_buffer->size(), cudaMemcpyHostToDevice)); + MRC_CHECK_CUDA(cudaMemcpy(input_buffer->data(), input.data(), input_buffer->size(), cudaMemcpyHostToDevice)); DevMemInfo dm{input.size(), dtype.type_id(), input_buffer, 0}; std::vector input_shape{static_cast(input.size()), 1}; @@ -63,7 +63,7 @@ TEST_F(TestMatxUtil, ReduceMax1d) auto output_buffer = MatxUtil::reduce_max(dm, seq_ids, 0, input_shape, {1, 0}, output_shape); std::vector output(expected_output.size()); - SRF_CHECK_CUDA(cudaMemcpy(output.data(), output_buffer->data(), output_buffer->size(), cudaMemcpyDeviceToHost)); + MRC_CHECK_CUDA(cudaMemcpy(output.data(), output_buffer->data(), output_buffer->size(), cudaMemcpyDeviceToHost)); EXPECT_EQ(output, expected_output); } @@ -110,7 +110,7 @@ TEST_F(TestMatxUtil, ReduceMax2dRowMajor) std::size_t buff_size = input.size() * dtype.item_size(); auto input_buffer = std::make_shared(buff_size, rmm::cuda_stream_per_thread); - SRF_CHECK_CUDA(cudaMemcpy(input_buffer->data(), input.data(), input_buffer->size(), cudaMemcpyHostToDevice)); + MRC_CHECK_CUDA(cudaMemcpy(input_buffer->data(), input.data(), input_buffer->size(), cudaMemcpyHostToDevice)); DevMemInfo dm{input.size(), dtype.type_id(), input_buffer, 0}; std::vector input_shape{static_cast(num_rows), static_cast(num_cols)}; @@ -121,7 +121,7 @@ TEST_F(TestMatxUtil, ReduceMax2dRowMajor) EXPECT_EQ(output_buffer->size(), expected_rows * num_cols * dtype.item_size()); std::vector output(expected_rows * num_cols); - SRF_CHECK_CUDA(cudaMemcpy(output.data(), output_buffer->data(), output_buffer->size(), cudaMemcpyDeviceToHost)); + MRC_CHECK_CUDA(cudaMemcpy(output.data(), output_buffer->data(), output_buffer->size(), cudaMemcpyDeviceToHost)); EXPECT_EQ(output.size(), expected_output.size()); for (std::size_t i = 0; i < output.size(); ++i) @@ -153,7 +153,7 @@ TEST_F(TestMatxUtil, ReduceMax2dColMajor) for (cudf::size_type i = 0; i < num_cols; ++i) { auto cv = table_m.tbl->get_column(i).view(); - SRF_CHECK_CUDA(cudaMemcpy(static_cast(input_buffer->data()) + offset, + MRC_CHECK_CUDA(cudaMemcpy(static_cast(input_buffer->data()) + offset, cv.data(), num_rows * dtype.item_size(), cudaMemcpyDeviceToDevice)); @@ -184,7 +184,7 @@ TEST_F(TestMatxUtil, ReduceMax2dColMajor) EXPECT_EQ(output_buffer->size(), expected_rows * num_cols * dtype.item_size()); std::vector output(expected_rows * num_cols); - SRF_CHECK_CUDA(cudaMemcpy(output.data(), output_buffer->data(), output_buffer->size(), cudaMemcpyDeviceToHost)); + MRC_CHECK_CUDA(cudaMemcpy(output.data(), output_buffer->data(), output_buffer->size(), cudaMemcpyDeviceToHost)); EXPECT_EQ(output.size(), expected_output.size()); for (std::size_t i = 0; i < output.size(); ++i) diff --git a/morpheus/_lib/tests/test_multi_slices.cpp b/morpheus/_lib/tests/test_multi_slices.cpp index 6bb4600dc0..9ea0f75b76 100644 --- a/morpheus/_lib/tests/test_multi_slices.cpp +++ b/morpheus/_lib/tests/test_multi_slices.cpp @@ -33,10 +33,10 @@ #include #include #include +#include // for MRC_CHECK_CUDA #include #include // for cuda_stream_per_thread #include -#include // for SRF_CHECK_CUDA #include #include diff --git a/morpheus/_lib/tests/test_tensor.cpp b/morpheus/_lib/tests/test_tensor.cpp index ff58575ddf..2b081e1166 100644 --- a/morpheus/_lib/tests/test_tensor.cpp +++ b/morpheus/_lib/tests/test_tensor.cpp @@ -18,7 +18,7 @@ #include "./test_morpheus.hpp" // IWYU pragma: associated #include "morpheus/objects/tensor_object.hpp" // for TensorIndex -#include "morpheus/utilities/tensor_util.hpp" // for TensorUtils, TensorUtils::shape_type +#include "morpheus/utilities/tensor_util.hpp" // for TensorUtils, TensorUtils::shape_type_t #include // for AssertionResult, SuiteApiResolver, TestInfo, EXPECT_TRUE, Message, TEST_F, Test, TestFactoryImpl, TestPartResult @@ -40,17 +40,17 @@ class TestTensor : public ::testing::Test TEST_F(TestTensor, UtilsShapeString) { - TensorUtils::shape_type shape = {100, 10, 1}; + TensorUtils::shape_type_t shape = {100, 10, 1}; auto shape_str = TensorUtils::shape_to_string(shape); EXPECT_TRUE(shape_str == std::string("(100, 10, 1)")); } TEST_F(TestTensor, GetElementStride) { - EXPECT_EQ(TensorUtils::get_element_stride({10, 1}), TensorUtils::shape_type({10, 1})); - EXPECT_EQ(TensorUtils::get_element_stride({1, 13}), TensorUtils::shape_type({1, 13})); - EXPECT_EQ(TensorUtils::get_element_stride({8, 104}), TensorUtils::shape_type({1, 13})); - EXPECT_EQ(TensorUtils::get_element_stride({8, 16, 112}), TensorUtils::shape_type({1, 2, 14})); + EXPECT_EQ(TensorUtils::get_element_stride({10, 1}), TensorUtils::shape_type_t({10, 1})); + EXPECT_EQ(TensorUtils::get_element_stride({1, 13}), TensorUtils::shape_type_t({1, 13})); + EXPECT_EQ(TensorUtils::get_element_stride({8, 104}), TensorUtils::shape_type_t({1, 13})); + EXPECT_EQ(TensorUtils::get_element_stride({8, 16, 112}), TensorUtils::shape_type_t({1, 2, 14})); EXPECT_EQ(TensorUtils::get_element_stride({10, 1}), std::vector({10, 1})); EXPECT_EQ(TensorUtils::get_element_stride({1, 13}), std::vector({1, 13})); @@ -59,22 +59,22 @@ TEST_F(TestTensor, GetElementStride) { auto results = TensorUtils::get_element_stride({10, 1}); - EXPECT_EQ(results, TensorUtils::shape_type({10, 1})); + EXPECT_EQ(results, TensorUtils::shape_type_t({10, 1})); } { auto results = TensorUtils::get_element_stride({1, 13}); - EXPECT_EQ(results, TensorUtils::shape_type({1, 13})); + EXPECT_EQ(results, TensorUtils::shape_type_t({1, 13})); } { auto results = TensorUtils::get_element_stride({8, 104}); - EXPECT_EQ(results, TensorUtils::shape_type({1, 13})); + EXPECT_EQ(results, TensorUtils::shape_type_t({1, 13})); } { auto results = TensorUtils::get_element_stride({8, 16, 112}); - EXPECT_EQ(results, TensorUtils::shape_type({1, 2, 14})); + EXPECT_EQ(results, TensorUtils::shape_type_t({1, 2, 14})); } } diff --git a/morpheus/_version.py b/morpheus/_version.py index cca38dfd52..af416901c7 100644 --- a/morpheus/_version.py +++ b/morpheus/_version.py @@ -24,12 +24,13 @@ """Git implementation of _version.py.""" import errno +import functools import os import re import subprocess import sys -from typing import Callable, Dict -import functools +from typing import Callable +from typing import Dict def get_keywords(): diff --git a/morpheus/pipeline/linear_pipeline.py b/morpheus/pipeline/linear_pipeline.py index 4937b50a76..547cd38b31 100644 --- a/morpheus/pipeline/linear_pipeline.py +++ b/morpheus/pipeline/linear_pipeline.py @@ -143,7 +143,7 @@ def add_segment_boundary(self, data_type=None, as_shared_pointer=False): data_type=data_type) # TODO: update to use data_type once typeid is attached to registered objects out of band: - # https://github.com/nv-morpheus/SRF/issues/176 + # https://github.com/nv-morpheus/MRC/issues/176 port_id_tuple = (self._current_segment_id, object, False) if data_type else self._current_segment_id self.add_stage(boundary_egress) diff --git a/morpheus/pipeline/multi_message_stage.py b/morpheus/pipeline/multi_message_stage.py index 35f8170b17..2abb893be8 100644 --- a/morpheus/pipeline/multi_message_stage.py +++ b/morpheus/pipeline/multi_message_stage.py @@ -15,7 +15,7 @@ import logging import time -import srf +import mrc import morpheus.pipeline as _pipeline from morpheus.config import Config @@ -46,7 +46,7 @@ def __init__(self, c: Config): super().__init__(c) - def _post_build_single(self, builder: srf.Builder, out_pair: StreamPair) -> StreamPair: + def _post_build_single(self, builder: mrc.Builder, out_pair: StreamPair) -> StreamPair: # Check if we are debug and should log timestamps. Disable for C++ nodes if (self._config.debug and self._should_log_timestamps and not self._build_cpp_node()): diff --git a/morpheus/pipeline/pipeline.py b/morpheus/pipeline/pipeline.py index cc3de73204..67f7def50f 100644 --- a/morpheus/pipeline/pipeline.py +++ b/morpheus/pipeline/pipeline.py @@ -21,8 +21,8 @@ from collections import defaultdict from functools import partial +import mrc import networkx -import srf from tqdm import tqdm import cudf @@ -66,12 +66,12 @@ def __init__(self, c: Config): # Dictionary containing segment information for this pipeline self._segments: typing.Dict = defaultdict(lambda: {"nodes": set(), "ingress_ports": [], "egress_ports": []}) - self._exec_options = srf.Options() + self._exec_options = mrc.Options() self._exec_options.topology.user_cpuset = "0-{}".format(c.num_threads - 1) - self._exec_options.engine_factories.default_engine_type = srf.core.options.EngineType.Thread + self._exec_options.engine_factories.default_engine_type = mrc.core.options.EngineType.Thread # Set the default channel size - srf.Config.default_channel_size = c.edge_buffer_size + mrc.Config.default_channel_size = c.edge_buffer_size self.batch_size = c.pipeline_batch_size @@ -81,8 +81,8 @@ def __init__(self, c: Config): self._is_build_complete = False self._is_started = False - self._srf_executor: srf.Executor = None - self._srf_pipeline: srf.Pipeline = None + self._mrc_executor: mrc.Executor = None + self._mrc_pipeline: mrc.Pipeline = None @property def is_built(self) -> bool: @@ -172,11 +172,11 @@ def build(self): logger.info("====Registering Pipeline====") - self._srf_executor = srf.Executor(self._exec_options) + self._mrc_executor = mrc.Executor(self._exec_options) - self._srf_pipeline = srf.Pipeline() + self._mrc_pipeline = mrc.Pipeline() - def inner_build(builder: srf.Builder, segment_id: str): + def inner_build(builder: mrc.Builder, segment_id: str): segment_graph = self._segment_graphs[segment_id] # This should be a BFS search from each source nodes; but, since we don't have source stage loops @@ -209,7 +209,7 @@ def inner_build(builder: srf.Builder, segment_id: str): segment_egress_ports = self._segments[segment_id]["egress_ports"] segment_inner_build = partial(inner_build, segment_id=segment_id) - self._srf_pipeline.make_segment(segment_id, [port_info["port_pair"] for port_info in segment_ingress_ports], + self._mrc_pipeline.make_segment(segment_id, [port_info["port_pair"] for port_info in segment_ingress_ports], [port_info["port_pair"] for port_info in segment_egress_ports], segment_inner_build) logger.info("====Building Segment Complete!====") @@ -220,7 +220,7 @@ def inner_build(builder: srf.Builder, segment_id: str): # Finally call _on_start self._on_start() - self._srf_executor.register_pipeline(self._srf_pipeline) + self._mrc_executor.register_pipeline(self._mrc_pipeline) self._is_built = True @@ -231,7 +231,7 @@ def start(self): logger.info("====Starting Pipeline====") - self._srf_executor.start() + self._mrc_executor.start() logger.info("====Pipeline Started====") @@ -241,14 +241,14 @@ def stop(self): for s in list(self._sources) + list(self._stages): s.stop() - self._srf_executor.stop() + self._mrc_executor.stop() logger.info("====Pipeline Stopped====") async def join(self): try: - await self._srf_executor.join_async() + await self._mrc_executor.join_async() except Exception: logger.exception("Exception occurred in pipeline. Rethrowing") raise diff --git a/morpheus/pipeline/single_output_source.py b/morpheus/pipeline/single_output_source.py index 2ab33cc494..f93498151b 100644 --- a/morpheus/pipeline/single_output_source.py +++ b/morpheus/pipeline/single_output_source.py @@ -15,7 +15,7 @@ import logging import typing -import srf +import mrc import morpheus.pipeline as _pipeline from morpheus.config import Config @@ -40,11 +40,11 @@ def __init__(self, c: Config): self._create_ports(0, 1) - def _post_build_single(self, builder: srf.Builder, out_pair: StreamPair) -> StreamPair: + def _post_build_single(self, builder: mrc.Builder, out_pair: StreamPair) -> StreamPair: return out_pair @typing.final - def _post_build(self, builder: srf.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: + def _post_build(self, builder: mrc.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: ret_val = self._post_build_single(builder, out_ports_pair[0]) diff --git a/morpheus/pipeline/single_port_stage.py b/morpheus/pipeline/single_port_stage.py index 26c6af3841..02cf4d94e7 100644 --- a/morpheus/pipeline/single_port_stage.py +++ b/morpheus/pipeline/single_port_stage.py @@ -16,7 +16,7 @@ import typing from abc import abstractmethod -import srf +import mrc import typing_utils import morpheus.pipeline as _pipeline @@ -69,10 +69,10 @@ def _pre_build(self) -> typing.List[StreamPair]: return in_ports_pairs @abstractmethod - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: pass - def _build(self, builder: srf.Builder, in_ports_streams: typing.List[StreamPair]) -> typing.List[StreamPair]: + def _build(self, builder: mrc.Builder, in_ports_streams: typing.List[StreamPair]) -> typing.List[StreamPair]: # Derived source stages should override `_build_source` instead of this method. This allows for tracking the # True source object separate from the output stream. If any other operators need to be added after the source, # use `_post_build` @@ -83,11 +83,11 @@ def _build(self, builder: srf.Builder, in_ports_streams: typing.List[StreamPair] return [self._build_single(builder, in_ports_streams[0])] - def _post_build_single(self, builder: srf.Builder, out_pair: StreamPair) -> StreamPair: + def _post_build_single(self, builder: mrc.Builder, out_pair: StreamPair) -> StreamPair: return out_pair @typing.final - def _post_build(self, builder: srf.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: + def _post_build(self, builder: mrc.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: ret_val = self._post_build_single(builder, out_ports_pair[0]) diff --git a/morpheus/pipeline/source_stage.py b/morpheus/pipeline/source_stage.py index ee33f24e4f..725dc1054b 100644 --- a/morpheus/pipeline/source_stage.py +++ b/morpheus/pipeline/source_stage.py @@ -16,7 +16,7 @@ import typing from abc import abstractmethod -import srf +import mrc import morpheus.pipeline as _pipeline from morpheus.config import Config @@ -43,7 +43,7 @@ def __init__(self, c: Config): self._start_callbacks: typing.List[typing.Callable] = [] self._stop_callbacks: typing.List[typing.Callable] = [] - self._source_stream: srf.SegmentObject = None + self._source_stream: mrc.SegmentObject = None @property def input_count(self) -> int: @@ -59,7 +59,7 @@ def input_count(self) -> int: return None @abstractmethod - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: """ Abstract method all derived Source classes should implement. Returns the same value as `build`. @@ -69,13 +69,13 @@ def _build_source(self, builder: srf.Builder) -> StreamPair: ------- `morpheus.pipeline.pipeline.StreamPair`: - A tuple containing the output `srf.SegmentObject` object from this stage and the message data type. + A tuple containing the output `mrc.SegmentObject` object from this stage and the message data type. """ pass @typing.final - def _build(self, builder: srf.Builder, in_ports_streams: typing.List[StreamPair]) -> typing.List[StreamPair]: + def _build(self, builder: mrc.Builder, in_ports_streams: typing.List[StreamPair]) -> typing.List[StreamPair]: # Derived source stages should override `_build_source` instead of this method. This allows for tracking the # True source object separate from the output stream. If any other operators need to be added after the source, # use `_post_build` @@ -92,7 +92,7 @@ def _build(self, builder: srf.Builder, in_ports_streams: typing.List[StreamPair] return [source_pair] - def _post_build(self, builder: srf.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: + def _post_build(self, builder: mrc.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: return out_ports_pair diff --git a/morpheus/pipeline/stage.py b/morpheus/pipeline/stage.py index a6d4ca52df..0a83d2036b 100644 --- a/morpheus/pipeline/stage.py +++ b/morpheus/pipeline/stage.py @@ -15,7 +15,7 @@ import logging import typing -import srf +import mrc import morpheus.pipeline as _pipeline from morpheus.config import Config @@ -38,7 +38,7 @@ class Stage(_pipeline.StreamWrapper): def __init__(self, c: Config): super().__init__(c) - def _post_build(self, builder: srf.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: + def _post_build(self, builder: mrc.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: return out_ports_pair diff --git a/morpheus/pipeline/stream_pair.py b/morpheus/pipeline/stream_pair.py index 5704ce6f9f..ac2c4eed29 100644 --- a/morpheus/pipeline/stream_pair.py +++ b/morpheus/pipeline/stream_pair.py @@ -15,6 +15,6 @@ import typing -import srf +import mrc -StreamPair = typing.Tuple[srf.SegmentObject, typing.Type] +StreamPair = typing.Tuple[mrc.SegmentObject, typing.Type] diff --git a/morpheus/pipeline/stream_wrapper.py b/morpheus/pipeline/stream_wrapper.py index bc3df726a2..838740a509 100644 --- a/morpheus/pipeline/stream_wrapper.py +++ b/morpheus/pipeline/stream_wrapper.py @@ -21,7 +21,7 @@ from abc import ABC from abc import abstractmethod -import srf +import mrc import morpheus.pipeline as _pipeline from morpheus.config import Config @@ -68,7 +68,7 @@ def inner(self: "StreamWrapper", *args, **kwargs): class StreamWrapper(ABC, collections.abc.Hashable): """ - This abstract class serves as the morpheus pipeline's base class. This class wraps a `srf.SegmentObject` + This abstract class serves as the morpheus pipeline's base class. This class wraps a `mrc.SegmentObject` object and aids in hooking stages up together. Parameters @@ -304,13 +304,13 @@ def can_build(self, check_ports=False) -> bool: return True - def build(self, builder: srf.Builder, do_propagate=True): + def build(self, builder: mrc.Builder, do_propagate=True): """Build this stage. Parameters ---------- - builder : `srf.Builder` - SRF segment for this stage. + builder : `mrc.Builder` + MRC segment for this stage. do_propagate : bool, optional Whether to propagate to build output stages, by default True. @@ -351,33 +351,33 @@ def _pre_build(self) -> typing.List[StreamPair]: return in_pairs @abstractmethod - def _build(self, builder: srf.Builder, in_ports_streams: typing.List[StreamPair]) -> typing.List[StreamPair]: + def _build(self, builder: mrc.Builder, in_ports_streams: typing.List[StreamPair]) -> typing.List[StreamPair]: """ - This function is responsible for constructing this stage's internal `srf.SegmentObject` object. The input + This function is responsible for constructing this stage's internal `mrc.SegmentObject` object. The input of this function contains the returned value from the upstream stage. - The input values are the `srf.Builder` for this stage and a `StreamPair` tuple which contain the input - `srf.SegmentObject` object and the message data type. + The input values are the `mrc.Builder` for this stage and a `StreamPair` tuple which contain the input + `mrc.SegmentObject` object and the message data type. :meta public: Parameters ---------- - builder : `srf.Builder` - `srf.Builder` object for the pipeline. This should be used to construct/attach the internal - `srf.SegmentObject`. + builder : `mrc.Builder` + `mrc.Builder` object for the pipeline. This should be used to construct/attach the internal + `mrc.SegmentObject`. in_ports_streams : `morpheus.pipeline.pipeline.StreamPair` - List of tuples containing the input `srf.SegmentObject` object and the message data type. + List of tuples containing the input `mrc.SegmentObject` object and the message data type. Returns ------- `typing.List[morpheus.pipeline.pipeline.StreamPair]` - List of tuples containing the output `srf.SegmentObject` object from this stage and the message data type. + List of tuples containing the output `mrc.SegmentObject` object from this stage and the message data type. """ pass - def _post_build(self, builder: srf.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: + def _post_build(self, builder: mrc.Builder, out_ports_pair: typing.List[StreamPair]) -> typing.List[StreamPair]: return out_ports_pair def start(self): diff --git a/morpheus/stages/boundary/linear_boundary_stage.py b/morpheus/stages/boundary/linear_boundary_stage.py index 524b1a997b..e3fd5cd9c9 100644 --- a/morpheus/stages/boundary/linear_boundary_stage.py +++ b/morpheus/stages/boundary/linear_boundary_stage.py @@ -15,7 +15,7 @@ import logging import typing -import srf +import mrc from morpheus.config import Config from morpheus.pipeline.single_output_source import SingleOutputSource @@ -71,7 +71,7 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self): return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: boundary_egress = builder.get_egress(self._port_id) builder.make_edge(input_stream[0], boundary_egress) @@ -124,7 +124,7 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self): return False - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: boundary_ingress = builder.get_ingress(self._port_id) source = builder.make_node(self.unique_name, lambda data: data) builder.make_edge(boundary_ingress, source) diff --git a/morpheus/stages/general/buffer_stage.py b/morpheus/stages/general/buffer_stage.py index 87a87022bb..2c60ecff66 100644 --- a/morpheus/stages/general/buffer_stage.py +++ b/morpheus/stages/general/buffer_stage.py @@ -15,7 +15,7 @@ import logging import typing -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -65,7 +65,7 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self): return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: # This stage is no longer needed and is just a pass thru stage deprecated_stage_warning(logger, type(self), self.unique_name) diff --git a/morpheus/stages/general/delay_stage.py b/morpheus/stages/general/delay_stage.py index d5f927a38d..f5613bf4e5 100644 --- a/morpheus/stages/general/delay_stage.py +++ b/morpheus/stages/general/delay_stage.py @@ -15,7 +15,7 @@ import logging import typing -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -65,7 +65,7 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self): return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: # This stage is no longer needed and is just a pass thru stage deprecated_stage_warning(logger, type(self), self.unique_name) diff --git a/morpheus/stages/general/monitor_stage.py b/morpheus/stages/general/monitor_stage.py index 9918da9580..b5f09546aa 100644 --- a/morpheus/stages/general/monitor_stage.py +++ b/morpheus/stages/general/monitor_stage.py @@ -16,8 +16,8 @@ import typing from functools import reduce -import srf -from srf.core import operators as ops +import mrc +from mrc.core import operators as ops from tqdm import TMonitor from tqdm import TqdmSynchronisationWarning from tqdm import tqdm @@ -220,7 +220,7 @@ def _ensure_progress_bar(self): self._progress.reset() - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: def sink_on_completed(): # Set the name to complete. This refreshes the display @@ -235,7 +235,7 @@ def sink_on_completed(): MorpheusTqdm.monitor.exit() MorpheusTqdm.monitor = None - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self._progress_sink), ops.on_completed(sink_on_completed)).subscribe(sub) diff --git a/morpheus/stages/general/trigger_stage.py b/morpheus/stages/general/trigger_stage.py index fd615f653a..e7b9fcf754 100644 --- a/morpheus/stages/general/trigger_stage.py +++ b/morpheus/stages/general/trigger_stage.py @@ -15,8 +15,8 @@ import logging import typing -import srf -from srf.core import operators as ops +import mrc +from mrc.core import operators as ops from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -63,10 +63,10 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self): return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: # Store all messages until on_complete is called and then push them - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.to_list(), ops.flatten()).subscribe(sub) diff --git a/morpheus/stages/inference/inference_stage.py b/morpheus/stages/inference/inference_stage.py index 889836ce6c..254bca4746 100644 --- a/morpheus/stages/inference/inference_stage.py +++ b/morpheus/stages/inference/inference_stage.py @@ -18,8 +18,8 @@ from functools import reduce import cupy as cp -import srf -from srf.core import operators as ops +import mrc +from mrc.core import operators as ops from morpheus.config import Config from morpheus.messages import MultiInferenceMessage @@ -201,15 +201,15 @@ def _get_inference_worker(self, inf_queue: ProducerConsumerQueue) -> InferenceWo """ pass - def _get_cpp_inference_node(self, builder: srf.Builder) -> srf.SegmentObject: + def _get_cpp_inference_node(self, builder: mrc.Builder) -> mrc.SegmentObject: raise NotImplementedError("No C++ node is available for this inference type") - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] out_type = MultiResponseProbsMessage - def py_inference_fn(obs: srf.Observable, sub: srf.Subscriber): + def py_inference_fn(obs: mrc.Observable, sub: mrc.Subscriber): worker = self._get_inference_worker(self._inf_queue) @@ -231,9 +231,9 @@ def on_next(x: MultiInferenceMessage): for batch in batches: outstanding_requests += 1 - completion_future = srf.Future() + completion_future = mrc.Future() - def set_output_fut(resp: ResponseMemoryProbs, b, batch_future: srf.Future): + def set_output_fut(resp: ResponseMemoryProbs, b, batch_future: mrc.Future): nonlocal outstanding_requests m = self._convert_one_response(memory, b, resp) diff --git a/morpheus/stages/inference/triton_inference_stage.py b/morpheus/stages/inference/triton_inference_stage.py index 9c58261594..f360d1fd9e 100644 --- a/morpheus/stages/inference/triton_inference_stage.py +++ b/morpheus/stages/inference/triton_inference_stage.py @@ -24,8 +24,8 @@ from functools import partial import cupy as cp +import mrc import numpy as np -import srf import tritonclient.grpc as tritonclient from tritonclient.utils import InferenceServerException from tritonclient.utils import triton_to_np_dtype @@ -893,7 +893,7 @@ def _get_inference_worker(self, inf_queue: ProducerConsumerQueue) -> InferenceWo return worker_cls(inf_queue=inf_queue, c=self._config, **self._kwargs) - def _get_cpp_inference_node(self, builder: srf.Builder): + def _get_cpp_inference_node(self, builder: mrc.Builder): return _stages.InferenceClientStage(builder, name=self.unique_name, diff --git a/morpheus/stages/input/appshield_source_stage.py b/morpheus/stages/input/appshield_source_stage.py index 2675761412..ecf2d70a2d 100644 --- a/morpheus/stages/input/appshield_source_stage.py +++ b/morpheus/stages/input/appshield_source_stage.py @@ -20,9 +20,9 @@ from functools import partial from json.decoder import JSONDecodeError +import mrc import pandas as pd -import srf -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -349,7 +349,7 @@ def _build_metadata(x: typing.Dict[str, pd.DataFrame]): return metas - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: # The first source just produces filenames filename_source = self._watcher.build_node(self.unique_name, builder) @@ -359,11 +359,11 @@ def _build_source(self, builder: srf.Builder) -> StreamPair: # Supposed to just return a source here return filename_source, out_type - def _post_build_single(self, builder: srf.Builder, out_pair: StreamPair) -> StreamPair: + def _post_build_single(self, builder: mrc.Builder, out_pair: StreamPair) -> StreamPair: out_stream = out_pair[0] - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe( # At this point, we have batches of filenames to process. Make a node for processing batches of # filenames into batches of dataframes diff --git a/morpheus/stages/input/autoencoder_source_stage.py b/morpheus/stages/input/autoencoder_source_stage.py index 65c523b5d6..d7f7119d93 100644 --- a/morpheus/stages/input/autoencoder_source_stage.py +++ b/morpheus/stages/input/autoencoder_source_stage.py @@ -18,9 +18,9 @@ from abc import abstractmethod from functools import partial +import mrc import pandas as pd -import srf -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus._lib.file_types import FileTypes from morpheus.config import Config @@ -232,7 +232,7 @@ def _build_user_metadata(self, x: typing.Dict[str, pd.DataFrame]): return user_metas - def _build_source(self, seg: srf.Builder) -> StreamPair: + def _build_source(self, seg: mrc.Builder) -> StreamPair: # The first source just produces filenames filename_source = self._watcher.build_node(self.unique_name, seg) @@ -242,12 +242,12 @@ def _build_source(self, seg: srf.Builder) -> StreamPair: # Supposed to just return a source here return filename_source, out_type - def _post_build_single(self, seg: srf.Builder, out_pair: StreamPair) -> StreamPair: + def _post_build_single(self, seg: mrc.Builder, out_pair: StreamPair) -> StreamPair: out_stream = out_pair[0] out_type = out_pair[1] - def node_fn(input: srf.Observable, output: srf.Subscriber): + def node_fn(input: mrc.Observable, output: mrc.Subscriber): input.pipe( # At this point, we have batches of filenames to process. Make a node for processing batches of diff --git a/morpheus/stages/input/file_source_stage.py b/morpheus/stages/input/file_source_stage.py index a1be432d8a..7806435a46 100644 --- a/morpheus/stages/input/file_source_stage.py +++ b/morpheus/stages/input/file_source_stage.py @@ -16,9 +16,9 @@ import pathlib import typing -import srf +import mrc import typing_utils -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus._lib.file_types import FileTypes from morpheus.cli import register_stage @@ -103,7 +103,7 @@ def input_count(self) -> int: def supports_cpp_node(self): return True - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: if self._build_cpp_node(): import morpheus._lib.stages as _stages @@ -115,7 +115,7 @@ def _build_source(self, builder: srf.Builder) -> StreamPair: return out_stream, out_type - def _post_build_single(self, builder: srf.Builder, out_pair: StreamPair) -> StreamPair: + def _post_build_single(self, builder: mrc.Builder, out_pair: StreamPair) -> StreamPair: out_stream = out_pair[0] out_type = out_pair[1] @@ -123,7 +123,7 @@ def _post_build_single(self, builder: srf.Builder, out_pair: StreamPair) -> Stre # Convert our list of dataframes into the desired type. Flatten if necessary if (typing_utils.issubtype(out_type, typing.List)): - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.flatten()).subscribe(sub) diff --git a/morpheus/stages/input/kafka_source_stage.py b/morpheus/stages/input/kafka_source_stage.py index e2bf528415..27c8cd7cdd 100644 --- a/morpheus/stages/input/kafka_source_stage.py +++ b/morpheus/stages/input/kafka_source_stage.py @@ -18,8 +18,8 @@ from io import StringIO import confluent_kafka as ck +import mrc import pandas as pd -import srf import cudf @@ -216,7 +216,7 @@ def _source_generator(self): if (consumer): consumer.close() - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: if (self._build_cpp_node()): source = _stages.KafkaSourceStage(builder, diff --git a/morpheus/stages/output/write_to_file_stage.py b/morpheus/stages/output/write_to_file_stage.py index 06012fcb87..5863a1dcca 100644 --- a/morpheus/stages/output/write_to_file_stage.py +++ b/morpheus/stages/output/write_to_file_stage.py @@ -15,9 +15,9 @@ import os import typing +import mrc +import mrc.core.operators as ops import pandas as pd -import srf -import srf.core.operators as ops import cudf @@ -117,7 +117,7 @@ def _convert_to_strings(self, df: typing.Union[pd.DataFrame, cudf.DataFrame]): return output_strs - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] @@ -131,7 +131,7 @@ def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> Strea self._include_index_col) else: - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): # Ensure our directory exists os.makedirs(os.path.realpath(os.path.dirname(self._output_file)), exist_ok=True) diff --git a/morpheus/stages/output/write_to_kafka_stage.py b/morpheus/stages/output/write_to_kafka_stage.py index 09e6dcdeeb..8246348e9c 100644 --- a/morpheus/stages/output/write_to_kafka_stage.py +++ b/morpheus/stages/output/write_to_kafka_stage.py @@ -17,8 +17,8 @@ import typing import confluent_kafka as ck -import srf -from srf.core import operators as ops +import mrc +from mrc.core import operators as ops from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -76,12 +76,12 @@ def accepted_types(self) -> typing.Tuple: def supports_cpp_node(self): return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: # Convert the messages to rows of strings stream = input_stream[0] - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): producer = ck.Producer(self._kafka_conf) diff --git a/morpheus/stages/postprocess/add_classifications_stage.py b/morpheus/stages/postprocess/add_classifications_stage.py index 02d87af917..b2106fc69e 100644 --- a/morpheus/stages/postprocess/add_classifications_stage.py +++ b/morpheus/stages/postprocess/add_classifications_stage.py @@ -15,7 +15,7 @@ import logging import typing -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -105,7 +105,7 @@ def _add_labels(self, x: MultiResponseProbsMessage): # Return passthrough return x - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: # Convert the messages to rows of strings if self._build_cpp_node(): diff --git a/morpheus/stages/postprocess/add_scores_stage.py b/morpheus/stages/postprocess/add_scores_stage.py index 9eb49eade9..4b5f7079b6 100644 --- a/morpheus/stages/postprocess/add_scores_stage.py +++ b/morpheus/stages/postprocess/add_scores_stage.py @@ -15,7 +15,7 @@ import logging import typing -import srf +import mrc import morpheus._lib.stages as _stages from morpheus.cli.register_stage import register_stage @@ -103,7 +103,7 @@ def _add_labels(self, x: MultiResponseProbsMessage): # Return passthrough return x - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: # Convert the messages to rows of strings if self._build_cpp_node(): diff --git a/morpheus/stages/postprocess/filter_detections_stage.py b/morpheus/stages/postprocess/filter_detections_stage.py index 44f7216d82..80b66f27b7 100644 --- a/morpheus/stages/postprocess/filter_detections_stage.py +++ b/morpheus/stages/postprocess/filter_detections_stage.py @@ -16,8 +16,8 @@ import typing import cupy as cp -import srf -from srf.core import operators as ops +import mrc +from mrc.core import operators as ops import morpheus._lib.stages as _stages from morpheus.cli.register_stage import register_stage @@ -160,7 +160,7 @@ def filter_slice(self, x: MultiResponseProbsMessage) -> typing.List[MultiRespons return output_list - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: if self._build_cpp_node(): stream = _stages.FilterDetectionsStage(builder, self.unique_name, self._threshold, self._copy) else: @@ -168,7 +168,7 @@ def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> Strea stream = builder.make_node(self.unique_name, self.filter_copy) else: # Convert list back to individual MultiResponseProbsMessage - def flatten_fn(obs: srf.Observable, sub: srf.Subscriber): + def flatten_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(self.filter_slice), ops.flatten()).subscribe(sub) stream = builder.make_node_full(self.unique_name, flatten_fn) diff --git a/morpheus/stages/postprocess/generate_viz_frames_stage.py b/morpheus/stages/postprocess/generate_viz_frames_stage.py index ef7738b2dd..3405f89eac 100644 --- a/morpheus/stages/postprocess/generate_viz_frames_stage.py +++ b/morpheus/stages/postprocess/generate_viz_frames_stage.py @@ -19,11 +19,11 @@ import sys import typing +import mrc +import mrc.core.operators as ops import numpy as np import pandas as pd import pyarrow as pa -import srf -import srf.core.operators as ops import websockets.legacy.server from websockets.server import serve @@ -225,7 +225,7 @@ async def _stop_server(self): # Wait for it to await self._server_task - def _build_single(self, seg: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, seg: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] diff --git a/morpheus/stages/postprocess/ml_flow_drift_stage.py b/morpheus/stages/postprocess/ml_flow_drift_stage.py index 3f9beff3b3..16efbfa2b6 100644 --- a/morpheus/stages/postprocess/ml_flow_drift_stage.py +++ b/morpheus/stages/postprocess/ml_flow_drift_stage.py @@ -18,7 +18,7 @@ import cupy as cp import mlflow -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -151,7 +151,7 @@ def _calc_drift(self, x: MultiResponseProbsMessage): return x - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] diff --git a/morpheus/stages/postprocess/serialize_stage.py b/morpheus/stages/postprocess/serialize_stage.py index ebc763cf11..51f4d30310 100644 --- a/morpheus/stages/postprocess/serialize_stage.py +++ b/morpheus/stages/postprocess/serialize_stage.py @@ -17,7 +17,7 @@ import typing from functools import partial -import srf +import mrc import morpheus._lib.stages as _stages from morpheus.cli.register_stage import register_stage @@ -124,7 +124,7 @@ def convert_to_df(self, return MessageMeta(df=df) - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: if (self._build_cpp_node()): stream = _stages.SerializeStage(builder, self.unique_name, diff --git a/morpheus/stages/postprocess/timeseries_stage.py b/morpheus/stages/postprocess/timeseries_stage.py index d1648608fe..4748386974 100644 --- a/morpheus/stages/postprocess/timeseries_stage.py +++ b/morpheus/stages/postprocess/timeseries_stage.py @@ -21,9 +21,9 @@ from math import ceil import cupy as cp +import mrc import pandas as pd -import srf -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -460,12 +460,12 @@ def _call_timeseries_user(self, x: MultiResponseAEMessage): return self._timeseries_per_user[x.user_id]._calc_timeseries(x, False) - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] out_type = input_stream[1] - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): def on_next(x: MultiResponseAEMessage): diff --git a/morpheus/stages/postprocess/validation_stage.py b/morpheus/stages/postprocess/validation_stage.py index 0a12f511fa..598d61754e 100644 --- a/morpheus/stages/postprocess/validation_stage.py +++ b/morpheus/stages/postprocess/validation_stage.py @@ -18,9 +18,9 @@ import os import typing +import mrc import pandas as pd -import srf -from srf.core import operators as ops +from mrc.core import operators as ops import cudf @@ -148,10 +148,10 @@ def _do_comparison(self, messages: typing.List[MultiMessage]): with open(self._results_file_name, "w") as f: json.dump(results, f, indent=2, sort_keys=True) - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: # Store all messages until on_complete is called and then build the dataframe and compare - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): def do_compare(delayed_messages): diff --git a/morpheus/stages/preprocess/deserialize_stage.py b/morpheus/stages/preprocess/deserialize_stage.py index c8bb530d40..febf3dbc6c 100644 --- a/morpheus/stages/preprocess/deserialize_stage.py +++ b/morpheus/stages/preprocess/deserialize_stage.py @@ -17,8 +17,8 @@ import typing from functools import partial -import srf -from srf.core import operators as ops +import mrc +from mrc.core import operators as ops import morpheus._lib.stages as _stages from morpheus.cli.register_stage import register_stage @@ -96,12 +96,12 @@ def process_dataframe(x: MessageMeta, batch_size: int) -> typing.List[MultiMessa return output - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] out_type = MultiMessage - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.map(partial(DeserializeStage.process_dataframe, batch_size=self._batch_size)), ops.flatten()).subscribe(sub) diff --git a/morpheus/stages/preprocess/drop_null_stage.py b/morpheus/stages/preprocess/drop_null_stage.py index 21107f417e..31a6ae2f81 100644 --- a/morpheus/stages/preprocess/drop_null_stage.py +++ b/morpheus/stages/preprocess/drop_null_stage.py @@ -14,8 +14,8 @@ import typing -import srf -from srf.core import operators as ops +import mrc +from mrc.core import operators as ops from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -67,11 +67,11 @@ def supports_cpp_node(self): # Enable support by default return False - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] # Finally, flatten to a single stream - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): def on_next(x: MessageMeta): diff --git a/morpheus/stages/preprocess/preprocess_ae_stage.py b/morpheus/stages/preprocess/preprocess_ae_stage.py index 6a1d811036..611753e5e7 100644 --- a/morpheus/stages/preprocess/preprocess_ae_stage.py +++ b/morpheus/stages/preprocess/preprocess_ae_stage.py @@ -17,7 +17,7 @@ from functools import partial import cupy as cp -import srf +import mrc from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -125,5 +125,5 @@ def _get_preprocess_fn(self) -> typing.Callable[[MultiMessage], MultiInferenceMe fea_len=self._fea_length, feature_columns=self._feature_columns) - def _get_preprocess_node(self, builder: srf.Builder): + def _get_preprocess_node(self, builder: mrc.Builder): raise NotImplementedError("No C++ node for AE") diff --git a/morpheus/stages/preprocess/preprocess_base_stage.py b/morpheus/stages/preprocess/preprocess_base_stage.py index d5d280a31b..efb4d07a12 100644 --- a/morpheus/stages/preprocess/preprocess_base_stage.py +++ b/morpheus/stages/preprocess/preprocess_base_stage.py @@ -16,7 +16,7 @@ import typing from abc import abstractmethod -import srf +import mrc import typing_utils from morpheus.config import Config @@ -54,10 +54,10 @@ def _get_preprocess_fn(self) -> typing.Callable[[MultiMessage], MultiInferenceMe pass @abstractmethod - def _get_preprocess_node(self, builder: srf.Builder): + def _get_preprocess_node(self, builder: mrc.Builder): pass - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] out_type = MultiInferenceMessage diff --git a/morpheus/stages/preprocess/preprocess_fil_stage.py b/morpheus/stages/preprocess/preprocess_fil_stage.py index 6d2d24fe75..e78c0b59ca 100644 --- a/morpheus/stages/preprocess/preprocess_fil_stage.py +++ b/morpheus/stages/preprocess/preprocess_fil_stage.py @@ -17,9 +17,9 @@ from functools import partial import cupy as cp +import mrc import numpy as np import pandas as pd -import srf import cudf @@ -128,5 +128,5 @@ def pre_process_batch(x: MultiMessage, fea_len: int, fea_cols: typing.List[str]) def _get_preprocess_fn(self) -> typing.Callable[[MultiMessage], MultiInferenceMessage]: return partial(PreprocessFILStage.pre_process_batch, fea_len=self._fea_length, fea_cols=self.features) - def _get_preprocess_node(self, builder: srf.Builder): + def _get_preprocess_node(self, builder: mrc.Builder): return _stages.PreprocessFILStage(builder, self.unique_name, self.features) diff --git a/morpheus/stages/preprocess/preprocess_nlp_stage.py b/morpheus/stages/preprocess/preprocess_nlp_stage.py index e257e222d7..c9a3b38f3a 100644 --- a/morpheus/stages/preprocess/preprocess_nlp_stage.py +++ b/morpheus/stages/preprocess/preprocess_nlp_stage.py @@ -15,7 +15,7 @@ import typing from functools import partial -import srf +import mrc import cudf from cudf.core.subword_tokenizer import SubwordTokenizer @@ -185,7 +185,7 @@ def _get_preprocess_fn(self) -> typing.Callable[[MultiMessage], MultiInferenceMe add_special_tokens=self._add_special_tokens, column=self._column) - def _get_preprocess_node(self, builder: srf.Builder): + def _get_preprocess_node(self, builder: mrc.Builder): return _stages.PreprocessNLPStage(builder, self.unique_name, self._vocab_hash_file, diff --git a/morpheus/stages/preprocess/train_ae_stage.py b/morpheus/stages/preprocess/train_ae_stage.py index 55ba3f7fc5..4c33ae53b1 100644 --- a/morpheus/stages/preprocess/train_ae_stage.py +++ b/morpheus/stages/preprocess/train_ae_stage.py @@ -19,12 +19,12 @@ import typing import dill +import mrc import numpy as np import pandas as pd -import srf import torch from dfencoder import AutoEncoder -from srf.core import operators as ops +from mrc.core import operators as ops from morpheus.cli.register_stage import register_stage from morpheus.config import Config @@ -247,7 +247,7 @@ def _train_model(self, x: UserMessageMeta) -> typing.List[MultiAEMessage]: return self._user_models[x.user_id].train(x.df) - def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> StreamPair: + def _build_single(self, builder: mrc.Builder, input_stream: StreamPair) -> StreamPair: stream = input_stream[0] get_model_fn = None @@ -315,7 +315,7 @@ def _build_single(self, builder: srf.Builder, input_stream: StreamPair) -> Strea else: get_model_fn = self._train_model - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): def on_next(x: UserMessageMeta): diff --git a/morpheus/utils/directory_watcher.py b/morpheus/utils/directory_watcher.py index 296ecd31f0..0f43394828 100644 --- a/morpheus/utils/directory_watcher.py +++ b/morpheus/utils/directory_watcher.py @@ -17,7 +17,7 @@ import os import queue -import srf +import mrc from watchdog.events import FileSystemEvent from watchdog.events import PatternMatchingEventHandler from watchdog.observers import Observer @@ -90,7 +90,7 @@ def __init__(self, # Will be a watchdog observer if enabled self._watcher = None - def build_node(self, name: str, builder: srf.Builder): + def build_node(self, name: str, builder: mrc.Builder): # The first source just produces filenames return builder.make_source(name, self._generate_via_polling()) diff --git a/morpheus/utils/logger.py b/morpheus/utils/logger.py index 13278fdfbd..048a4f943c 100644 --- a/morpheus/utils/logger.py +++ b/morpheus/utils/logger.py @@ -21,7 +21,7 @@ import appdirs import click -import srf +import mrc from tqdm import tqdm @@ -164,8 +164,8 @@ def configure_logging(log_level: int, log_config_file: str = None): `__). Defaults to None. """ - # Start by initializing SRF logging - srf.logging.init_logging("morpheus") + # Start by initializing MRC logging + mrc.logging.init_logging("morpheus") if (log_config_file is not None): # Configure using log file @@ -176,7 +176,7 @@ def configure_logging(log_level: int, log_config_file: str = None): def set_log_level(log_level: int): """ - Set the Morpheus logging level. Also propagates the value to SRF's logging system to keep the logging levels in sync + Set the Morpheus logging level. Also propagates the value to MRC's logging system to keep the logging levels in sync Parameters ---------- @@ -191,10 +191,10 @@ def set_log_level(log_level: int): """ # Get the old level and return it in case the user wants that - old_level = srf.logging.get_level() + old_level = mrc.logging.get_level() - # Set the SRF logging level to match - srf.logging.set_level(log_level) + # Set the MRC logging level to match + mrc.logging.set_level(log_level) # Get the root Morpheus logger morpheus_logger = logging.getLogger("morpheus") diff --git a/tests/benchmarks/static_message_source.py b/tests/benchmarks/static_message_source.py index 2f4c1f0596..4a01e5cc31 100644 --- a/tests/benchmarks/static_message_source.py +++ b/tests/benchmarks/static_message_source.py @@ -15,8 +15,8 @@ import typing -import srf -import srf.core.operators as ops +import mrc +import mrc.core.operators as ops import typing_utils import cudf @@ -46,11 +46,11 @@ def supports_cpp_node(self): def input_count(self) -> int: return len(self._df) - def _build_source(self, builder: srf.Builder) -> StreamPair: + def _build_source(self, builder: mrc.Builder) -> StreamPair: out_stream = builder.make_source(self.unique_name, self._generate_frames()) return out_stream, MessageMeta - def _post_build_single(self, builder: srf.Builder, out_pair: StreamPair) -> StreamPair: + def _post_build_single(self, builder: mrc.Builder, out_pair: StreamPair) -> StreamPair: out_stream = out_pair[0] out_type = out_pair[1] @@ -58,7 +58,7 @@ def _post_build_single(self, builder: srf.Builder, out_pair: StreamPair) -> Stre # Convert our list of dataframes into the desired type. Flatten if necessary if (typing_utils.issubtype(out_type, typing.List)): - def node_fn(obs: srf.Observable, sub: srf.Subscriber): + def node_fn(obs: mrc.Observable, sub: mrc.Subscriber): obs.pipe(ops.flatten()).subscribe(sub) diff --git a/tests/test_inference_stage.py b/tests/test_inference_stage.py index 412d77077d..942a424b7e 100755 --- a/tests/test_inference_stage.py +++ b/tests/test_inference_stage.py @@ -107,7 +107,7 @@ def test_py_inf_fn(config): @pytest.mark.use_python -@mock.patch('srf.Future') +@mock.patch('mrc.Future') @mock.patch('morpheus.stages.inference.inference_stage.ops') def test_py_inf_fn_on_next(mock_ops, mock_future, config): mock_future.return_value = mock_future diff --git a/tests/test_kafka_source_stage_pipe.py b/tests/test_kafka_source_stage_pipe.py index db7310e1b0..dd6375cc07 100644 --- a/tests/test_kafka_source_stage_pipe.py +++ b/tests/test_kafka_source_stage_pipe.py @@ -18,9 +18,9 @@ import os import typing +import mrc import numpy as np import pytest -import srf from morpheus._lib.file_types import FileTypes from morpheus.config import Config @@ -130,7 +130,7 @@ def _offset_checker(self, x): return x - def _build_single(self, builder: srf.Builder, input_stream): + def _build_single(self, builder: mrc.Builder, input_stream): node = builder.make_node(self.unique_name, self._offset_checker) builder.make_edge(input_stream[0], node) diff --git a/tests/utils.py b/tests/utils.py index 163ce23a8f..06d833fe40 100755 --- a/tests/utils.py +++ b/tests/utils.py @@ -20,8 +20,8 @@ import typing import cupy as cp +import mrc import pandas as pd -import srf import morpheus from morpheus._lib.file_types import FileTypes @@ -94,7 +94,7 @@ def _conv_message(self, m): memory = ResponseMemoryProbs(count=len(probs), probs=probs) return MultiResponseProbsMessage(m.meta, m.mess_offset, len(probs), memory, 0, len(probs)) - def _build_single(self, builder: srf.Builder, input_stream): + def _build_single(self, builder: mrc.Builder, input_stream): stream = builder.make_node(self.unique_name, self._conv_message) builder.make_edge(input_stream[0], stream)