adapt code for msvc 0914

This commit is contained in:
taipingchangan 2022-09-14 15:14:16 +08:00
parent f0fedb370f
commit 05dad30561
10 changed files with 31 additions and 8 deletions

View File

@ -49,6 +49,7 @@ set(INSTALL_PY_DIR ".")
set(INSTALL_BASE_DIR ".")
set(INSTALL_BIN_DIR "bin")
set(INSTALL_CFG_DIR "config")
set(INSTALL_PLUGIN_DIR "${INSTALL_LIB_DIR}/plugin")
set(INSTALL_LIB_DIR ".")
set(onednn_LIBPATH ${onednn_LIBPATH}/../bin/)
@ -188,6 +189,11 @@ if(ENABLE_GPU)
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
install(
TARGETS mindspore_gpu
DESTINATION ${INSTALL_PLUGIN_DIR}
COMPONENT mindspore
)
endif()
get_filename_component(CXX_DIR ${CMAKE_CXX_COMPILER} PATH)

View File

@ -110,7 +110,7 @@ class BACKEND_EXPORT E2eDump {
static void DumpSingleParameterNode(const AnfNodePtr &anf_node, const std::string &dump_path, bool trans_flag,
const Debugger *debugger);
BACKEND_EXPORT inline static unsigned int starting_graph_id = INT32_MAX;
inline static unsigned int starting_graph_id = INT32_MAX;
};
} // namespace mindspore
#endif // MINDSPORE_MINDSPORE_CCSRC_DEBUG_DATA_DUMP_E_2_E_DUMP_UTIL_H_

View File

@ -28,4 +28,14 @@
#define BACKEND_EXPORT __attribute__((visibility("default")))
#define BACKEND_LOCAL __attribute__((visibility("hidden")))
#endif
#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
#ifdef BUILDING_GPU_DLL
#define GPU_EXPORT __declspec(dllexport)
#else
#define GPU_EXPORT __declspec(dllimport)
#endif
#else
#define GPU_EXPORT __attribute__((visibility("default")))
#endif
#endif // MINDSPORE_CCSRC_INCLUDE_BACKEND_VISIBLE_H_

View File

@ -42,7 +42,9 @@
#include "backend/common/pass/insert_tensor_move_for_ref.h"
#include "common/graph_kernel/adapter/graph_kernel_optimization.h"
#include "common/graph_kernel/adapter/expander.h"
#ifdef ENABLE_AKG
#include "common/graph_kernel/value_graph_binder.h"
#endif
#include "backend/common/session/anf_runtime_algorithm.h"
#include "include/common/utils/anfalgo.h"
#include "plugin/device/cpu/hal/profiler/cpu_profiling.h"

View File

@ -20,13 +20,16 @@ if(ENABLE_GPU)
list(APPEND GPU_SUB_OBJECTS_SRC $<TARGET_OBJECTS:_mindspore_plugin_device_gpu_${sub}_obj>)
add_dependencies(_mindspore_plugin_device_gpu_${sub}_obj proto_input)
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
target_compile_definitions(_mindspore_plugin_device_gpu_${sub}_obj PRIVATE BACKEND_DLL)
target_compile_definitions(_mindspore_plugin_device_gpu_${sub}_obj PRIVATE BUILDING_GPU_DLL)
endif()
endif()
endforeach()
endif()
add_library(mindspore_gpu SHARED ${GPU_SUB_OBJECTS_SRC})
if(MSVC)
target_link_options(mindspore_gpu PRIVATE /FORCE:UNRESOLVED)
endif()
target_link_libraries(mindspore_gpu PRIVATE mindspore_core mindspore_common proto_input mindspore::protobuf)
target_link_libraries(mindspore_gpu PRIVATE securec)
set_target_properties(mindspore_gpu PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})

View File

@ -35,7 +35,7 @@ using GetRankIDByGroupFunc = int (*)(const std::string &);
using GetGroupSizeFunc = int (*)(const std::string &);
using DestroyGroupFunc = bool (*)(const std::string &);
class BACKEND_EXPORT CollectiveInitializer {
class GPU_EXPORT CollectiveInitializer {
public:
CollectiveInitializer(CollectiveInitializer const &) = delete;
CollectiveInitializer &operator=(const CollectiveInitializer &) = delete;

View File

@ -28,7 +28,7 @@
namespace mindspore {
namespace device {
class BACKEND_EXPORT GpuDataQueueDynamic : public DataQueue {
class GPU_EXPORT GpuDataQueueDynamic : public DataQueue {
public:
explicit GpuDataQueueDynamic(const std::string &channel_name, const size_t capacity);
~GpuDataQueueDynamic() override = default;
@ -52,7 +52,7 @@ class BACKEND_EXPORT GpuDataQueueDynamic : public DataQueue {
uint32_t device_id_;
};
class BACKEND_EXPORT GpuQueue : public DataQueue {
class GPU_EXPORT GpuQueue : public DataQueue {
public:
GpuQueue(const std::string &channel_name, size_t capacity, const std::vector<size_t> &shape);
~GpuQueue() override;
@ -79,7 +79,7 @@ class BACKEND_EXPORT GpuQueue : public DataQueue {
bool ds_detected_{false};
};
class BACKEND_EXPORT GpuDataQueue : public DataQueue {
class GPU_EXPORT GpuDataQueue : public DataQueue {
public:
GpuDataQueue(const std::string &channel_name, size_t capacity, const std::vector<size_t> &shape);
~GpuDataQueue() override;

View File

@ -95,7 +95,7 @@ class FormatTransformChecker {
bool format_transform_{true};
};
class BACKEND_EXPORT GPUGraphKernelInfo : public GraphKernelInfo {
class GPU_EXPORT GPUGraphKernelInfo : public GraphKernelInfo {
public:
GPUGraphKernelInfo() = default;
virtual ~GPUGraphKernelInfo() = default;

View File

@ -59,7 +59,9 @@
#include "backend/common/pass/optimize_updatestate.h"
#include "abstract/ops/primitive_infer_map.h"
#include "common/graph_kernel/adapter/expander.h"
#ifdef ENABLE_AKG
#include "common/graph_kernel/value_graph_binder.h"
#endif
namespace mindspore {
namespace device {

View File

@ -116,7 +116,7 @@ class ProfilingOp {
std::string op_name_;
};
class BACKEND_EXPORT GPUProfiler : public Profiler {
class GPU_EXPORT GPUProfiler : public Profiler {
public:
static std::shared_ptr<GPUProfiler> GetInstance();