diff --git a/CMakeLists.txt b/CMakeLists.txt index 87f8e2d..c6f2bfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,18 +57,6 @@ endif() include(CheckCompilerCapabilities) include(check_intrinsic_kinds RESULT_VARIABLE found) -if (MPI MATCHES YES) - if (NOT SUPPORT_FOR_MPI_ALLOC_MEM_CPTR) - if (NOT DISABLE_MPI_LOCK MATCHES YES) - message (FATAL_ERROR - "Version of MPI is too old to support MPI_Alloc_mem() with C_PTR argument. - To use MPI use -DDISABLE_MPI_LOCK=YES." - ) - endif () - endif () -endif () - - add_subdirectory(src) add_subdirectory(doc EXCLUDE_FROM_ALL) diff --git a/ChangeLog.md b/ChangeLog.md index 906e668..1809930 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Workarounds for MPICH C_LOC missing interface (https://github.com/pmodels/mpich/issues/6691) + ## [1.10.0] - 2023-04-17 ### Added @@ -28,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.9.4] - 2023-04-12 ### Fixed - + - Formatter logic to get simulation time was broken if the default date format is used. ## [1.9.3] - 2023-01-25 @@ -118,7 +122,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Pervasive return codes for all procedures with potentially failing branch. Added as optional arguments for backward compatibility. - + ### Changed - Introduced CMake namespace. Upstream projects should now specify dependency @@ -172,7 +176,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Modified name of Pair type in gFTL maps. These are not used within pFlogger outside of their host modules, but it is more consistent with the latest gFTL-shared and may help anyone that tries to port with XLF. - + ## [1.4.1] - 2020-05-01 @@ -195,7 +199,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - minor bug in default fmt_ for MpiFormatter "rank" should have been "mpi_rank". - + ## [1.3.6] - 2020-04-16 ### Fixed @@ -207,7 +211,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Mostly workarounds for gFortran - Also corrections for Cmake for some configurations - + ## [1.3.4] - 2020-04-08 ### Added @@ -217,13 +221,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - A problem with link-time dependency injection for mock MPI was fixed with generator expressions. Previously the fix for tests broke the examples - + ## [1.3.3] - 2020-04-06 ### Changed - Must use true/false instead of .true./.false. for YAML - + ### Fixed - Fixed CMake test for support of MPI_ALLOC_MEM - Improved Cmake handling of mock to allow tests to compile @@ -245,10 +249,10 @@ Bugfix ### Added ### Changed - + ### Fixed - Needed to enable cmake testing. - + ## [1.3.0] - 2020-03-11 ### Added @@ -263,9 +267,9 @@ Bugfix . eliminates redundant code . makes container types are consistent across projects - Now uses yafyaml for YAML processing (much more complete YAML subset) - + ### Fixed - + ## [1.2.0] - 2018-12-18 Releasing as open source. @@ -273,11 +277,11 @@ Releasing as open source. - including NOSA COPYRIGHT (soon to be changed to Apache) - including LICENSE - adding forgotten compiler-specific cmake files (oops) - + ## [1.1.0] - 2018-08-08 Mists of time ... - + ## [1.0.0] - 2018-08-03 - + Mists of time ... diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 50ecce9..0abd495 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,16 +46,13 @@ set(SRCS FormatTokenVector.F90 ) -if (MPI_FOUND) +if (MPI_FOUND) list (APPEND SRCS MpiFilter.F90 MpiFormatter.F90 MpiCommConfig.F90 + MpiLock.F90 ) - if (SUPPORT_FOR_MPI_ALLOC_MEM_CPTR) - list (APPEND SRCS MpiLock.F90) - endif () - endif () set (bin ${CMAKE_CURRENT_BINARY_DIR} ) @@ -73,6 +70,9 @@ if (MPI_FOUND) target_link_libraries (${this} PRIVATE $) target_compile_definitions(${this} PRIVATE _LOGGER_USE_MPI) + if (SUPPORT_FOR_MPI_ALLOC_MEM_CPTR) + target_compile_definitions(${this} PRIVATE SUPPORT_FOR_MPI_ALLOC_MEM_CPTR) + endif () endif () @@ -100,10 +100,10 @@ if (MPI_FOUND) else () target_link_libraries (pflogger PRIVATE MPI::MPI_Fortran) endif () - + endif() - + set (dest "PFLOGGER-${PFLOGGER_VERSION_MAJOR}.${PFLOGGER_VERSION_MINOR}") target_include_directories(${this} PUBLIC diff --git a/src/MpiLock.F90 b/src/MpiLock.F90 index 70cb7a8..7be86e2 100644 --- a/src/MpiLock.F90 +++ b/src/MpiLock.F90 @@ -58,13 +58,13 @@ subroutine init(this, rc) integer :: status integer :: sizeof_logical - integer(kind=MPI_ADDRESS_KIND) :: sz + integer(kind=MPI_ADDRESS_KIND) :: sz, int64handle integer :: old_comm if (this%is_initialized()) then _RETURN(_SUCCESS,rc) endif - + old_comm = this%comm call MPI_Comm_dup(old_comm, this%comm, status) _VERIFY(status,'',rc) @@ -96,8 +96,14 @@ subroutine init(this, rc) call MPI_Type_extent(MPI_LOGICAL, sizeof_logical, status) _VERIFY(status,'',rc) sz = this%npes * sizeof_logical +#if defined(SUPPORT_FOR_MPI_ALLOC_MEM_CPTR) call MPI_Alloc_mem(sz, MPI_INFO_NULL, this%locks_ptr, status) _VERIFY(status,'',rc) +#else + call MPI_Alloc_mem(sz, MPI_INFO_NULL, int64handle, status) + _VERIFY(status,'',rc) + this%locks_ptr = transfer(int64handle, this%locks_ptr) +#endif call c_f_pointer(this%locks_ptr, scratchpad, [this%npes]) scratchpad = .false. @@ -190,7 +196,7 @@ subroutine release(this, rc) end if end do end if - + if (next_rank /= -1) then call MPI_Send(buffer, 0, MPI_LOGICAL, next_rank, & & LOCK_TAG, this%comm, status) diff --git a/src/pflogger.F90 b/src/pflogger.F90 index eaa6aae..c2ae720 100644 --- a/src/pflogger.F90 +++ b/src/pflogger.F90 @@ -13,11 +13,9 @@ module pflogger use PFL_FastFormatter use PFL_WrapArray #ifdef _LOGGER_USE_MPI -# ifdef SUPPORT_FOR_MPI_ALLOC_MEM_CPTR use PFL_MpiLock use PFL_MpiFilter use PFL_MpiFormatter -# endif #endif use PFL_RotatingFileHandler use gFTL2_StringUnlimitedMap @@ -58,12 +56,10 @@ module pflogger public :: finalize_severity_levels #ifdef _LOGGER_USE_MPI -# ifdef SUPPORT_FOR_MPI_ALLOC_MEM_CPTR public :: MpiLock public :: MpiFilter public :: MpiFormatter -# endif -#endif +#endif public :: set_throw_fptr public :: StringUnlimitedMap @@ -77,7 +73,7 @@ subroutine initialize() call set_last_resort(StreamHandler()) end subroutine initialize - + subroutine finalize()