From 04930adce51472f4800fe14ae24bf61a9fda6d87 Mon Sep 17 00:00:00 2001 From: Sahan Paliskara Date: Thu, 2 Feb 2023 14:41:39 -0800 Subject: [PATCH] create flag to indicate a program is inside a deploy interpreter [ghstack-poisoned] --- multipy/runtime/interpreter/CMakeLists.txt | 4 ++-- multipy/runtime/interpreter/interpreter_impl.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/multipy/runtime/interpreter/CMakeLists.txt b/multipy/runtime/interpreter/CMakeLists.txt index 1a133e74..744edac7 100644 --- a/multipy/runtime/interpreter/CMakeLists.txt +++ b/multipy/runtime/interpreter/CMakeLists.txt @@ -101,9 +101,9 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") endif() target_include_directories(torch_deployinterpreter PRIVATE ${INTERPRETER_DIR}) -target_include_directories(torch_deployinterpreter BEFORE PUBLIC ${Python3_INCLUDE_DIRS}) +target_include_directories(torch_deployinterpreter BEFORE PUBLIC "-Wl,--no-as-needed -rdynamic" ${Python3_INCLUDE_DIRS}) target_link_libraries(torch_deployinterpreter PRIVATE fmt::fmt-header-only) target_link_libraries(torch_deployinterpreter PRIVATE gtest) -target_link_libraries(torch_deployinterpreter PRIVATE torch_python) +target_link_libraries(torch_deployinterpreter PRIVATE "-Wl,--no-as-needed -rdynamic -Wno-undef" torch_python) target_link_libraries(torch_deployinterpreter PRIVATE multipy_torch) diff --git a/multipy/runtime/interpreter/interpreter_impl.cpp b/multipy/runtime/interpreter/interpreter_impl.cpp index 76e7ace0..77e9f643 100644 --- a/multipy/runtime/interpreter/interpreter_impl.cpp +++ b/multipy/runtime/interpreter/interpreter_impl.cpp @@ -179,6 +179,7 @@ except ModuleNotFoundError: _v.git_version = 'fake' _v.hip = None +sys.using_multipy_interpreter = True if torch.cuda.is_available(): torch.zeros(1).cuda() # force cuda init...