Skip to content

Commit

Permalink
Merge pull request #328 from NCAR/nagfix
Browse files Browse the repository at this point in the history
  • Loading branch information
hkershaw-brown committed Feb 11, 2022
2 parents 3916c82 + c46c43f commit 2b92b63
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 36 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ individual files.

The changes are now listed with the most recent at the top.

**February 11 2022 :: Bug-fix for nag compiler. Tag v9.13.2**

- Bug-fix for fixsystem preprocessing for NAG compiler

**February 7 2022 :: CM1 and 3D Cartesian location_mod updates. Tag v9.13.1**

*Contributed by Jon Labriola*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ subroutine set_up_ens_distribution(ens_handle)
per_pe = ens_handle%num_vars / num_pes
if (per_pe >= (huge(i)-100) ) then
suggest_pes = ( ens_handle%num_vars / (huge(i)) ) * 2
write(msgstring, '(A,I5,X,A)') &
write(msgstring, '(A,I5,1X,A)') &
'not enough MPI tasks for the model size, suggest at least ' , &
suggest_pes, 'tasks'
call error_handler(E_ERR, 'set_up_ens_distribution', msgstring, source)
Expand Down
46 changes: 31 additions & 15 deletions assimilation_code/modules/utilities/mpi_utilities_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module mpi_utilities_mod
E_ERR, E_WARN, E_MSG, E_DBG, get_unit, close_file, &
set_output, set_tasknum, initialize_utilities, &
finalize_utilities, &
nmlfileunit, do_output, do_nml_file, do_nml_term, &
nmlfileunit, do_nml_file, do_nml_term, &
find_namelist_in_file, check_namelist_read

use time_manager_mod, only : time_type, get_time, set_time
Expand All @@ -52,24 +52,40 @@ module mpi_utilities_mod

use mpi

! the NAG compiler needs these special definitions enabled

! We build on case-insensitive systems so we cannot reliably
! count on having the build system run the fortran preprocessor
! since the usual distinction is between bob.F90 and bob.f90
! to decide what needs preprocessing. instead we utilize a
! script we provide called 'fixsystem' which looks for the
! special XXX_BLOCK_EDIT comment lines and comments the blocks
! in and out depending on the target compiler.

! the NAG compiler needs these special definitions enabled.
! the #ifdef lines are only there in case someday we can use
! the fortran preprocessor. they need to stay commented out.

! !!NAG_BLOCK_EDIT START COMMENTED_OUT
! !#ifdef __NAG__
!
! use F90_unix_proc, only : sleep, system, exit
!! block for NAG compiler
! PURE SUBROUTINE SLEEP(SECONDS,SECLEFT)
! INTEGER,INTENT(IN) :: SECONDS
! INTEGER,OPTIONAL,INTENT(OUT) :: SECLEFT
!
! SUBROUTINE SYSTEM(STRING,STATUS,ERRNO)
! CHARACTER*(*),INTENT(IN) :: STRING
! INTEGER,OPTIONAL,INTENT(OUT) :: STATUS,ERRNO
!
!!also used in exit_all outside this module
! SUBROUTINE EXIT(STATUS)
! INTEGER,OPTIONAL :: STATUS
!! end block
!
! !! NAG only needs the use statement above, but
! !! these are the calling sequences if you need
! !! to use these routines additional places in code.
! ! PURE SUBROUTINE SLEEP(SECONDS,SECLEFT)
! ! INTEGER,INTENT(IN) :: SECONDS
! ! INTEGER,OPTIONAL,INTENT(OUT) :: SECLEFT
! !
! ! SUBROUTINE SYSTEM(STRING,STATUS,ERRNO)
! ! CHARACTER*(*),INTENT(IN) :: STRING
! ! INTEGER,OPTIONAL,INTENT(OUT) :: STATUS,ERRNO
! !
! !!also used in exit_all outside this module
! ! SUBROUTINE EXIT(STATUS)
! ! INTEGER,OPTIONAL :: STATUS
! !! end block
!
! !#endif
! !!NAG_BLOCK_EDIT END COMMENTED_OUT

