!41751 adapt dllexport for windows
Merge pull request !41751 from chenminmin/master
This commit is contained in:
commit
aa948233b8
|
@ -18,8 +18,12 @@
|
|||
|
||||
#ifndef MS_API
|
||||
#ifdef _WIN32
|
||||
#ifdef BUILDING_DLL
|
||||
#define MS_API __declspec(dllexport)
|
||||
#else
|
||||
#define MS_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define MS_API __attribute__((visibility("default")))
|
||||
#endif // _WIN32
|
||||
#endif
|
||||
|
|
|
@ -324,6 +324,10 @@ set(SUB_COMP
|
|||
pybind_api
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
add_compile_definitions(BUILDING_ME_DLL)
|
||||
endif()
|
||||
|
||||
foreach(_comp ${SUB_COMP})
|
||||
add_subdirectory(${_comp})
|
||||
string(REPLACE "/" "_" sub ${_comp})
|
||||
|
|
|
@ -12,6 +12,12 @@ if(MODE_ASCEND_ACL)
|
|||
string(STRIP "${PY3_LIBG}" PY3_LIBG)
|
||||
message("Python3 general library = " ${PY3_LIBG})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# define this for msvc:dllexport or dllimport
|
||||
add_compile_definitions(BUILDING_DLL)
|
||||
endif()
|
||||
|
||||
# build mindspore_shared_lib
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mindspore/ccsrc)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset)
|
||||
|
|
|
@ -30,4 +30,15 @@
|
|||
#define COMMON_EXPORT __attribute__((visibility("default")))
|
||||
#define COMMON_LOCAL __attribute__((visibility("hidden")))
|
||||
#endif
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
|
||||
#ifdef BUILDING_ME_DLL
|
||||
#define ME_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define ME_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define ME_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_VISIBLE_H_
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <utility>
|
||||
#include <string>
|
||||
#include "pipeline/jit/resource.h"
|
||||
#include "include/api/visible.h"
|
||||
#include "include/common/visible.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace opt {
|
||||
|
@ -51,7 +51,7 @@ bool MetaUnpackPreparePass(const ResourcePtr &resource);
|
|||
void ReclaimOptimizer();
|
||||
bool PynativeOptPass(const ResourcePtr &resource);
|
||||
bool EliminateAdRelatedSpecialOpOptPass(const ResourcePtr &resource);
|
||||
bool MS_API AutoMonadElimOptPass(const FuncGraphPtr &func_graph);
|
||||
bool ME_EXPORT AutoMonadElimOptPass(const FuncGraphPtr &func_graph);
|
||||
FuncGraphPtr PrimBpOptPassStep1(const opt::irpass::OptimizeIRPassLib &irpass, const ResourcePtr &resource);
|
||||
FuncGraphPtr PrimBpOptPassStep2(const opt::irpass::OptimizeIRPassLib &irpass, const ResourcePtr &resource,
|
||||
const std::vector<bool> &need_grad_flags);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "backend/graph_compiler/transform.h"
|
||||
#include "pipeline/jit/base.h"
|
||||
#include "frontend/parallel/strategy.h"
|
||||
#include "include/api/visible.h"
|
||||
#include "include/common/visible.h"
|
||||
|
||||
namespace mindspore {
|
||||
// namespace to support pipeline structures definition
|
||||
|
@ -179,7 +179,7 @@ uint32_t GetHcclRankId();
|
|||
uint32_t GetHcclRankSize();
|
||||
void InitPipeline();
|
||||
void FinalizeBackend();
|
||||
void MS_API ClearResAtexit();
|
||||
void ME_EXPORT ClearResAtexit();
|
||||
void CloseTsd(bool force = false);
|
||||
void MemoryRecycle();
|
||||
|
||||
|
@ -187,9 +187,9 @@ FuncGraphPtr LoadMindIR(const std::string &file_name, const char *dec_key, const
|
|||
const std::string &dec_mode, const py::object decrypt = py::none());
|
||||
|
||||
// init and exec dataset sub graph
|
||||
bool MS_API InitExecDataset(const std::string &queue_name, int64_t iter_num, int64_t batch_size,
|
||||
const std::vector<TypePtr> &types, const std::vector<std::vector<int64_t>> &shapes,
|
||||
const std::vector<int64_t> &input_indexes, const std::string &phase, bool need_run);
|
||||
bool ME_EXPORT InitExecDataset(const std::string &queue_name, int64_t iter_num, int64_t batch_size,
|
||||
const std::vector<TypePtr> &types, const std::vector<std::vector<int64_t>> &shapes,
|
||||
const std::vector<int64_t> &input_indexes, const std::string &phase, bool need_run);
|
||||
|
||||
// Build and run dataset subgraph for ms backend
|
||||
bool InitExecDatasetVm(const std::string &queue_name, int64_t size, int64_t batch_size,
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
#include "ir/anf.h"
|
||||
#include "ir/func_graph.h"
|
||||
#include "include/api/visible.h"
|
||||
#include "include/common/visible.h"
|
||||
|
||||
namespace mindspore::pipeline {
|
||||
|
||||
// Run auto-monad, handle side-effects, called from frontend pipeline.
|
||||
bool MS_API AutoMonad(const FuncGraphPtr &func_graph);
|
||||
bool ME_EXPORT AutoMonad(const FuncGraphPtr &func_graph);
|
||||
|
||||
// Run auto-monad after grad or Renormalize, handle side-effects, called from frontend opt pass.
|
||||
bool ReAutoMonad(const FuncGraphPtr &func_graph);
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
#define MINDSPORE_CCSRC_PIPELINE_JIT_ORDER_ENFORCE_H_
|
||||
|
||||
#include "ir/func_graph.h"
|
||||
#include "include/common/visible.h"
|
||||
|
||||
namespace mindspore::pipeline {
|
||||
// Enforce order of execution of the given graph.
|
||||
void OrderEnforce(const FuncGraphPtr &func_graph);
|
||||
void ME_EXPORT OrderEnforce(const FuncGraphPtr &func_graph);
|
||||
} // namespace mindspore::pipeline
|
||||
|
||||
#endif // MINDSPORE_CCSRC_PIPELINE_JIT_ORDER_ENFORCE_H_
|
||||
|
|
|
@ -62,7 +62,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|||
if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes -DHAVE_SNPRINTF")
|
||||
endif()
|
||||
add_compile_definitions(BUILDING_DLL)
|
||||
add_compile_definitions(BUILDING_CORE_DLL)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
|
||||
-Wno-overloaded-virtual -Wno-user-defined-warnings -Winconsistent-missing-override -Wno-delete-non-virtual-dtor \
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define MINDSPORE_CORE_MINDAPI_BASE_MACROS_H_
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
|
||||
#ifdef BUILDING_DLL
|
||||
#ifdef BUILDING_CORE_DLL
|
||||
#define MIND_API __declspec(dllexport)
|
||||
#else
|
||||
#define MIND_API __declspec(dllimport)
|
||||
|
|
|
@ -12,7 +12,7 @@ file(GLOB MINDRT_SRC
|
|||
)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
add_compile_definitions(BUILDING_DLL)
|
||||
add_compile_definitions(BUILDING_CORE_DLL)
|
||||
endif()
|
||||
|
||||
add_library(mindrt_mid OBJECT ${MINDRT_SRC})
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define MINDSPORE_CORE_UTILS_MACORS_H_
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
|
||||
#ifdef BUILDING_DLL
|
||||
#ifdef BUILDING_CORE_DLL
|
||||
#define MS_CORE_API __declspec(dllexport)
|
||||
#define MS_EXPORT __declspec(dllexport)
|
||||
#define GVAR_DEF(type, name, value) MS_CORE_API inline const type name = value;
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BUILDING_DLL
|
||||
#define BUILDING_DLL
|
||||
#endif
|
||||
|
||||
#include "include/api/status.h"
|
||||
#ifndef ENABLE_ANDROID
|
||||
#include <thread>
|
||||
|
|
|
@ -700,6 +700,7 @@ endif()
|
|||
|
||||
if(WIN32)
|
||||
add_compile_definitions(BUILDING_DLL)
|
||||
add_compile_definitions(BUILDING_CORE_DLL)
|
||||
endif()
|
||||
|
||||
include_directories(${CORE_DIR}/mindrt/include)
|
||||
|
|
Loading…
Reference in New Issue