Skip to content

Commit

Permalink
Merge pull request #312 from GEOS-ESM/hotfix/mathomp4/#258-suppress-m…
Browse files Browse the repository at this point in the history
…pifinalize-errors

Fixes #258. Suppress MPI_Finalize errors
  • Loading branch information
tclune authored Apr 15, 2020
2 parents a4fc845 + 8ca9f4b commit 8dd1cd4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.6] - 2020-04-15

### Fixed

- Added code to suppress (seemingly) spurious MPI_Finalize errors at end
of model run. Suppression does not happen if built with
`-DCMAKE_BUILD_TYPE=Debug`

## [2.0.5] - 2020-04-13

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions MAPL_Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ esma_add_library(${this} SRCS ${srcs} DEPENDENCIES GMAO_pFIO MAPL_cfio_r4 gftl-s
target_compile_options (${this} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:${OpenMP_Fortran_FLAGS}>)
target_compile_definitions (${this} PRIVATE TWO_SIDED_COMM MAPL_MODE)

if (NOT (CMAKE_BUILD_TYPE MATCHES Debug))
target_compile_definitions(${this} PRIVATE BUILD_TYPE_IS_NOT_DEBUG)
endif ()

# Kludge for OSX security and DYLD_LIBRARY_PATH ...
foreach(dir ${OSX_EXTRA_LIBRARY_PATH})
target_link_libraries(${this} PUBLIC "-Xlinker -rpath -Xlinker ${dir}")
Expand Down
7 changes: 7 additions & 0 deletions MAPL_Base/MAPL_Cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,13 @@ subroutine finalize_mpi(this, unusable, rc)
_UNUSED_DUMMY(unusable)

if (.not. this%mpi_already_initialized) then
#ifdef BUILD_TYPE_IS_NOT_DEBUG
! Intel MPI at NCCS seems to have spurious MPI_Finalize errors that do
! not affect the answer or even the finalize step. This call suppresses
! the errors.
call MPI_Comm_set_errhandler(this%comm_world,MPI_ERRORS_RETURN,ierror)
_VERIFY(ierror)
#endif
call MPI_Finalize(ierror)
_VERIFY(ierror)
end if
Expand Down

0 comments on commit 8dd1cd4

Please sign in to comment.