Expand Down
49 changes: 32 additions & 17 deletions assimilation_code/modules/utilities/null_mpi_utilities_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,40 @@ module mpi_utilities_mod
initialize_utilities, finalize_utilities
use time_manager_mod, only : time_type, set_time

! the NAG compiler needs these special definitions enabled
! We build on case-insensitive systems so we cannot reliably
! count on having the build system run the fortran preprocessor
! since the usual distinction is between bob.F90 and bob.f90
! to decide what needs preprocessing. instead we utilize a
! script we provide called 'fixsystem' which looks for the
! special XXX_BLOCK_EDIT comment lines and comments the blocks
! in and out depending on the target compiler.

! the NAG compiler needs these special definitions enabled.
! the #ifdef lines are only there in case someday we can use
! the fortran preprocessor. they need to stay commented out.

! !!NAG_BLOCK_EDIT START COMMENTED_OUT
!#ifdef __NAG__
!use F90_unix_proc, only : sleep, system, exit
!! block for NAG compiler
! PURE SUBROUTINE SLEEP(SECONDS,SECLEFT)
! INTEGER,INTENT(IN) :: SECONDS
! INTEGER,OPTIONAL,INTENT(OUT) :: SECLEFT
!
! SUBROUTINE SYSTEM(STRING,STATUS,ERRNO)
! CHARACTER*(*),INTENT(IN) :: STRING
! INTEGER,OPTIONAL,INTENT(OUT) :: STATUS,ERRNO
!
!!also used in exit_all outside this module
! SUBROUTINE EXIT(STATUS)
! INTEGER,OPTIONAL :: STATUS
!! end block
!#endif
! !#ifdef __NAG__
!
! use F90_unix_proc, only : sleep, system, exit
!
! !! NAG only needs the use statement above, but
! !! these are the calling sequences if you need
! !! to use these routines additional places in code.
! ! PURE SUBROUTINE SLEEP(SECONDS,SECLEFT)
! ! INTEGER,INTENT(IN) :: SECONDS
! ! INTEGER,OPTIONAL,INTENT(OUT) :: SECLEFT
! !
! ! SUBROUTINE SYSTEM(STRING,STATUS,ERRNO)
! ! CHARACTER*(*),INTENT(IN) :: STRING
! ! INTEGER,OPTIONAL,INTENT(OUT) :: STATUS,ERRNO
! !
! !!also used in exit_all outside this module
! ! SUBROUTINE EXIT(STATUS)
! ! INTEGER,OPTIONAL :: STATUS
! !! end block
!
! !#endif
! !!NAG_BLOCK_EDIT END COMMENTED_OUT


Expand Down
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
author = 'Data Assimilation Research Section'

# The full version, including alpha/beta/rc tags
release = '9.13.1'
release = '9.13.2'
master_doc = 'README'

# -- General configuration ---------------------------------------------------
Expand Down
7 changes: 5 additions & 2 deletions developer_tests/mpi_utilities/tests/ftest_mpi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ program ftest_mpi

use mpi

! the NAG compiler needs these special definitions enabled
! the NAG compiler needs these special definitions enabled.
! the 'fixsystem' script in the assimilation_code/modules/utilities dir
! should fix this for you. please leave the BLOCK comment lines unchanged.

! !!NAG_BLOCK_EDIT START COMMENTED_OUT
! !#ifdef __NAG__
!
! use F90_unix_proc, only : sleep, system, exit
!
! !! these are the calling sequences for NAG compiler
! ! PURE SUBROUTINE SLEEP(SECONDS,SECLEFT)
! ! INTEGER,INTENT(IN) :: SECONDS
Expand All @@ -36,7 +38,8 @@ program ftest_mpi
! ! SUBROUTINE EXIT(STATUS)
! ! INTEGER,OPTIONAL :: STATUS
! !! end block
! !#endif
!
! !#endif
! !!NAG_BLOCK_EDIT END COMMENTED_OUT

implicit none
Expand Down

0 comments on commit 2b92b63

Please sign in to comment.