Moved mpi related files into mpi/ and compiling it as an extern library.
This commit is contained in:
parent
6ac423bf22
commit
fd2facb14e
7 changed files with 39 additions and 10 deletions
|
|
@ -5,7 +5,7 @@
|
|||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
######################################################################################
|
||||
### 2) Optionnal: add MPI and Boost MPI dependencies.
|
||||
### 2) Optional: add MPI and Boost MPI dependencies.
|
||||
######################################################################################
|
||||
|
||||
IF(WITH_MPI)
|
||||
|
|
@ -25,6 +25,8 @@ IF(WITH_MPI)
|
|||
ADD_DEFINITIONS(-DWITH_MPI)
|
||||
|
||||
LINK_LIBRARIES(boost_mpi boost_serialization)
|
||||
|
||||
ADD_SUBDIRECTORY(mpi)
|
||||
ENDIF()
|
||||
|
||||
######################################################################################
|
||||
|
|
@ -41,7 +43,6 @@ SET(EO_SOURCES
|
|||
eoCtrlCContinue.cpp
|
||||
eoScalarFitnessAssembled.cpp
|
||||
eoSIGContinue.cpp
|
||||
eompi.cpp
|
||||
)
|
||||
|
||||
ADD_LIBRARY(eo STATIC ${EO_SOURCES})
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@
|
|||
#include <omp.h>
|
||||
|
||||
# ifdef WITH_MPI
|
||||
# include <eompi.h>
|
||||
# include <eoParallelApply.h>
|
||||
# include <mpi/eompi.h>
|
||||
# include <mpi/eoParallelApply.h>
|
||||
# endif // WITH_MPI
|
||||
|
||||
/**
|
||||
|
|
|
|||
32
eo/src/mpi/CMakeLists.txt
Normal file
32
eo/src/mpi/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
######################################################################################
|
||||
### 2) Define the eompi target
|
||||
######################################################################################
|
||||
|
||||
SET(EOMPI_LIB_OUTPUT_PATH ${EO_BINARY_DIR}/lib)
|
||||
SET(LIBRARY_OUTPUT_PATH ${EOMPI_LIB_OUTPUT_PATH})
|
||||
|
||||
SET(EOMPI_SOURCES
|
||||
eompi.cpp
|
||||
)
|
||||
|
||||
ADD_LIBRARY(eompi STATIC ${EOMPI_SOURCES})
|
||||
INSTALL(TARGETS eompi ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||
|
||||
FILE(GLOB HDRS *.h)
|
||||
INSTALL(FILES ${HDRS} DESTINATION include/eo/mpi COMPONENT headers)
|
||||
|
||||
######################################################################################
|
||||
### 3) Optionnal
|
||||
######################################################################################
|
||||
|
||||
SET(EOMPI_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(eompi PROPERTIES VERSION "${EOMPI_VERSION}")
|
||||
|
||||
######################################################################################
|
||||
|
|
@ -31,13 +31,9 @@ class ParallelApply : public MpiJob< EOT >
|
|||
virtual void processTask( )
|
||||
{
|
||||
EOT ind;
|
||||
cout << "Receiving individual." << endl;
|
||||
MpiJob<EOT>::comm.recv( 0, 1, ind );
|
||||
cout << "Applying function." << endl;
|
||||
func( ind );
|
||||
cout << "Sending result." << endl;
|
||||
MpiJob<EOT>::comm.send( 0, 1, ind );
|
||||
cout << "Leaving processTask" << endl;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# include <eompi.h>
|
||||
# include <eoParallelApply.h>
|
||||
# include <mpi/eompi.h>
|
||||
# include <mpi/eoParallelApply.h>
|
||||
# include <iostream>
|
||||
|
||||
# include <vector>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue