Merge pull request !4028 from kisnwang/disable-host-mpitags/v0.7.0-beta
| @@ -38,11 +38,12 @@ endif() | |||||
| find_package(Python3) | find_package(Python3) | ||||
| include_directories(${Python3_INCLUDE_DIRS}) | include_directories(${Python3_INCLUDE_DIRS}) | ||||
| include_directories(${CMAKE_SOURCE_DIR}/third_party) | include_directories(${CMAKE_SOURCE_DIR}/third_party) | ||||
| if (ENABLE_MPI) | |||||
| include(${CMAKE_SOURCE_DIR}/cmake/external_libs/ompi.cmake) | |||||
| endif() | |||||
| if (ENABLE_CPU) | if (ENABLE_CPU) | ||||
| include(${CMAKE_SOURCE_DIR}/cmake/external_libs/mkl_dnn.cmake) | include(${CMAKE_SOURCE_DIR}/cmake/external_libs/mkl_dnn.cmake) | ||||
| if (ENABLE_MPI) | |||||
| include(${CMAKE_SOURCE_DIR}/cmake/external_libs/ompi.cmake) | |||||
| endif() | |||||
| endif() | endif() | ||||
| if (ENABLE_GPU) | if (ENABLE_GPU) | ||||
| @@ -132,24 +132,39 @@ if (ENABLE_CPU) | |||||
| endif () | endif () | ||||
| if (ENABLE_MPI) | if (ENABLE_MPI) | ||||
| install( | |||||
| TARGETS _ms_mpi | |||||
| DESTINATION ${INSTALL_BASE_DIR} | |||||
| COMPONENT mindspore | |||||
| if (ENABLE_GPU) | |||||
| install( | |||||
| TARGETS _ms_mpi | |||||
| DESTINATION ${INSTALL_BASE_DIR} | |||||
| COMPONENT mindspore | |||||
| ) | |||||
| endif () | |||||
| if (ENABLE_CPU) | |||||
| install( | |||||
| TARGETS mpi_adapter | |||||
| DESTINATION ${INSTALL_LIB_DIR} | |||||
| COMPONENT mindspore | |||||
| ) | |||||
| endif () | |||||
| file(GLOB_RECURSE MPI_LIB_LIST | |||||
| ${ompi_LIBPATH}/libmpi${CMAKE_SHARED_LIBRARY_SUFFIX}* | |||||
| ${ompi_LIBPATH}/libopen*${CMAKE_SHARED_LIBRARY_SUFFIX}* | |||||
| ) | ) | ||||
| install( | install( | ||||
| TARGETS mpi_adapter | |||||
| FILES ${MPI_LIB_LIST} | |||||
| DESTINATION ${INSTALL_LIB_DIR} | DESTINATION ${INSTALL_LIB_DIR} | ||||
| COMPONENT mindspore | COMPONENT mindspore | ||||
| ) | ) | ||||
| endif () | endif () | ||||
| if (ENABLE_GPU) | if (ENABLE_GPU) | ||||
| if (ENABLE_MPI) | |||||
| install( | install( | ||||
| TARGETS gpu_collective | TARGETS gpu_collective | ||||
| DESTINATION ${INSTALL_LIB_DIR} | DESTINATION ${INSTALL_LIB_DIR} | ||||
| COMPONENT mindspore | COMPONENT mindspore | ||||
| ) | ) | ||||
| endif () | |||||
| install( | install( | ||||
| TARGETS gpu_queue | TARGETS gpu_queue | ||||
| DESTINATION ${INSTALL_LIB_DIR} | DESTINATION ${INSTALL_LIB_DIR} | ||||
| @@ -162,7 +162,7 @@ if (ENABLE_DEBUGGER) | |||||
| endif() | endif() | ||||
| target_link_libraries(mindspore proto_input) | target_link_libraries(mindspore proto_input) | ||||
| if (ENABLE_MPI) | |||||
| if (ENABLE_MPI AND ENABLE_CPU) | |||||
| target_link_libraries(mindspore securec mindspore::flatbuffers mpi_adapter) | target_link_libraries(mindspore securec mindspore::flatbuffers mpi_adapter) | ||||
| else () | else () | ||||
| target_link_libraries(mindspore securec mindspore::flatbuffers) | target_link_libraries(mindspore securec mindspore::flatbuffers) | ||||
| @@ -18,17 +18,20 @@ if (ENABLE_CPU) | |||||
| endif () | endif () | ||||
| if (ENABLE_MPI) | if (ENABLE_MPI) | ||||
| # _ms_mpi | |||||
| file(GLOB_RECURSE MPI_SRC_LIST "cpu/mpi/mpi_adapter.cc") | |||||
| set_property(SOURCE ${MPI_SRC_LIST} | |||||
| PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEVICE) | |||||
| add_library(mpi_adapter SHARED ${MPI_SRC_LIST}) | |||||
| target_link_libraries(mpi_adapter PRIVATE mindspore::ompi) | |||||
| if (ENABLE_CPU) | |||||
| file(GLOB_RECURSE MPI_SRC_LIST "cpu/mpi/mpi_adapter.cc") | |||||
| set_property(SOURCE ${MPI_SRC_LIST} | |||||
| PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEVICE) | |||||
| add_library(mpi_adapter SHARED ${MPI_SRC_LIST}) | |||||
| target_link_libraries(mpi_adapter PRIVATE mindspore::ompi) | |||||
| endif () | |||||
| set_property(SOURCE "gpu/mpi/mpi_initializer.cc" | |||||
| PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEVICE) | |||||
| pybind11_add_module(_ms_mpi "gpu/mpi/mpi_initializer.cc") | |||||
| target_link_libraries(_ms_mpi PRIVATE mindspore::pybind11_module mindspore::ompi) | |||||
| if (ENABLE_GPU) | |||||
| set_property(SOURCE "gpu/mpi/mpi_initializer.cc" | |||||
| PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEVICE) | |||||
| pybind11_add_module(_ms_mpi "gpu/mpi/mpi_initializer.cc") | |||||
| target_link_libraries(_ms_mpi PRIVATE mindspore::pybind11_module mindspore::ompi) | |||||
| endif () | |||||
| endif () | endif () | ||||
| # gpu | # gpu | ||||