From 59c5fedc36d7e3dc5538fb385d1201a0aa184df6 Mon Sep 17 00:00:00 2001 From: wwbitejotunn Date: Thu, 9 Feb 2023 12:53:08 +0000 Subject: [PATCH] set stream by raw size_t --- fastdeploy/runtime/option_pybind.cc | 1 + fastdeploy/runtime/runtime_option.cc | 4 ++++ fastdeploy/runtime/runtime_option.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/fastdeploy/runtime/option_pybind.cc b/fastdeploy/runtime/option_pybind.cc index 1c786459b..d5a6187c8 100644 --- a/fastdeploy/runtime/option_pybind.cc +++ b/fastdeploy/runtime/option_pybind.cc @@ -48,6 +48,7 @@ void BindOption(pybind11::module& m) { .def_readwrite("poros_option", &RuntimeOption::poros_option) .def_readwrite("paddle_infer_option", &RuntimeOption::paddle_infer_option) .def("set_external_stream", &RuntimeOption::SetExternalStream) + .def("set_external_raw_stream", &RuntimeOption::SetExternalRawStream) .def("set_cpu_thread_num", &RuntimeOption::SetCpuThreadNum) .def("use_paddle_backend", &RuntimeOption::UsePaddleBackend) .def("use_poros_backend", &RuntimeOption::UsePorosBackend) diff --git a/fastdeploy/runtime/runtime_option.cc b/fastdeploy/runtime/runtime_option.cc index 7538f3ea6..97b7acea7 100644 --- a/fastdeploy/runtime/runtime_option.cc +++ b/fastdeploy/runtime/runtime_option.cc @@ -93,6 +93,10 @@ void RuntimeOption::SetExternalStream(void* external_stream) { external_stream_ = external_stream; } +void RuntimeOption::SetExternalRawStream(size_t external_stream) { + external_stream_ = (void*) external_stream; +} + void RuntimeOption::SetCpuThreadNum(int thread_num) { FDASSERT(thread_num > 0, "The thread_num must be greater than 0."); cpu_thread_num = thread_num; diff --git a/fastdeploy/runtime/runtime_option.h b/fastdeploy/runtime/runtime_option.h index ecb51fe2a..6f21a2860 100644 --- a/fastdeploy/runtime/runtime_option.h +++ b/fastdeploy/runtime/runtime_option.h @@ -111,6 +111,8 @@ struct FASTDEPLOY_DECL RuntimeOption { void SetExternalStream(void* external_stream); + void SetExternalRawStream(size_t external_stream); + /* * @brief Set number of cpu threads while inference on CPU, by default it will decided by the different backends */