New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 13116 for NEMO – NEMO

Changeset 13116 for NEMO


Ignore:
Timestamp:
2020-06-16T21:15:19+02:00 (4 years ago)
Author:
smasson
Message:

r4.0-HEAD: fix potential deadlock, see #2456

Location:
NEMO/releases/r4.0/r4.0-HEAD
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/releases/r4.0/r4.0-HEAD/src/OCE/stpctl.F90

    r13010 r13116  
    119119      zmax(3) = MAXVAL( -tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp )   ! minus salinity max 
    120120      zmax(4) = MAXVAL(  tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp )   !       salinity max 
    121       IF( ll_colruns ) THEN     ! following variables are used only in the netcdf file 
     121      IF( ll_colruns .OR. jpnij == 1 ) THEN     ! following variables are used only in the netcdf file 
    122122         zmax(5) = MAXVAL( -tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp )   ! minus temperature max 
    123123         zmax(6) = MAXVAL(  tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp )   !       temperature max 
     
    200200         ! 
    201201         IF( ll_colruns .or. jpnij == 1 ) THEN   ! all processes synchronized -> use lwp to print in opened ocean.output files 
    202             IF(lwp)   CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 
     202            IF(lwp) THEN   ;   CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 
     203            ELSE           ;   nstop = MAX(1, nstop)   ! make sure nstop > 0 (automatically done when calling ctl_stop) 
     204            ENDIF 
    203205         ELSE                                    ! only mpi subdomains with errors are here -> STOP now 
    204206            CALL ctl_stop( 'STOP', ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 
    205207         ENDIF 
    206208         ! 
    207          IF( nstop == 0 )   nstop = 1  
    208          ngrdstop = Agrif_Fixed() 
    209          ! 
     209      ENDIF 
     210      ! 
     211      IF( nstop > 0 ) THEN                                                  ! an error was detected and we did not abort yet... 
     212         ngrdstop = Agrif_Fixed()                                           ! store which grid got this error 
     213         IF( .NOT. ll_colruns .AND. jpnij > 1 )   CALL ctl_stop( 'STOP' )   ! we must abort here to avoid MPI deadlock 
    210214      ENDIF 
    211215      ! 
  • NEMO/releases/r4.0/r4.0-HEAD/tests/CANAL/MY_SRC/stpctl.F90

    r13010 r13116  
    119119      zmax(3) = MAXVAL( -tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp )   ! minus salinity max 
    120120      zmax(4) = MAXVAL(  tsn(:,:,:,jp_sal) , mask = tmask(:,:,:) == 1._wp )   !       salinity max 
    121       IF( ll_colruns ) THEN     ! following variables are used only in the netcdf file 
     121      IF( ll_colruns .OR. jpnij == 1 ) THEN     ! following variables are used only in the netcdf file 
    122122         zmax(5) = MAXVAL( -tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp )   ! minus temperature max 
    123123         zmax(6) = MAXVAL(  tsn(:,:,:,jp_tem) , mask = tmask(:,:,:) == 1._wp )   !       temperature max 
     
    200200         ! 
    201201         IF( ll_colruns .or. jpnij == 1 ) THEN   ! all processes synchronized -> use lwp to print in opened ocean.output files 
    202             IF(lwp)   CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 
     202            IF(lwp) THEN   ;   CALL ctl_stop( ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 
     203            ELSE           ;   nstop = MAX(1, nstop)   ! make sure nstop > 0 (automatically done when calling ctl_stop) 
     204            ENDIF 
    203205         ELSE                                    ! only mpi subdomains with errors are here -> STOP now 
    204206            CALL ctl_stop( 'STOP', ctmp1, ' ', ctmp2, ctmp3, ctmp4, ctmp5, ' ', ctmp6 ) 
    205207         ENDIF 
    206208         ! 
    207          IF( nstop == 0 )   nstop = 1  
    208          ngrdstop = Agrif_Fixed() 
    209          ! 
     209      ENDIF 
     210      ! 
     211      IF( nstop > 0 ) THEN                                                  ! an error was detected and we did not abort yet... 
     212         ngrdstop = Agrif_Fixed()                                           ! store which grid got this error 
     213         IF( .NOT. ll_colruns .AND. jpnij > 1 )   CALL ctl_stop( 'STOP' )   ! we must abort here to avoid MPI deadlock 
    210214      ENDIF 
    211215      ! 
Note: See TracChangeset for help on using the changeset viewer.