Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set HYPRE_HAVE_MPI_COMM_F2C in CMake build #1101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ option(TPL_BLAS_LIBRARIES "Optional list of absolute paths to BLAS li
option(TPL_LAPACK_LIBRARIES "Optional list of absolute paths to LAPACK libraries, otherwise use FindLAPACK to locate [].")
option(TPL_FEI_INCLUDE_DIRS "List of absolute paths to FEI include directories [].")

# Autoconf style functions
include(CheckSymbolExists)

# Set config name values
if (HYPRE_ENABLE_SHARED)
set(HYPRE_SHARED ON CACHE BOOL "" FORCE)
Expand Down Expand Up @@ -632,6 +635,21 @@ if (HYPRE_USING_UMPIRE)
target_include_directories(${PROJECT_NAME} PUBLIC ${TPL_UMPIRE_INCLUDE_DIRS})
endif ()

# Set MPI compile flags
if (NOT HYPRE_SEQUENTIAL)
find_program(MPIEXEC_EXECUTABLE NAMES mpiexec mpirun)
find_package(MPI REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC MPI::MPI_C)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} MPI::MPI_C)
check_symbol_exists(MPI_Comm_f2c "mpi.h" HYPRE_HAVE_MPI_COMM_F2C)
endif (NOT HYPRE_SEQUENTIAL)

# Set OpenMP compile flags
if (HYPRE_USING_OPENMP)
find_package(OpenMP REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC OpenMP::OpenMP_C)
endif (HYPRE_USING_OPENMP)

# Configure a header file to pass CMake settings to the source code
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/config/HYPRE_config.h.cmake.in"
Expand Down Expand Up @@ -663,19 +681,6 @@ if (HYPRE_USING_SYCL)
set_source_files_properties(${HYPRE_GPU_SOURCES} PROPERTIES LANGUAGE CXX)
endif ()

# Set MPI compile flags
if (NOT HYPRE_SEQUENTIAL)
find_program(MPIEXEC_EXECUTABLE NAMES mpiexec mpirun)
find_package(MPI REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC MPI::MPI_C)
endif (NOT HYPRE_SEQUENTIAL)

# Set OpenMP compile flags
if (HYPRE_USING_OPENMP)
find_package(OpenMP REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC OpenMP::OpenMP_C)
endif (HYPRE_USING_OPENMP)

if (MSVC)
target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
if (MSVC_VERSION LESS 1928) # Visual Studio 2019 version 16.8 claims full C11 support
Expand Down
1 change: 1 addition & 0 deletions src/config/HYPREConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ set(HYPRE_WITH_UMPIRE_HOST @HYPRE_WITH_UMPIRE_HOST@)
set(HYPRE_WITH_UMPIRE_DEVICE @HYPRE_WITH_UMPIRE_DEVICE@)
set(HYPRE_WITH_UMPIRE_UM @HYPRE_WITH_UMPIRE_UM@)
set(HYPRE_WITH_UMPIRE_PINNED @HYPRE_WITH_UMPIRE_PINNED@)
set(HYPRE_HAVE_MPI_COMM_F2C @HYPRE_HAVE_MPI_COMM_F2C@)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

Expand Down
3 changes: 2 additions & 1 deletion src/config/HYPRE_config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@
/* Use MPI */
#cmakedefine HYPRE_HAVE_MPI 1

/* #undef HYPRE_HAVE_MPI_COMM_F2C */
/* Use MPI_Comm_f2c */
#cmakedefine HYPRE_HAVE_MPI_COMM_F2C 1

/* Define as follows to set the Fortran name mangling scheme:
* 0 = unspecified
Expand Down