set stream by raw size_t

This commit is contained in:
wwbitejotunn
2023-02-09 12:53:08 +00:00
parent 4b293a89de
commit 59c5fedc36
3 changed files with 7 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ void BindOption(pybind11::module& m) {
.def_readwrite("poros_option", &RuntimeOption::poros_option) .def_readwrite("poros_option", &RuntimeOption::poros_option)
.def_readwrite("paddle_infer_option", &RuntimeOption::paddle_infer_option) .def_readwrite("paddle_infer_option", &RuntimeOption::paddle_infer_option)
.def("set_external_stream", &RuntimeOption::SetExternalStream) .def("set_external_stream", &RuntimeOption::SetExternalStream)
.def("set_external_raw_stream", &RuntimeOption::SetExternalRawStream)
.def("set_cpu_thread_num", &RuntimeOption::SetCpuThreadNum) .def("set_cpu_thread_num", &RuntimeOption::SetCpuThreadNum)
.def("use_paddle_backend", &RuntimeOption::UsePaddleBackend) .def("use_paddle_backend", &RuntimeOption::UsePaddleBackend)
.def("use_poros_backend", &RuntimeOption::UsePorosBackend) .def("use_poros_backend", &RuntimeOption::UsePorosBackend)

View File

@@ -93,6 +93,10 @@ void RuntimeOption::SetExternalStream(void* external_stream) {
external_stream_ = external_stream; external_stream_ = external_stream;
} }
void RuntimeOption::SetExternalRawStream(size_t external_stream) {
external_stream_ = (void*) external_stream;
}
void RuntimeOption::SetCpuThreadNum(int thread_num) { void RuntimeOption::SetCpuThreadNum(int thread_num) {
FDASSERT(thread_num > 0, "The thread_num must be greater than 0."); FDASSERT(thread_num > 0, "The thread_num must be greater than 0.");
cpu_thread_num = thread_num; cpu_thread_num = thread_num;

View File

@@ -111,6 +111,8 @@ struct FASTDEPLOY_DECL RuntimeOption {
void SetExternalStream(void* external_stream); 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 * @brief Set number of cpu threads while inference on CPU, by default it will decided by the different backends
*/ */