Commit 61b83d25 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Improved detection of MPI using mpicxx instead of mpic++ to catch Intel-MPI

parent 4e7cba43
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -123,10 +123,11 @@ endif()
#####
# Check for MPI -- poznej podle vraperu compileru -- da se testovat preklad bez MPI
#
if( ${CXX_COMPILER_NAME} STREQUAL "mpic++" )
if( ${CXX_COMPILER_NAME} STREQUAL "mpicxx" )
   message( "MPI compiler detected."    )
   set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_MPI" )
   set( CUDA_HOST_COMPILER "mpic++" )
   set( CUDA_HOST_COMPILER "mpicxx" )
   set( BUILD_MPI ON )
endif()

####
@@ -164,7 +165,7 @@ if( ${WITH_CUDA} )
            endif()
        endif()
        # An extra CUDA_ARCH_HOST_COMPILER variable for compiling tnl-cuda-arch alone,
        # because it SHOULD NOT be compiled using mpic++, which would cause weird
        # because it SHOULD NOT be compiled using mpicxx, which would cause weird
        # RPATH_CHANGE error in cmake.
        # FIXME: find better solution to switch between MPI-enabled and MPI-disabled binaries in cmake
        if( NOT $ENV{CUDA_ARCH_HOST_COMPILER} STREQUAL "" )
+6 −5
Original line number Diff line number Diff line
@@ -114,17 +114,18 @@ if [[ ${WITH_CLANG} == "yes" ]]; then
fi

if [[ ${WITH_MPI} == "yes" ]]; then
    if [[ ! -x  "$(command -v mpic++)" ]]; then
       echo "Warning:mpic++ is not installed on this system. MPI support is turned off." 
    # NOTE: OpenMPI provides mpic++, but Intel MPI does not
    if [[ ! -x  "$(command -v mpicxx)" ]]; then
       echo "Warning: mpicxx is not installed on this system. MPI support is turned off."
    else
       # instruct OpenMPI to use the original compiler
       # reference: https://www.open-mpi.org/faq/?category=mpi-apps#override-wrappers-after-v1.0
       # FIXME: this does not work with CUDA_HOST_COMPILER=mpic++
       # FIXME: this does not work with CUDA_HOST_COMPILER=mpicxx
#       if [ -n "$CXX" ]; then
#          export OMPI_CXX="$CXX"
#       fi
       export CXX=mpic++
       export CUDA_HOST_COMPILER=mpic++
       export CXX=mpicxx
       export CUDA_HOST_COMPILER=mpicxx
    fi
    if [[ ! -x  "$(command -v mpicc)" ]]; then
       echo "Warning: mpicc is not installed on this system." 
+27 −26
Original line number Diff line number Diff line
@@ -100,31 +100,32 @@ TARGET_LINK_LIBRARIES( tnl

INSTALL( TARGETS tnl DESTINATION lib )

IF( BUILD_MPI )

   ADD_LIBRARY( tnl-mpi_static STATIC ${tnl_SOURCES} )
   INSTALL( TARGETS tnl-mpi_static DESTINATION lib )

   if( BUILD_CUDA )
      CUDA_ADD_LIBRARY( tnl-mpi SHARED ${tnl_CUDA__SOURCES}
                        OPTIONS ${CUDA_ADD_LIBRARY_OPTIONS} )
      # the static library with CUDA support has to be built separately
      CUDA_ADD_LIBRARY( tnl-mpi-cuda_static STATIC ${tnl_CUDA__SOURCES} )
      INSTALL( TARGETS tnl-mpi-cuda_static DESTINATION lib )
   else( BUILD_CUDA )
      ADD_LIBRARY( tnl-mpi SHARED ${tnl_SOURCES} )
   endif( BUILD_CUDA )

   SET_TARGET_PROPERTIES( tnl-mpi PROPERTIES
                          VERSION ${tnlVersion} )
#   SET_TARGET_PROPERTIES( tnl-mpi
#                          LINK_INTERFACE_LIBRARIES "")


   TARGET_LINK_LIBRARIES( tnl-mpi
                          ${MPI_LIBRARIES} )
   INSTALL( TARGETS tnl-mpi DESTINATION lib )

endif()
# NOTE: this is not necessary until something in the library file actually depends on MPI
#IF( BUILD_MPI )
#
#   ADD_LIBRARY( tnl-mpi_static STATIC ${tnl_SOURCES} )
#   INSTALL( TARGETS tnl-mpi_static DESTINATION lib )
#
#   if( BUILD_CUDA )
#      CUDA_ADD_LIBRARY( tnl-mpi SHARED ${tnl_CUDA__SOURCES}
#                        OPTIONS ${CUDA_ADD_LIBRARY_OPTIONS} )
#      # the static library with CUDA support has to be built separately
#      CUDA_ADD_LIBRARY( tnl-mpi-cuda_static STATIC ${tnl_CUDA__SOURCES} )
#      INSTALL( TARGETS tnl-mpi-cuda_static DESTINATION lib )
#   else( BUILD_CUDA )
#      ADD_LIBRARY( tnl-mpi SHARED ${tnl_SOURCES} )
#   endif( BUILD_CUDA )
#
#   SET_TARGET_PROPERTIES( tnl-mpi PROPERTIES
#                          VERSION ${tnlVersion} )
##   SET_TARGET_PROPERTIES( tnl-mpi
##                          LINK_INTERFACE_LIBRARIES "")
#
#
#   TARGET_LINK_LIBRARIES( tnl-mpi
#                          ${MPI_LIBRARIES} )
#   INSTALL( TARGETS tnl-mpi DESTINATION lib )
#
#endif()

INSTALL( FILES ${headers} DESTINATION ${TNL_TARGET_INCLUDE_DIRECTORY} )
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ ADD_TEST( NAME DirectionsTest COMMAND ${EXECUTABLE_OUTPUT_PATH}/DirectionsTest${
ADD_TEST( NAME CopyEntitesTest COMMAND ${EXECUTABLE_OUTPUT_PATH}/CopyEntitesTest${CMAKE_EXECUTABLE_SUFFIX} )
ADD_TEST( NAME CutMeshFunctionTest COMMAND ${EXECUTABLE_OUTPUT_PATH}/CutMeshFunctionTest${CMAKE_EXECUTABLE_SUFFIX} )

if( ${CXX_COMPILER_NAME} STREQUAL "mpic++" )
if( BUILD_MPI )
ADD_EXECUTABLE( DistributedGridTest_1D DistributedGridTest_1D.cpp )
   TARGET_COMPILE_OPTIONS( DistributedGridTest_1D PRIVATE ${CXX_TESTS_FLAGS} )
   TARGET_LINK_LIBRARIES( DistributedGridTest_1D