diff --git a/src/driver/mpas_subdriver.F b/src/driver/mpas_subdriver.F index 1538be4d2d04..90217ad80d1c 100644 --- a/src/driver/mpas_subdriver.F +++ b/src/driver/mpas_subdriver.F @@ -366,18 +366,19 @@ subroutine mpas_finalize() call mpas_timer_write() call mpas_timer_finalize(domain_ptr) + ! + ! Finalize infrastructure + ! + call MPAS_stream_mgr_finalize(domain_ptr % streamManager) + ! Print out log stats and close log file - ! (do this after timer stats are printed) + ! (Do this after timer stats are printed and stream mgr finalized, + ! but before framework is finalized because domain is destroyed there.) call mpas_log_finalize(iErr) if ( iErr /= 0 ) then call mpas_dmpar_global_abort('ERROR: Log finalize failed for core ' // trim(domain_ptr % core % coreName)) end if - ! - ! Finalize infrastructure - ! - call MPAS_stream_mgr_finalize(domain_ptr % streamManager) - call mpas_framework_finalize(domain_ptr % dminfo, domain_ptr) deallocate(corelist % domainlist) diff --git a/src/framework/mpas_stream_manager.F b/src/framework/mpas_stream_manager.F index 431998861e39..c62ce2d4b8fa 100644 --- a/src/framework/mpas_stream_manager.F +++ b/src/framework/mpas_stream_manager.F @@ -1470,7 +1470,6 @@ logical function MPAS_stream_mgr_ringing_alarms(manager, streamID, direction, ie end if end if - if ( threadNum == 0 ) then if (local_direction == MPAS_STREAM_INPUT .or. local_direction == MPAS_STREAM_INPUT_OUTPUT) then if (associated(stream)) then @@ -1743,7 +1742,7 @@ end subroutine MPAS_stream_mgr_set_property_logical !}}} !----------------------------------------------------------------------- ! routine MPAS_stream_mgr_get_property_int ! - !> \brief Sets a property of a stream in an MPAS stream manager. + !> \brief Gets a property of a stream in an MPAS stream manager. !> \author Michael Duda, Doug Jacobsen !> \date 13 June 2014 !> \details @@ -1807,7 +1806,7 @@ end subroutine MPAS_stream_mgr_get_property_int !}}} !----------------------------------------------------------------------- ! routine MPAS_stream_mgr_get_property_char ! - !> \brief Sets a property of a stream in an MPAS stream manager. + !> \brief Gets a property of a stream in an MPAS stream manager. !> \author Michael Duda, Doug Jacobsen !> \date 13 June 2014 !> \details @@ -1917,7 +1916,7 @@ end subroutine MPAS_stream_mgr_get_property_char !}}} !----------------------------------------------------------------------- ! routine MPAS_stream_mgr_get_property_logical ! - !> \brief Sets a property of a stream in an MPAS stream manager. + !> \brief Gets a property of a stream in an MPAS stream manager. !> \author Michael Duda, Doug Jacobsen !> \date 13 June 2014 !> \details @@ -2994,7 +2993,7 @@ subroutine write_stream(manager, stream, blockID, timeLevel, mgLevel, forceWrite ! Look for exact record (in the case of overwriting) ! This also gets the number of records in the file. stream % nRecords = MPAS_seekStream(stream % stream, now_string, MPAS_STREAM_EXACT_TIME, actualWhen, maxRecords, local_ierr) - STREAM_DEBUG_WRITE(' -- Seeked record is: $i with current records equal to $i and an error of $i' COMMA intArgs=(/stream % nRecords COMMA maxRecords, local_ierr/)) + STREAM_DEBUG_WRITE(' -- Seeked record is: $i with current records equal to $i and an error of $i' COMMA intArgs=(/stream % nRecords COMMA maxRecords COMMA local_ierr/)) if ( stream % nRecords == 0 ) then ! If we didn't find an exact time, set record to point to the end of the file. @@ -3079,7 +3078,6 @@ subroutine write_stream(manager, stream, blockID, timeLevel, mgLevel, forceWrite ! Look for exact record (in the case of overwriting) ! This also gets the number of records in the file. stream % nRecords = MPAS_seekStream(stream % stream, now_string, MPAS_STREAM_EXACT_TIME, actualWhen, maxRecords, local_ierr) - STREAM_DEBUG_WRITE(' -- Seeked record is: ' COMMA stream % nRecords COMMA ' with current records equal to ' COMMA maxRecords COMMA ' and an error of ' COMMA local_ierr) STREAM_DEBUG_WRITE(' -- Seeked record is: $i with current records equal to $i and an error of $i' COMMA intArgs=(/stream % nRecords COMMA maxRecords COMMA local_ierr/)) if ( stream % nRecords == 0 ) then @@ -5914,7 +5912,6 @@ subroutine stream_mgr_add_pkg_c(manager_c, streamID_c, package_c, ierr_c) bind(c type (MPAS_streamManager_type), pointer :: manager character(len=StrKIND) :: streamID, package - integer :: idirection integer :: ierr