Fix MPI build

This commit is contained in:
Matthias Hochsteger 2019-07-10 10:56:55 +02:00
parent 05aafdc3b6
commit b848bdc237
5 changed files with 17 additions and 7 deletions

View File

@ -287,13 +287,20 @@ if (USE_PYTHON)
endif (USE_PYTHON)
#######################################################################
add_library(netgen_mpi INTERFACE)
add_library(netgen_metis INTERFACE)
if (USE_MPI)
find_package(MPI REQUIRED)
target_include_directories(netgen_mpi INTERFACE ${MPI_CXX_INCLUDE_PATH})
target_link_libraries(netgen_mpi INTERFACE ${MPI_mpi_LIBRARY} ${MPI_CXX_LIBRARIES} )
target_compile_definitions(netgen_mpi INTERFACE PARALLEL )
find_package(METIS REQUIRED)
add_definitions(-DPARALLEL -DMETIS)
include_directories(${MPI_CXX_INCLUDE_PATH})
include_directories(${METIS_INCLUDE_DIR})
target_include_directories(netgen_metis INTERFACE ${METIS_INCLUDE_DIR})
target_link_libraries(netgen_metis INTERFACE ${METIS_LIBRARY} )
target_compile_definitions(netgen_metis INTERFACE METIS )
endif (USE_MPI)
install(TARGETS netgen_mpi netgen_metis ${NG_INSTALL_DIR})
#######################################################################
if (USE_OCC)

View File

@ -39,6 +39,7 @@ if(USE_PYTHON)
target_include_directories(ngcore PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(ngcore PRIVATE ${PYTHON_LIBRARIES})
endif(USE_PYTHON)
target_link_libraries(ngcore PUBLIC netgen_mpi)
install(FILES ngcore.hpp archive.hpp type_traits.hpp version.hpp ngcore_api.hpp logging.hpp
exception.hpp symboltable.hpp paje_trace.hpp utils.hpp profiler.hpp mpi_wrapper.hpp

View File

@ -6,6 +6,7 @@
#include <mpi.h>
#endif
#include "exception.hpp"
namespace ngcore
{
@ -191,7 +192,7 @@ namespace ngcore
};
#else
#else // PARALLEL
class MPI_Comm {
int nr;
public:
@ -240,7 +241,7 @@ namespace ngcore
void Bcast (T & s, int root = 0) const { ; }
};
#endif
#endif // PARALLEL
@ -252,5 +253,5 @@ namespace ngcore
}
#endif
#endif // NGCORE_MPIWRAPPER_HPP

View File

@ -10,6 +10,7 @@
#include <chrono>
#include "concurrentqueue.h"
#include "mpi_wrapper.hpp"
#include "paje_trace.hpp"
#include "profiler.hpp"
#include "taskmanager.hpp"

View File

@ -23,7 +23,7 @@ endif(APPLE)
target_link_libraries( mesh PUBLIC ngcore PRIVATE gprim la gen )
target_link_libraries( mesh PRIVATE ${ZLIB_LIBRARIES} ${MPI_CXX_LIBRARIES} ${PYTHON_LIBRARIES} ${METIS_LIBRARY})
target_link_libraries( mesh PRIVATE netgen_metis ${ZLIB_LIBRARIES} ${PYTHON_LIBRARIES} )
if(NOT WIN32)
install( TARGETS mesh ${NG_INSTALL_DIR})
endif(NOT WIN32)