Skip to content
Snippets Groups Projects
Commit cf9b469d authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon Committed by GitHub
Browse files

Merge pull request #267 from chuckatkins/add-experimental-findmpi

Add upstream FindMPI
parents 57a8b1f2 da22c374
No related branches found
No related tags found
No related merge requests found
Showing
with 1630 additions and 46 deletions
#------------------------------------------------------------------------------#
# Distributed under the OSI-approved Apache License, Version 2.0. See
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#
# This module is already included in new versions of CMake
if(CMAKE_VERSION VERSION_LESS 3.10)
include(${CMAKE_CURRENT_LIST_DIR}/upstream/FindMPI.cmake)
else()
include(${CMAKE_ROOT}/Modules/FindMPI.cmake)
endif()
This diff is collapsed.
program mpi_ver
@MPI_Fortran_INCLUDE_LINE@
print *, 'INFO:SUBARRAYS[', MPI_SUBARRAYS_SUPPORTED, ']-ASYNCPROT[', MPI_ASYNC_PROTECTS_NONBLOCKING, ']'
end program mpi_ver
#include <mpi.h>
#ifdef __cplusplus
#include <cstdio>
#else
#include <stdio.h>
#endif
int main(int argc, char* argv[])
{
char mpilibver_str[MPI_MAX_LIBRARY_VERSION_STRING];
int mpilibver_len;
MPI_Get_library_version(mpilibver_str, &mpilibver_len);
#ifdef __cplusplus
std::puts(mpilibver_str);
#else
puts(mpilibver_str);
#endif
}
program mpi_ver
@MPI_Fortran_INCLUDE_LINE@
character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpilibver_str
integer(kind=MPI_INTEGER_KIND) :: ierror, reslen
call MPI_GET_LIBRARY_VERSION(mpilibver_str, reslen, ierror)
print *, mpilibver_str
end program mpi_ver
program mpi_ver
@MPI_Fortran_INCLUDE_LINE@
integer(kind=kind(MPI_VERSION)), parameter :: zero = ichar('0')
character, dimension(17), parameter :: mpiver_str =&
(/ 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', '-', 'V', 'E', 'R', '[', &
char(zero + MPI_VERSION), &
'.', &
char(zero + MPI_SUBVERSION), ']' /)
print *, mpiver_str
end program mpi_ver
#include <mpi.h>
#ifdef __cplusplus
#include <cstdio>
#else
#include <stdio.h>
#endif
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
const char mpiver_str[] = { 'I', 'N',
'F', 'O',
':', 'M',
'P', 'I',
'-', 'V',
'E', 'R',
'[', ('0' + MPI_VERSION),
'.', ('0' + MPI_SUBVERSION),
']', '\0' };
#endif
int main(int argc, char* argv[])
{
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
#ifdef __cplusplus
std::puts(mpiver_str);
#else
puts(mpiver_str);
#endif
#endif
#ifdef TEST_MPI_MPICXX
MPI::MPI_Init(&argc, &argv);
MPI::MPI_Finalize();
#else
MPI_Init(&argc, &argv);
MPI_Finalize();
#endif
}
#include <mpi.h>
#include <cstdio>
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
const char mpiver_str[] = { 'I', 'N',
'F', 'O',
':', 'M',
'P', 'I',
'-', 'V',
'E', 'R',
'[', ('0' + MPI_VERSION),
'.', ('0' + MPI_SUBVERSION),
']', '\0' };
#endif
int main(int argc, char* argv[])
{
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
std::puts(mpiver_str);
#endif
MPI::MPI_Init(&argc, &argv);
MPI::MPI_Finalize();
}
program hello
@MPI_Fortran_INCLUDE_LINE@
integer@MPI_Fortran_INTEGER_LINE@ ierror
call MPI_INIT(ierror)
call MPI_FINALIZE(ierror)
end program
#include <mpi.h>
#include <cstdio>
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
const char mpiver_str[] = { 'I', 'N',
'F', 'O',
':', 'M',
'P', 'I',
'-', 'V',
'E', 'R',
'[', ('0' + MPI_VERSION),
'.', ('0' + MPI_SUBVERSION),
']', '\0' };
#endif
int main(int argc, char* argv[])
{
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
std::puts(mpiver_str);
#endif
MPI_Init(&argc, &argv);
MPI_Finalize();
}
......@@ -7,6 +7,5 @@ add_executable(globalArray_write globalArray_write.cpp)
target_link_libraries(globalArray_write adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(globalArray_write PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(globalArray_write ${MPI_C_LIBRARIES})
target_link_libraries(globalArray_write MPI::MPI_C)
endif()
......@@ -7,6 +7,5 @@ add_executable(joinedArray_write joinedArray_write.cpp)
target_link_libraries(joinedArray_write adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(joinedArray_write PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(joinedArray_write ${MPI_C_LIBRARIES})
target_link_libraries(joinedArray_write MPI::MPI_C)
endif()
......@@ -7,6 +7,5 @@ add_executable(localArray_write localArray_write.cpp)
target_link_libraries(localArray_write adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(localArray_write PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(localArray_write ${MPI_C_LIBRARIES})
target_link_libraries(localArray_write MPI::MPI_C)
endif()
......@@ -7,6 +7,5 @@ add_executable(values_write values_write.cpp)
target_link_libraries(values_write adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(values_write PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(values_write ${MPI_C_LIBRARIES})
target_link_libraries(values_write MPI::MPI_C)
endif()
......@@ -3,15 +3,11 @@
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#
add_executable(writer_multistep writer_multistep.cpp)
add_executable(reader_stepping reader_stepping.cpp)
add_executable(reader_allsteps reader_allsteps.cpp)
foreach(tgt IN ITEMS writer_multistep reader_stepping reader_allsteps)
add_executable(${tgt} ${tgt}.cpp)
target_link_libraries(${tgt} adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(${tgt} PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(${tgt} ${MPI_C_LIBRARIES})
target_link_libraries(${tgt} MPI::MPI_C)
endif()
endforeach()
if(ADIOS2_HAVE_MPI)
add_executable(helloBPWriterXML helloBPWriterXML.cpp)
target_include_directories(helloBPWriterXML PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(helloBPWriterXML ${MPI_C_LIBRARIES})
target_link_libraries(helloBPWriterXML MPI::MPI_C)
else()
add_executable(helloBPWriterXML helloBPWriterXML_nompi.cpp)
endif()
......
......@@ -5,18 +5,10 @@
if(ADIOS2_HAVE_MPI)
add_executable(heatTransfer_read_adios2 heatRead_adios2.cpp PrintData.h)
target_include_directories(heatTransfer_read_adios2
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_read_adios2 adios2 ${MPI_C_LIBRARIES})
target_link_libraries(heatTransfer_read_adios2 adios2 MPI::MPI_C)
if(ADIOS2_HAVE_ADIOS1)
add_executable(heatTransfer_read_adios1 heatRead_adios1.cpp PrintData.h)
target_include_directories(heatTransfer_read_adios1
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_read_adios1
adios1::adios ${MPI_C_LIBRARIES}
)
target_link_libraries(heatTransfer_read_adios1 adios1::adios MPI::MPI_C)
endif()
endif()
......@@ -10,11 +10,8 @@ if(ADIOS2_HAVE_MPI)
Settings.cpp
IO_adios2.cpp
)
target_include_directories(heatTransfer_write_adios2
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_write_adios2
adios2 ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
adios2 MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
target_compile_definitions(heatTransfer_write_adios2 PRIVATE
-DDEFAULT_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/config.xml
......@@ -27,11 +24,8 @@ if(ADIOS2_HAVE_MPI)
Settings.cpp
IO_adios1.cpp
)
target_include_directories(heatTransfer_write_adios1
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_write_adios1
adios1::adios ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
adios1::adios MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
endif()
......@@ -43,10 +37,10 @@ if(ADIOS2_HAVE_MPI)
IO_hdf5_a.cpp
)
target_include_directories(heatTransfer_write_hdf5
PRIVATE ${MPI_C_INCLUDE_PATH} ${HDF5_C_INCLUDE_DIRS}
PRIVATE ${HDF5_C_INCLUDE_DIRS}
)
target_link_libraries(heatTransfer_write_hdf5
${HDF5_C_LIBRARIES} ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
${HDF5_C_LIBRARIES} MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
add_executable(heatTransfer_write_ph5
......@@ -56,10 +50,10 @@ if(ADIOS2_HAVE_MPI)
IO_ph5.cpp
)
target_include_directories(heatTransfer_write_ph5
PRIVATE ${MPI_C_INCLUDE_PATH} ${HDF5_C_INCLUDE_DIRS}
PRIVATE ${HDF5_C_INCLUDE_DIRS}
)
target_link_libraries(heatTransfer_write_ph5
${HDF5_C_LIBRARIES} ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
${HDF5_C_LIBRARIES} MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
add_executable(heatTransfer_write_a2h5
......@@ -69,11 +63,8 @@ if(ADIOS2_HAVE_MPI)
IO_ph5_adios2.cpp
)
target_include_directories(heatTransfer_write_a2h5
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_write_a2h5
adios2 ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
adios2 MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
endif()
endif()
......@@ -5,8 +5,7 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_adios1Writer helloADIOS1Writer.cpp)
target_include_directories(hello_adios1Writer PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_adios1Writer ${MPI_C_LIBRARIES})
target_link_libraries(hello_adios1Writer MPI::MPI_C)
else()
add_executable(hello_adios1Writer helloADIOS1Writer_nompi.cpp)
endif()
......
......@@ -7,8 +7,7 @@ if(ADIOS2_HAVE_MPI)
find_package(MPI COMPONENTS C REQUIRED)
add_executable(hello_bpAttributeWriter helloBPAttributeWriter.cpp)
target_include_directories(hello_bpAttributeWriter PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpAttributeWriter ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpAttributeWriter MPI::MPI_C)
else()
add_executable(hello_bpAttributeWriter helloBPAttributeWriter_nompi.cpp)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment