提交 98dfb492 编写于 作者: M minqiyang

Release GIL lock

上级 42e96a02
...@@ -9,4 +9,4 @@ add_subdirectory(pybind) ...@@ -9,4 +9,4 @@ add_subdirectory(pybind)
# NOTE: please add subdirectory inference at last. # NOTE: please add subdirectory inference at last.
add_subdirectory(inference) add_subdirectory(inference)
add_subdirectory(train) #add_subdirectory(train)
...@@ -25,13 +25,13 @@ if (WIN32) ...@@ -25,13 +25,13 @@ if (WIN32)
list(APPEND fluid_third_partys gflags glog protobuf cblas) list(APPEND fluid_third_partys gflags glog protobuf cblas)
endif(WIN32) endif(WIN32)
# paddle_fluid_origin exclude inference api interface # # paddle_fluid_origin exclude inference api interface
if(WIN32) # if(WIN32)
sep_library(paddle_fluid_origin DEPS ${fluid_modules} paddle_fluid_api) # sep_library(paddle_fluid_origin DEPS ${fluid_modules} paddle_fluid_api)
else(WIN32) # else(WIN32)
#set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> --target elf64-x86-64 cr paddle_fluid_origin ${fluid_modules} paddle_fluid_api") # set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> --target elf64-x86-64 cr paddle_fluid_origin ${fluid_modules} paddle_fluid_api")
cc_library(paddle_fluid_origin DEPS ${fluid_modules} paddle_fluid_api) # cc_library(paddle_fluid_origin DEPS ${fluid_modules} paddle_fluid_api)
endif(WIN32) # endif(WIN32)
add_subdirectory(api) add_subdirectory(api)
...@@ -41,19 +41,19 @@ set(SHARED_INFERENCE_SRCS ...@@ -41,19 +41,19 @@ set(SHARED_INFERENCE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/api/analysis_predictor.cc ${CMAKE_CURRENT_SOURCE_DIR}/api/analysis_predictor.cc
${CMAKE_CURRENT_SOURCE_DIR}/api/details/zero_copy_tensor.cc) ${CMAKE_CURRENT_SOURCE_DIR}/api/details/zero_copy_tensor.cc)
if(WIN32) # if(WIN32)
sep_library(paddle_fluid DEPS ${fluid_modules} ${STATIC_INFERENCE_APIS} zero_copy_tensor reset_tensor_array # sep_library(paddle_fluid DEPS ${fluid_modules} ${STATIC_INFERENCE_APIS} zero_copy_tensor reset_tensor_array
analysis_config paddle_pass_builder) # analysis_config paddle_pass_builder)
else(WIN32) # else(WIN32)
cc_library(paddle_fluid DEPS ${fluid_modules} ${STATIC_INFERENCE_APIS} # cc_library(paddle_fluid DEPS ${fluid_modules} ${STATIC_INFERENCE_APIS}
zero_copy_tensor reset_tensor_array analysis_config paddle_pass_builder) # zero_copy_tensor reset_tensor_array analysis_config paddle_pass_builder)
endif(WIN32) # endif(WIN32)
if(NOT APPLE) # if(NOT APPLE)
# TODO(liuyiqu: Temporarily disable the link flag because it is not support on Mac. # # TODO(liuyiqu: Temporarily disable the link flag because it is not support on Mac.
set(LINK_FLAGS "-Wl,--retain-symbols-file ${CMAKE_CURRENT_SOURCE_DIR}/paddle_fluid.sym") # set(LINK_FLAGS "-Wl,--retain-symbols-file ${CMAKE_CURRENT_SOURCE_DIR}/paddle_fluid.sym")
set_target_properties(paddle_fluid PROPERTIES LINK_FLAGS "${LINK_FLAGS}") # set_target_properties(paddle_fluid PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
endif() # endif()
# Create shared library # Create shared library
if(WIN32) if(WIN32)
...@@ -87,10 +87,10 @@ if(NOT APPLE AND NOT WIN32) ...@@ -87,10 +87,10 @@ if(NOT APPLE AND NOT WIN32)
add_custom_target(check_symbol ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/.check_symbol") add_custom_target(check_symbol ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/.check_symbol")
endif() endif()
if(WITH_TESTING) # if(WITH_TESTING)
# tests/book depends the models that generated by python/paddle/fluid/tests/book # # tests/book depends the models that generated by python/paddle/fluid/tests/book
add_subdirectory(tests/book) # add_subdirectory(tests/book)
if(WITH_INFERENCE_API_TEST) # if(WITH_INFERENCE_API_TEST)
add_subdirectory(tests/api) # add_subdirectory(tests/api)
endif() # endif()
endif() # endif()
...@@ -42,6 +42,7 @@ void BindTracer(pybind11::module* m) { ...@@ -42,6 +42,7 @@ void BindTracer(pybind11::module* m) {
framework::AttributeMap attrs_map, framework::AttributeMap attrs_map,
const platform::CPUPlace expected_place, const platform::CPUPlace expected_place,
const bool stop_gradient = false) { const bool stop_gradient = false) {
pybind11::gil_scoped_release release;
return self.Trace(op, inputs, outputs, attrs_map, expected_place, return self.Trace(op, inputs, outputs, attrs_map, expected_place,
stop_gradient); stop_gradient);
}) })
...@@ -52,6 +53,7 @@ void BindTracer(pybind11::module* m) { ...@@ -52,6 +53,7 @@ void BindTracer(pybind11::module* m) {
framework::AttributeMap attrs_map, framework::AttributeMap attrs_map,
const platform::CUDAPlace expected_place, const platform::CUDAPlace expected_place,
const bool stop_gradient = false) { const bool stop_gradient = false) {
pybind11::gil_scoped_release release;
return self.Trace(op, inputs, outputs, attrs_map, expected_place, return self.Trace(op, inputs, outputs, attrs_map, expected_place,
stop_gradient); stop_gradient);
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册