Added MPI operators to cmake

This commit is contained in:
Simon Layton
2017-01-04 15:06:20 -05:00
parent 05fa16a7aa
commit ae62e15f87
4 changed files with 35 additions and 2 deletions

View File

@ -33,7 +33,7 @@ add_subdirectory(db)
# add_subdirectory(experiments) # note, we may remove this folder at some point
add_subdirectory(image)
add_subdirectory(mkl)
# add_subdirectory(mpi)
add_subdirectory(mpi)
add_subdirectory(operators)
# add_subdirectory(proto) # note, proto is processed above already.
# add_subdirectory(python)

28
caffe2/mpi/CMakeLists.txt Normal file
View File

@ -0,0 +1,28 @@
if(USE_MPI)
set(Caffe2_MPI_CPU_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_common.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_ops.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_python.cc"
)
set(Caffe2_MPI_GPU_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_ops_gpu.cc"
)
set(Caffe2_MPI_CPU_TEST_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_test.cc"
)
set(Caffe2_MPI_GPU_TEST_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_gpu_test.cc"
)
# pass up to calling script
set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS} ${Caffe2_MPI_CPU_SRC})
set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS} PARENT_SCOPE)
set(Caffe2_GPU_SRCS ${Caffe2_GPU_SRCS} ${Caffe2_MPI_GPU_SRC})
set(Caffe2_GPU_SRCS ${Caffe2_GPU_SRCS} PARENT_SCOPE)
set(Caffe2_CPU_TEST_SRCS ${Caffe2_CPU_TEST_SRCS} ${Caffe2_MPI_CPU_TEST_SRC})
set(Caffe2_CPU_TEST_SRCS ${Caffe2_CPU_TEST_SRCS} PARENT_SCOPE)
set(Caffe2_GPU_TEST_SRCS ${Caffe2_GPU_TEST_SRCS} ${Caffe2_MPI_GPU_TEST_SRC})
set(Caffe2_GPU_TEST_SRCS ${Caffe2_GPU_TEST_SRCS} PARENT_SCOPE)
else()
message(STATUS "MPI operators skipped due to no MPI support")
endif()

View File

@ -1,7 +1,7 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "caffe2/caffe2/mpi/mpi_common.h"
#include "caffe2/mpi/mpi_common.h"
namespace caffe2 {

View File

@ -116,6 +116,11 @@ include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/third_party/pybind11/include)
if(USE_MPI)
find_package(MPI)
if(MPI_CXX_FOUND)
message(STATUS "MPI support found")
message(STATUS "MPI compile flags: " ${MPI_CXX_COMPILE_FLAGS})
message(STATUS "MPI include path: " ${MPI_CXX_INCLUDE_PATH})
message(STATUS "MPI LINK flags path: " ${MPI_CXX_LINK_FLAGS})
message(STATUS "MPI libraries: " ${MPI_CXX_LIBRARIES})
include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
list(APPEND Caffe2_LINKER_LIBS ${MPI_CXX_LIBRARIES})
set(CMAKE_EXE_LINKER_FLAGS ${MPI_CXX_LINK_FLAGS})