!494 Split ccsrc cmake to individual sub-directories

Merge pull request !494 from zhoufeng/cmake-sub
This commit is contained in:
mindspore-ci-bot 2020-04-27 11:42:05 +08:00 committed by Gitee
commit 63712848e2
31 changed files with 330 additions and 482 deletions

View File

@ -4,7 +4,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
mindspore_add_pkg(onednn
VER 1.1.1
LIBS dnnl mkldnn
HEAD_ONLY ./
HEAD_ONLY ./include
RELEASE on
URL https://github.com/oneapi-src/oneDNN/releases/download/v1.1.1/dnnl_win_1.1.1_cpu_vcomp.zip
MD5 ecaab9ed549643067699c80e5cea1c23)

View File

@ -38,17 +38,17 @@ function(ms_protobuf_generate c_var h_var)
get_filename_component(file_dir ${abs_file} PATH)
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${file_dir})
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.h")
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h")
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.h"
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/${rel_path}"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM)
endforeach()
set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
@ -71,40 +71,38 @@ function(ms_protobuf_generate_py c_var h_var py_var)
get_filename_component(abs_file ${file} ABSOLUTE)
get_filename_component(file_name ${file} NAME_WE)
get_filename_component(file_dir ${abs_file} PATH)
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${file_dir})
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.h")
list(APPEND ${py_var} "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py")
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h")
list(APPEND ${py_var} "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py")
if (WIN32)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py"
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/${rel_path}"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
COMMAND perl -pi.bak -e "s/import (.+_pb2.*)/from . import \\1/" "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py" "${PROJECT_SOURCE_DIR}/mindspore/train/"
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND perl -pi.bak -e "s/import (.+_pb2.*)/from . import \\1/" "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py" "${PROJECT_SOURCE_DIR}/mindspore/train/"
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
else()
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/${rel_path}/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py"
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/${rel_path}"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
COMMAND perl -pi -e "s/import (.+_pb2.*)/from . import \\1/" "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py"
COMMAND cp "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py" "${PROJECT_SOURCE_DIR}/mindspore/train/"
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND perl -pi -e "s/import (.+_pb2.*)/from . import \\1/" "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
COMMAND cp "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py" "${PROJECT_SOURCE_DIR}/mindspore/train/"
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM)
endif()
endforeach()
set_source_files_properties(${${c_var}} ${${h_var}} ${${py_var}} PROPERTIES GENERATED TRUE)

View File

@ -1,14 +1,11 @@
## common setting
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if(ENABLE_CPU)
include(ExternalProject)
add_compile_definitions(CPUSESSION)
file(GLOB_RECURSE CPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"device/cpu/*.cc"
)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes -DHAVE_SNPRINTF")
add_compile_definitions(BUILDING_DLL)
endif()
include_directories(${CMAKE_BINARY_DIR})
link_directories(${CMAKE_SOURCE_DIR}/build/mindspore/graphengine)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes -DHAVE_SNPRINTF")
add_compile_definitions(BUILDING_DLL)
endif()
if(ENABLE_GPU)
@ -20,7 +17,7 @@ if(ENABLE_GPU)
enable_language(CUDA)
if(NOT CUDA_PATH OR CUDA_PATH STREQUAL "")
if(DEFINED ENV{CUDA_HOME})
set(CUDA_PATH $ENV{CUDA_HOME})
set(CUDA_PATH $ENV{CUDA_HOME})
else()
set(CUDA_PATH ${CUDA_TOOLKIT_ROOT_DIR})
endif()
@ -41,261 +38,101 @@ if(ENABLE_GPU)
"kernel/akg/akgkernelbuild.cc"
"kernel/akg/akg_kernel_attrs_process.cc"
)
file(GLOB_RECURSE GPU_KERNEL_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel/gpu/*.cc"
)
list(APPEND CUDA_NVCC_FLAGS -arch=sm_53)
list(REMOVE_ITEM GPU_SRC_LIST "device/gpu/blocking_queue.cc" "device/gpu/gpu_buffer_mgr.cc")
add_library(gpu_queue SHARED "device/gpu/blocking_queue.cc" "device/gpu/gpu_buffer_mgr.cc")
target_link_libraries(gpu_queue ${CMAKE_THREAD_LIBS_INIT} ${CUDA_PATH}/lib64/libcudart.so)
file(GLOB_RECURSE MS_STEPS_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"session/gpu_session.cc"
)
list(REMOVE_ITEM GPU_SRC_LIST "device/gpu/mpi/mpi_initializer.cc"
"device/gpu/distribution/collective_wrapper.cc"
"device/gpu/distribution/mpi_wrapper.cc"
"device/gpu/distribution/nccl_wrapper.cc"
)
list(REMOVE_ITEM GPU_KERNEL_SRC_LIST "device/gpu/mpi/mpi_initializer.cc"
"kernel/gpu/nccl/nccl_gpu_kernel.cc"
)
set(NVCC_TMP_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "-std=c++17" "-std=c++11" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
cuda_add_library(gpu_cuda_lib STATIC ${GPU_SRC_LIST})
set(CMAKE_CXX_FLAGS ${NVCC_TMP_CMAKE_CXX_FLAGS})
endif ()
if(ENABLE_MPI)
include(ExternalProject)
file(GLOB_RECURSE GPU_NCCL_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel/gpu/nccl/*.cc"
)
file(GLOB_RECURSE GPU_MPI_PYTHON_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"device/gpu/mpi/mpi_initializer.cc"
)
add_library(gpu_collective SHARED "device/gpu/distribution/collective_wrapper.cc"
"device/gpu/distribution/mpi_wrapper.cc"
"device/gpu/distribution/nccl_wrapper.cc"
)
endif()
endif()
## make flatuffer files
include_directories("${CMAKE_BINARY_DIR}/predict/schema/inner")
file(GLOB_RECURSE FLATBUFFER_IN RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "predict/schema/*.fbs")
set(FLATBUFFER_OU "${CMAKE_BINARY_DIR}/predict/schema/inner")
ms_build_flatbuffers("${FLATBUFFER_IN}" "${FLATBUFFER_IN}" GENERATED_OUTPUT_DIR "${FLATBUFFER_OU}")
ms_build_flatbuffers("${FLATBUFFER_IN}" "${FLATBUFFER_IN}" flat_input "${FLATBUFFER_OU}")
file(GLOB_RECURSE MINDSPORE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"ir/*.cc"
"ir/dtype/*.cc"
"utils/context/ms_context.cc"
"utils/symbolic.cc"
"utils/tensorprint_utils.cc"
"utils/convert_utils.cc"
"utils/graph_utils.cc"
"utils/misc.cc"
"utils/callbacks.cc"
"utils/profile.cc"
"utils/base_ref.cc"
"utils/summary/event_writer.cc"
"utils/log_adapter.cc"
"utils/comm_manager.cc"
"utils/any.cc"
"utils/config_manager.cc"
"utils/system/file_system.cc"
"utils/system/crc32c.cc"
"common/*.cc"
"parallel/*.cc"
"pipeline/pipeline.cc"
"pipeline/resource.cc"
"pipeline/pass.cc"
"pipeline/action.cc"
"pipeline/validator.cc"
"pipeline/remove_value_node_dup.cc"
"pipeline/parse/*.cc"
"pipeline/static_analysis/*.cc"
"optimizer/*.cc"
"debug/*.cc"
"onnx/onnx_exporter.cc"
"operator/*.cc"
"session/kernel_graph.cc"
"utils/node_utils.cc"
"session/session_basic.cc"
"session/session_factory.cc"
"session/anf_runtime_algorithm.cc"
"vm/*.cc"
"pynative/base.cc"
"pynative/pynative_execute.cc"
"pybind_api/*.cc"
"device/common/*.cc"
"kernel/kernel_query.cc"
"kernel/kernel_build_info.cc"
"kernel/kash/*.cc"
"device/kernel_info.cc"
"device/kernel_runtime.cc"
"device/memory_manager.cc"
"device/kernel_runtime_manager.cc"
"device/convert_tensor_utils.cc"
"pre_activate/common/*.cc"
"pre_activate/pass/*.cc"
"pre_activate/gpu/*.cc"
"pre_activate/mem_reuse/*.cc"
"predict/predict.cc"
"predict/generator/utils/ir_model_util.cc"
"predict/converter/*.cc"
"predict/converter/attr_utils/*.cc"
"predict/converter/lite_model/*.cc"
"predict/converter/lite_model/operations/*.cc"
"kernel/common_utils.cc"
"kernel/oplib/*.cc"
"kernel/kash/*.cc"
"device/gpu/distribution/collective_init.cc"
)
if (ENABLE_CPU)
list(REMOVE_ITEM MINDSPORE_SRC_LIST "device/gpu/distribution/collective_init.cc")
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
list(REMOVE_ITEM MINDSPORE_SRC_LIST "kernel/kernel_query.cc")
endif()
endif()
if (NOT ENABLE_GPU)
list(APPEND MINDSPORE_SRC_LIST "device/gpu/distribution/collective_fake_init.cc")
endif()
file(GLOB_RECURSE MEM_REUSE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"pre_activate/mem_reuse/*.cc"
)
if(NOT ENABLE_DUMP_E2E)
list(REMOVE_ITEM MINDSPORE_SRC_LIST "debug/e2e_dump.cc")
endif()
file(COPY "${ms_onnx_INC}/onnx/onnx.proto" DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB_RECURSE ONNX_PROTO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/onnx.proto")
message("onnx proto path is : ${ONNX_PROTO}")
## make protobuf files
file(COPY "${ms_onnx_INC}/onnx/onnx.proto" DESTINATION ${CMAKE_BINARY_DIR}/proto)
file(GLOB ONNX_PROTO "" ${CMAKE_BINARY_DIR}/proto/onnx.proto)
message("onnx proto path is :" ${ONNX_PROTO})
ms_protobuf_generate(ONNX_PROTO_SRCS ONNX_PROTO_HDRS ${ONNX_PROTO})
list(APPEND MINDSPORE_PROTO_LIST ${ONNX_PROTO_SRCS})
if(ENABLE_DUMP_PROTO)
if (ENABLE_DUMP_PROTO)
include_directories(${CMAKE_BINARY_DIR})
file(GLOB_RECURSE PROTO_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"utils/node_strategy.proto"
)
file(GLOB_RECURSE PROTO_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "utils/node_strategy.proto")
ms_protobuf_generate(PROTO_SRCS PROTO_HDRS ${PROTO_LIST})
file(GLOB_RECURSE PROTO_PY RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"utils/anf_ir.proto"
"utils/summary.proto"
"utils/checkpoint.proto"
)
"utils/anf_ir.proto"
"utils/summary.proto"
"utils/checkpoint.proto"
)
ms_protobuf_generate_py(PY_SRCS PY_HDRS PY_PYS ${PROTO_PY})
list(APPEND MINDSPORE_PROTO_DUMP_LIST ${PROTO_SRCS})
list(APPEND MINDSPORE_PROTO_DUMP_LIST ${PY_SRCS})
list(APPEND MINDSPORE_SRC_LIST "debug/dump_proto.cc")
list(APPEND MINDSPORE_SRC_LIST "parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc")
add_compile_definitions(ENABLE_DUMP_PROTO)
endif()
list(APPEND MINDSPORE_PROTO_LIST ${PROTO_SRCS})
list(APPEND MINDSPORE_PROTO_LIST ${PY_SRCS})
endif ()
if(ENABLE_GE)
file(GLOB_RECURSE GE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"transform/*.cc"
"pynative/pynative_execute_ge.cc"
"utils/callbacks_ge.cc"
"pipeline/pipeline_ge.cc"
)
list(APPEND MINDSPORE_SRC_LIST ${GE_SRC_LIST})
endif()
if(ENABLE_D)
if (ENABLE_D)
include_directories("${CMAKE_BINARY_DIR}/kernel/aicpu")
file(GLOB_RECURSE PROTO_IN RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel/aicpu/proto/*.proto"
)
ms_protobuf_generate(PROTOSRCS PROTOHDRS ${PROTO_IN})
include_directories("${CMAKE_BINARY_DIR}/predict/generator/ir")
file(GLOB_RECURSE PROTO_INNER RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"predict/proto/*.proto"
)
file(GLOB_RECURSE PROTO_IN RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "kernel/aicpu/proto/*.proto")
ms_protobuf_generate(PROTOSRCS PROTOHDRS ${PROTO_IN})
file(GLOB_RECURSE PROTO_INNER RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "predict/proto/*.proto")
ms_protobuf_generate(PREDICT_PROTOSRCS PREDICT_PROTOHDRS ${PROTO_INNER})
file(GLOB_RECURSE D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"device/ascend/*.cc"
"device/ascend/profiling/*.cc"
"device/ascend/tasksink/*.cc"
"device/kernel_adjust.cc"
"kernel/kernel_fusion.cc"
"kernel/tbe/*.cc"
"pre_activate/ascend/*.cc"
"transform/*.cc"
"pipeline/pipeline_ge.cc"
)
list(APPEND MINDSPORE_SRC_LIST ${D_SRC_LIST})
list(APPEND MINDSPORE_PROTO_AICPU_LIST ${PROTOSRCS})
list(APPEND MINDSPORE_PROTO_PREDICT_LIST ${PREDICT_PROTOSRCS})
list(APPEND MINDSPORE_PROTO_LIST ${PROTOSRCS})
list(APPEND MINDSPORE_PROTO_LIST ${PREDICT_PROTOSRCS})
file(GLOB_RECURSE MS_STEPS_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"session/ascend_session.cc"
)
file(GLOB_RECURSE MS_TASKINFO_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"device/ascend/tasksink/taskinfo/*.cc")
file(GLOB_RECURSE MS_AICPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel/aicpu/*.cc"
)
file(GLOB_RECURSE MS_RT_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel/mng/*.cc"
)
file(GLOB_RECURSE MS_HCCL_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel/hccl/*.cc"
)
file(GLOB_RECURSE MS_PREDICT_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"predict/generator/ir/*.cc"
)
add_compile_definitions(ENABLE_D)
endif()
endif ()
file(GLOB_RECURSE MS_GVAR_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"gvar/*.cc"
)
add_library(mindspore_gvar SHARED ${MS_GVAR_SRC_LIST})
add_library(mindspore STATIC ${MINDSPORE_SRC_LIST})
add_dependencies(mindspore GENERATED_OUTPUT_DIR)
if(ENABLE_D)
list(APPEND MINDSPORE_PROTO_LIST ${MINDSPORE_PROTO_AICPU_LIST})
endif()
if(ENABLE_DUMP_PROTO)
list(APPEND MINDSPORE_PROTO_LIST ${MINDSPORE_PROTO_DUMP_LIST})
endif()
list(APPEND MINDSPORE_PROTO_LIST ${MINDSPORE_PROTO_PREDICT_LIST})
if(MINDSPORE_PROTO_LIST)
if (MINDSPORE_PROTO_LIST)
add_library(proto_input STATIC ${MINDSPORE_PROTO_LIST})
set_target_properties(proto_input PROPERTIES COMPILE_FLAGS "-Wno-unused-variable")
target_link_libraries(mindspore proto_input)
endif()
if(APPLE)
set_target_properties(mindspore_gvar PROPERTIES MACOSX_RPATH ON)
endif()
## make sub objects
set(SUB_COMP
transform pre_activate parallel pipeline device kernel common debug gvar ir onnx operator optimizer predict
pybind_api pynative session utils vm
)
link_directories(${CMAKE_SOURCE_DIR}/build/mindspore/graphengine)
foreach (_comp ${SUB_COMP})
add_subdirectory(${_comp})
if (TARGET _mindspore_${_comp}_obj)
list(APPEND SUB_OBJECTS_SRC $<TARGET_OBJECTS:_mindspore_${_comp}_obj>)
add_dependencies(_mindspore_${_comp}_obj proto_input flat_input)
endif ()
endforeach ()
add_library(mindspore STATIC ${SUB_OBJECTS_SRC})
target_link_libraries(mindspore proto_input)
target_link_libraries(mindspore securec mindspore::flatbuffers)
if (NOT WIN32)
target_link_libraries(mindspore dl)
endif()
if (ENABLE_GE)
if(ENABLE_TRAIN)
target_link_libraries(mindspore graph ge_client_train)
else()
target_link_libraries(mindspore graph ge_client)
endif()
target_link_libraries(mindspore tsdclient)
elseif(ENABLE_D)
add_compile_definitions(NO_GE_CLIENT)
target_link_libraries(mindspore graph)
else()
add_compile_definitions(NO_GE_CLIENT)
target_link_libraries(mindspore ge_client_train)
else ()
target_link_libraries(mindspore ge_client)
endif ()
target_link_libraries(mindspore graph tsdclient)
endif()
if(ENABLE_D)
if (ENABLE_D)
if (DEFINED ENV{D_LINK_PATH})
if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
MESSAGE("system processor matches aarch64")
@ -306,13 +143,13 @@ if(ENABLE_D)
else ()
MESSAGE("system ${CMAKE_HOST_SYSTEM_PROCESSOR} not support")
endif()
else()
else ()
MESSAGE("use system default lib")
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
if (DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_PATH $ENV{ASCEND_CUSTOM_PATH})
else()
else ()
set(ASCEND_PATH /usr/local/Ascend)
endif()
endif ()
set(ASCEND_DRIVER_PATH ${ASCEND_PATH}/driver/lib64/common)
set(ASCEND_DRIVER_BACK_PATH ${ASCEND_PATH}/driver/lib64/driver)
set(ASCEND_RUNTIME_PATH ${ASCEND_PATH}/fwkacllib/lib64)
@ -327,37 +164,14 @@ if(ENABLE_D)
target_link_libraries(mindspore ge_runtime ${CCE_LIB} ${RUNTIME_LIB} ${TSDCLIENT} ${PROFILING} ${HCCL} ${TSDCLIENT})
endif()
target_link_libraries(mindspore securec)
if (NOT WIN32)
target_link_libraries(mindspore dl)
endif()
target_link_libraries(mindspore mindspore::flatbuffers)
# link protobuf
if (ENABLE_D)
target_link_libraries(mindspore mindspore::protobuf)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(mindspore ${PYTHON_LIBRARIES} mindspore_gvar)
endif()
# set c_expression building
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(PYTHON_MODULE_SOURCE ${MS_GVAR_SRC_LIST}
pipeline/init.cc
kernel/oplib/oplib.cc
${MINDSPORE_SRC_LIST} ${MS_STEPS_SRC_LIST} ${MS_CCE_SRC_LIST} ${MS_AICPU_SRC_LIST} ${MS_TASKINFO_LIST} ${MS_RT_SRC_LIST}
${GPU_NCCL_LIST} ${MS_HCCL_SRC_LIST} ${MS_PREDICT_SRC_LIST} ${CPU_SRC_LIST} ${MEM_REUSE_SRC_LIST} ${GPU_KERNEL_SRC_LIST})
else()
set(PYTHON_MODULE_SOURCE
pipeline/init.cc
kernel/oplib/oplib.cc
${MS_STEPS_SRC_LIST} ${MS_CCE_SRC_LIST} ${MS_AICPU_SRC_LIST} ${MS_TASKINFO_LIST} ${MS_RT_SRC_LIST}
${GPU_NCCL_LIST} ${MS_HCCL_SRC_LIST} ${MS_PREDICT_SRC_LIST} ${CPU_SRC_LIST} ${MEM_REUSE_SRC_LIST} ${GPU_KERNEL_SRC_LIST})
endif()
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
pybind11_add_module(_c_expression ${PYTHON_MODULE_SOURCE})
pybind11_add_module(_c_expression "pipeline/init.cc")
MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}")
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
@ -372,55 +186,41 @@ else ()
MESSAGE(FATAL_ERROR "other platform: ${CMAKE_SYSTEM_NAME}")
endif ()
set(ORIGIN_PATH ${ORIGIN_PATH}/lib)
set_target_properties(_c_expression PROPERTIES INSTALL_RPATH ${ORIGIN_PATH})
if (WIN32)
target_link_libraries(_c_expression PRIVATE
mindspore::pybind11_module
securec
proto_input
mindspore::flatbuffers
)
else()
target_link_libraries(_c_expression PRIVATE
mindspore::pybind11_module
mindspore
mindspore_gvar
)
endif()
if(USE_GLOG)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
target_link_libraries(mindspore mindspore::pybind11_module)
target_link_libraries(mindspore mindspore_gvar)
else ()
target_link_libraries(_c_expression PRIVATE mindspore::pybind11_module)
target_link_libraries(_c_expression PRIVATE mindspore_gvar)
endif ()
target_link_libraries(_c_expression PRIVATE -Wl,--whole-archive mindspore -Wl,--no-whole-archive)
if (USE_GLOG)
target_link_libraries(_c_expression PRIVATE mindspore::glog)
endif()
endif ()
if(ENABLE_DUMP_PROTO)
if (ENABLE_DUMP_PROTO)
target_link_libraries(_c_expression PRIVATE mindspore::protobuf)
endif()
endif ()
if(ENABLE_GPU)
if (ENABLE_GPU)
message("add gpu lib to c_expression")
target_link_libraries(_c_expression PRIVATE
gpu_cuda_lib
gpu_queue
cublas
target_link_libraries(_c_expression PRIVATE gpu_cuda_lib gpu_queue cublas
${CUDA_PATH}/lib64/libcurand.so
${CUDNN_PATH}/lib64/libcudnn.so
${CUDA_PATH}/lib64/libcudart.so
${CUDA_PATH}/lib64/stubs/libcuda.so)
if(ENABLE_MPI)
pybind11_add_module(_ms_mpi ${GPU_MPI_PYTHON_LIST})
target_link_libraries(_ms_mpi PRIVATE mindspore::pybind11_module mindspore::ompi)
target_link_libraries(gpu_collective PRIVATE mindspore::ompi mindspore::nccl)
endif()
endif()
endif ()
if(ENABLE_CPU)
if (ENABLE_CPU)
target_link_libraries(_c_expression PRIVATE mindspore::dnnl mindspore::mkldnn)
endif()
endif ()
if(ENABLE_MINDDATA)
if (ENABLE_MINDDATA)
add_subdirectory(mindrecord)
add_subdirectory(dataset)
endif()
endif ()

View File

@ -1,2 +1,2 @@
add_library(_mindspore_common_obj OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
file(GLOB_RECURSE _COMMON_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
add_library(_mindspore_common_obj OBJECT ${_COMMON_ALL_SRC_FILES})

View File

@ -21,7 +21,7 @@
#include <string>
#include <vector>
#include "dataset/engine/data_buffer.h"
#include "./example.pb.h"
#include "proto/example.pb.h"
#include "dataset/engine/datasetops/source/tf_client.h"
namespace mindspore {

View File

@ -24,7 +24,7 @@
#include <algorithm>
#include "common/utils.h"
#include "./example.pb.h"
#include "proto/example.pb.h"
#include "dataset/engine/datasetops/source/storage_client.h"
#include "dataset/util/path.h"
#include "dataset/util/status.h"

View File

@ -25,7 +25,7 @@
#include <utility>
#include <vector>
#include <map>
#include "./example.pb.h"
#include "proto/example.pb.h"
#include "dataset/engine/datasetops/source/storage_client.h"
#include "dataset/util/status.h"

View File

@ -23,7 +23,7 @@
#include <utility>
#include <unordered_map>
#include "./example.pb.h"
#include "proto/example.pb.h"
#include "./securec.h"
#include "common/utils.h"
#include "dataset/core/config_manager.h"

View File

@ -1,12 +1,16 @@
set(_DEBUG_SRC_LIST
"${CMAKE_CURRENT_SOURCE_DIR}/anf_ir_dump.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/anf_ir_utils.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/draw.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/dump_proto.cc")
"${CMAKE_CURRENT_SOURCE_DIR}/anf_ir_dump.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/anf_ir_utils.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/draw.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/dump_proto.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/info.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/label.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/trace_info.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/trace.cc"
)
if(ENABLE_DUMP_E2E)
if (ENABLE_DUMP_E2E)
list(APPEND _DEBUG_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/e2e_dump.cc")
endif(ENABLE_DUMP_E2E)
endif (ENABLE_DUMP_E2E)
add_library(_mindspore_debug_obj OBJECT ${_DEBUG_SRC_LIST})
add_library(_mindspore_debug_obj OBJECT ${_DEBUG_SRC_LIST})

View File

@ -23,7 +23,7 @@
#include <algorithm>
#include "debug/anf_ir_utils.h"
#include "utils/anf_ir.pb.h"
#include "proto/anf_ir.pb.h"
#include "utils/graph_utils.h"
#include "utils/symbolic.h"

View File

@ -1,34 +1,50 @@
file(GLOB_RECURSE _DEVICE_ALL_SRC_FILES *.cc)
add_library(_mindspore_device_obj OBJECT ${_DEVICE_ALL_SRC_FILES})
file(GLOB_RECURSE DEVICE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "common/*.cc"
"kernel_info.cc" "kernel_runtime.cc" "memory_manager.cc" "kernel_runtime_manager.cc" "convert_tensor_utils.cc"
)
if(ENABLE_CPU)
target_compile_definitions(_mindspore_device_obj PRIVATE CPUSESSION)
file(GLOB_RECURSE _CPU_SRC_LIST cpu/*.cc)
add_library(_c_expression_cpu_device_obj OBJECT ${_CPU_SRC_LIST})
endif()
if (ENABLE_GPU)
list(APPEND DEVICE_SRC_LIST "gpu/distribution/collective_init.cc")
else ()
list(APPEND DEVICE_SRC_LIST "gpu/distribution/collective_fake_init.cc")
endif ()
if(ENABLE_GPU)
file(GLOB_RECURSE _GPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"gpu/*.cc"
"gpu/*.cu"
)
list(REMOVE_ITEM _GPU_SRC_LIST "gpu/blocking_queue.cc"
"gpu/gpu_buffer_mgr.cc"
"gpu/mpi/mpi_initializer.cc"
if (ENABLE_D)
file(GLOB_RECURSE D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ascend/*.cc" "kernel_adjust.cc")
endif ()
if (ENABLE_CPU)
file(GLOB_RECURSE CPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "cpu/*.cc")
endif ()
# gpu
if (ENABLE_GPU)
file(GLOB_RECURSE CUDA_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gpu/*.cc" "gpu/*.cu")
# gpu_queue
list(REMOVE_ITEM CUDA_SRC_LIST "gpu/blocking_queue.cc" "gpu/gpu_buffer_mgr.cc")
add_library(gpu_queue SHARED "gpu/blocking_queue.cc" "gpu/gpu_buffer_mgr.cc")
target_link_libraries(gpu_queue ${CMAKE_THREAD_LIBS_INIT} ${CUDA_PATH}/lib64/libcudart.so)
list(REMOVE_ITEM CUDA_SRC_LIST "gpu/mpi/mpi_initializer.cc"
"gpu/distribution/collective_wrapper.cc"
"gpu/distribution/mpi_wrapper.cc"
"gpu/distribution/nccl_wrapper.cc")
add_library(_cuda_gpu_device_obj OBJECT ${_GPU_SRC_LIST})
endif()
"gpu/distribution/nccl_wrapper.cc"
)
if(ENABLE_D)
file(GLOB_RECURSE _D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"ascend/*.cc"
"ascend/profiling/*.cc"
"ascend/tasksink/*.cc"
"kernel_adjust.cc"
"ascend/tasksink/taskinfo/*.cc"
)
target_sources(_mindspore_device_obj PRIVATE ${_D_SRC_LIST})
endif()
if (ENABLE_MPI)
include(ExternalProject)
# gpu_collective
add_library(gpu_collective SHARED "gpu/distribution/collective_wrapper.cc"
"gpu/distribution/mpi_wrapper.cc"
"gpu/distribution/nccl_wrapper.cc"
)
# _ms_mpi
pybind11_add_module(_ms_mpi "gpu/mpi/mpi_initializer.cc")
target_link_libraries(_ms_mpi PRIVATE mindspore::pybind11_module mindspore::ompi)
target_link_libraries(gpu_collective PRIVATE mindspore::ompi mindspore::nccl)
endif ()
# add_library(_mindspore_device_cuda_obj OBJECT ${CUDA_SRC_LIST})
endif ()
add_library(_mindspore_device_obj OBJECT ${DEVICE_SRC_LIST} ${D_SRC_LIST} ${CPU_SRC_LIST})

View File

@ -0,0 +1,5 @@
file(GLOB_RECURSE MS_GVAR_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cc)
add_library(mindspore_gvar SHARED ${MS_GVAR_SRC_LIST})
if (APPLE)
set_target_properties(mindspore_gvar PROPERTIES MACOSX_RPATH ON)
endif ()

View File

@ -1,5 +1,2 @@
file(GLOB_RECURSE _IR_ALL_SRC_FILES
./*.cc
dtype/*.cc)
add_library(_mindspore_ir_obj OBJECT ${_IR_ALL_SRC_FILES})
file(GLOB_RECURSE _IR_SRC_LIST ./*.cc dtype/*.cc)
add_library(_mindspore_ir_obj OBJECT ${_IR_SRC_LIST})

View File

@ -1,34 +1,40 @@
file(GLOB_RECURSE _SESSION_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel_query.cc"
"kernel_fusion.cc"
"kernel_build_info.cc"
"kash/*.cc"
"common_utils.cc"
"oplib/*.cc"
)
add_library(_mindspore_kernel_obj OBJECT ${_SESSION_ALL_SRC_FILES})
if(ENABLE_GPU)
file(GLOB_RECURSE _CUDA_GPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"gpu/*.cu"
"akg/gpu/*.cc"
)
add_library(_cuda_gpu_kernel_obj OBJECT ${_CUDA_GPU_SRC_LIST})
file(GLOB_RECURSE _C_EXPRESSION_GPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"gpu/*.cc"
)
list(REMOVE_ITEM _C_EXPRESSION_GPU_SRC_LIST "gpu/nccl/nccl_gpu_kernel.cc")
add_library(_c_expression_gpu_device_obj OBJECT ${_C_EXPRESSION_GPU_SRC_LIST})
endif()
if(ENABLE_D)
file(GLOB_RECURSE _D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"tbe/*.cc"
"aicpu/*.cc"
"mng/*.cc"
"hccl/*.cc"
)
target_sources(_mindspore_kernel_obj PRIVATE ${_D_SRC_LIST})
endif()
file(GLOB_RECURSE KERNEL_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel_build_info.cc"
"kash/*.cc"
"common_utils.cc"
"oplib/*.cc"
)
if (ENABLE_D)
file(GLOB_RECURSE D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel_query.cc"
"kernel_fusion.cc"
"tbe/*.cc"
"aicpu/*.cc"
"mng/*.cc"
"hccl/*.cc"
)
add_compile_definitions(ENABLE_D)
endif ()
if (ENABLE_GPU)
file(GLOB_RECURSE CUDA_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"gpu/*.cu"
"akg/gpu/*.cc"
"akg/akgkernelbuild.cc"
"akg/akg_kernel_attrs_process.cc"
)
file(GLOB_RECURSE GPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gpu/*.cc")
list(REMOVE_ITEM GPU_SRC_LIST "gpu/nccl/nccl_gpu_kernel.cc")
if (ENABLE_MPI)
include(ExternalProject)
file(GLOB_RECURSE GPU_NCCL_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gpu/nccl/*.cc")
list(APPEND GPU_SRC_LIST ${GPU_NCCL_LIST})
endif ()
# add_library(_mindspore_kernel_cuda_obj OBJECT ${CUDA_SRC_LIST})
endif()
add_library(_mindspore_kernel_obj OBJECT ${KERNEL_SRC_LIST} ${GPU_SRC_LIST} ${D_SRC_LIST})

View File

@ -1,5 +1,2 @@
file(GLOB_RECURSE _ONNX_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"*.cc"
)
add_library(_mindspore_onnx_obj OBJECT ${_ONNX_ALL_SRC_FILES})
file(GLOB_RECURSE _ONNX_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
add_library(_mindspore_onnx_obj OBJECT ${_ONNX_SRC_FILES})

View File

@ -24,7 +24,7 @@
#include <functional>
#include "debug/anf_ir_utils.h"
#include "./onnx.pb.h"
#include "proto/onnx.pb.h"
#include "operator/ops.h"
namespace mindspore {

View File

@ -1,5 +1,2 @@
file(GLOB_RECURSE _OPERATOR_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"*.cc"
)
add_library(_mindspore_operator_obj OBJECT ${_OPERATOR_ALL_SRC_FILES})
file(GLOB_RECURSE _OPERATOR_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
add_library(_mindspore_operator_obj OBJECT ${_OPERATOR_SRC_FILES})

View File

@ -1,9 +1,2 @@
file(GLOB_RECURSE _OPTIMIZER_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"*.cc"
)
add_library(_mindspore_optimizer_obj OBJECT ${_OPTIMIZER_ALL_SRC_FILES})
if(ENABLE_DUMP_PROTO)
file(GLOB_RECURSE _PROTO_SRC_LIST "parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc")
target_sources(_mindspore_optimizer_obj PRIVATE ${_PROTO_SRC_LIST})
endif()
file(GLOB_RECURSE _OPTIMIZER_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
add_library(_mindspore_optimizer_obj OBJECT ${_OPTIMIZER_SRC_FILES})

View File

@ -0,0 +1,6 @@
file(GLOB_RECURSE _PARALLEL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
if (ENABLE_DUMP_PROTO)
list(REMOVE_ITEM _PARALLEL_SRC_FILES "parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc")
endif ()
add_library(_mindspore_parallel_obj OBJECT ${_PARALLEL_SRC_FILES})

View File

@ -23,7 +23,7 @@
#include "common/utils.h"
#include "utils/convert_utils.h"
#include "utils/log_adapter.h"
#include "utils/node_strategy.pb.h"
#include "proto/node_strategy.pb.h"
namespace mindspore {
namespace parallel {

View File

@ -1,12 +1,17 @@
file(GLOB_RECURSE _PIPELINE_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"pipeline.cc"
"resource.cc"
"pass.cc"
"action.cc"
"validator.cc"
"remove_value_node_dup.cc"
"parse/*.cc"
"static_analysis/*.cc"
)
file(GLOB_RECURSE _PIPELINE_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"pipeline.cc"
"resource.cc"
"pass.cc"
"action.cc"
"validator.cc"
"remove_value_node_dup.cc"
"parse/*.cc"
"static_analysis/*.cc"
)
add_library(_mindspore_pipeline_obj OBJECT ${_PIPELINE_ALL_SRC_FILES})
if (ENABLE_GE OR ENABLE_D)
file(GLOB_RECURSE _PIPELINE_GE_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "pipeline_ge.cc")
list(APPEND _PIPELINE_SRC_FILES ${_PIPELINE_GE_SRC_FILES})
endif ()
add_library(_mindspore_pipeline_obj OBJECT ${_PIPELINE_SRC_FILES})

View File

@ -0,0 +1,13 @@
file(GLOB_RECURSE _PREACTIVATE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"common/*.cc"
"mem_reuse/*.cc"
"pass/*.cc"
"gpu/*.cc"
)
if (ENABLE_D)
file(GLOB_RECURSE _D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ascend/*.cc")
list(APPEND _PREACTIVATE_SRC_LIST ${_D_SRC_LIST})
endif ()
add_library(_mindspore_pre_activate_obj OBJECT ${_PREACTIVATE_SRC_LIST})

View File

@ -1,8 +1,14 @@
file(GLOB_RECURSE _PRE_ACTIVE_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"ascend/*.cc"
"common/*.cc"
"pass/*.cc"
"gpu/*.cc"
)
file(GLOB_RECURSE _PREDICT_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"predict.cc"
"generator/utils/ir_model_util.cc"
"converter/*.cc"
"converter/attr_utils/*.cc"
"converter/lite_model/*.cc"
"converter/lite_model/operations/*.cc"
)
add_library(_mindspore_pre_active_obj OBJECT ${_PRE_ACTIVE_ALL_SRC_FILES})
if (ENABLE_D)
file(GLOB_RECURSE _D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "generator/ir/*.cc")
list(APPEND _PREDICT_SRC_LIST ${_D_SRC_LIST})
endif ()
add_library(_mindspore_predict_obj OBJECT ${_PREDICT_SRC_LIST})

View File

@ -21,7 +21,7 @@
#include <memory>
#include <string>
#include <vector>
#include "predict/proto/ge_runtime_taskinfo.pb.h"
#include "proto/ge_runtime_taskinfo.pb.h"
namespace mindspore {
namespace generator {

View File

@ -1,5 +1,2 @@
file(GLOB_RECURSE _PYNATIVE_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"*.cc"
)
add_library(_mindspore_pynative_obj OBJECT ${_PYNATIVE_ALL_SRC_FILES})
file(GLOB_RECURSE _PYBIND_API_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
add_library(_mindspore_pybind_api_obj OBJECT ${_PYBIND_API_SRC_LIST})

View File

@ -1,5 +1,8 @@
file(GLOB_RECURSE _PYNATIVE_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"*.cc"
)
add_library(_mindspore_pynative_obj OBJECT ${_PYNATIVE_ALL_SRC_FILES})
file(GLOB_RECURSE _PYNATIVE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "base.cc" "pynative_execute.cc")
if (ENABLE_GE)
file(GLOB_RECURSE _GE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "pynative_execute_ge.cc")
list(APPEND _PYNATIVE_SRC_LIST ${_GE_SRC_LIST})
endif ()
add_library(_mindspore_pynative_obj OBJECT ${_PYNATIVE_SRC_LIST})

View File

@ -1,22 +1,22 @@
file(GLOB_RECURSE _SESSION_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel_graph.cc"
"session_basic.cc"
"session_factory.cc"
"anf_runtime_algorithm.cc"
file(GLOB_RECURSE _SESSION_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel_graph.cc"
"session_basic.cc"
"session_factory.cc"
"anf_runtime_algorithm.cc"
)
if (ENABLE_GPU)
file(GLOB_RECURSE _GPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"gpu_session.cc"
)
#TODO : Not include session_context.cc
add_library(_mindspore_session_obj OBJECT ${_SESSION_ALL_SRC_FILES})
list(APPEND _SESSION_SRC_LIST ${_GPU_SRC_LIST})
endif ()
if(ENABLE_D)
file(GLOB_RECURSE _D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"ascend_session.cc"
)
add_library(_mindspore_session_obj OBJECT ${_D_SRC_LIST})
endif()
if (ENABLE_D)
file(GLOB_RECURSE _D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"ascend_session.cc"
)
list(APPEND _SESSION_SRC_LIST ${_D_SRC_LIST})
endif ()
if(ENABLE_GPU)
file(GLOB_RECURSE _C_EXPRESSION_GPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"gpu_session.cc"
)
add_library(_c_expression_gpu_session_obj OBJECT ${_C_EXPRESSION_GPU_SRC_LIST})
endif()
add_library(_mindspore_session_obj OBJECT ${_SESSION_SRC_LIST})

View File

@ -1,5 +1,8 @@
file(GLOB_RECURSE _TRANSFORM_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"*.cc"
)
if (ENABLE_GE OR ENABLE_D)
file(GLOB_RECURSE _TRANSFORM_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
add_library(_mindspore_transform_obj OBJECT ${_TRANSFORM_SRC_LIST})
add_library(_mindspore_transform_obj OBJECT ${_TRANSFORM_ALL_SRC_FILES})
if (NOT ENABLE_GE)
target_compile_definitions(_mindspore_transform_obj PRIVATE NO_GE_CLIENT)
endif()
endif ()

View File

@ -125,6 +125,7 @@ const char kNameSplitD[] = "Split";
const char kNameBatchToSpaceNd[] = "BatchToSpaceNd";
const char kNameFloor[] = "Floor";
const char kNameNPUGetFloatStatus[] = "NPUGetFloatStatus";
const char kNameAssign[] = "Assign";
const char kNameAssignAdd[] = "AssignAdd";
const char kNameAssignSub[] = "AssignSub";
const char kNameNPUAllocFloatStatus[] = "NPUAllocFloatStatus";
@ -1155,8 +1156,7 @@ void DfGraphConvertor::SetOpControlInput(const AnfNodePtr node) {
}
}
const std::vector<std::string> trans_var_list = {prim::kPrimAssign->name(), string(kNameAssignAdd),
string(kNameAssignSub)};
const std::vector<std::string> trans_var_list = {string(kNameAssign), string(kNameAssignAdd), string(kNameAssignSub)};
void DfGraphConvertor::SetOpInput(const OpAdapterPtr &adpt, const CNodePtr &node) {
OperatorPtr src = Convert(node);

View File

@ -1,3 +1,8 @@
file(GLOB_RECURSE _UTILS_ALL_SRC_FILES *.cc)
#TODO : "utils/node_utils.cc"
add_library(_mindspore_utils_obj OBJECT ${_UTILS_ALL_SRC_FILES})
file(GLOB_RECURSE _UTILS_SRC_LIST ./*.cc)
if (NOT ENABLE_GE)
file(GLOB_RECURSE _UTILS_GE_SRC_FILES ./callbacks_ge.cc)
list(REMOVE_ITEM _UTILS_SRC_LIST ${_UTILS_GE_SRC_FILES})
endif ()
add_library(_mindspore_utils_obj OBJECT ${_UTILS_SRC_LIST})

View File

@ -1,5 +1,2 @@
file(GLOB_RECURSE _VM_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"*.cc"
)
add_library(_mindspore_vm_obj OBJECT ${_VM_ALL_SRC_FILES})
file(GLOB_RECURSE _VM_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
add_library(_mindspore_vm_obj OBJECT ${_VM_SRC_LIST})