Skip to content

Commit

Permalink
Make a module mpicomm to store MPI_COMM_WW3
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsexton03 committed Jun 24, 2024
1 parent 14e6bed commit 1ef96e9
Show file tree
Hide file tree
Showing 17 changed files with 239 additions and 119 deletions.
48 changes: 24 additions & 24 deletions model/bin/build_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ create_file_list()
prop=
sourcet="w3parall w3triamd w3gridmd $stx $flx $nlx $btx $is $uostmd"
IO='w3iogrmd'
aux="constants w3servmd w3arrymd w3dispmd w3gsrumd w3timemd w3nmlgridmd $pdlibyow $memcode"
aux="constants mpicomm w3servmd w3arrymd w3dispmd w3gsrumd w3timemd w3nmlgridmd $pdlibyow $memcode"
if [ "$scrip" = 'SCRIP' ]
then
aux="$aux scrip_constants scrip_grids scrip_iounitsmod"
Expand All @@ -819,42 +819,42 @@ create_file_list()
prop=
sourcet="$pdlibcode $pdlibyow $db $tr $trx $bt $setupcode $stx $flx $nlx $btx $is wmmdatmd w3parall $uostmd"
IO='w3iogrmd w3iorsmd'
aux="constants w3triamd w3servmd w3arrymd w3dispmd w3gsrumd w3timemd" ;;
aux="constants mpicomm w3triamd w3servmd w3arrymd w3dispmd w3gsrumd w3timemd" ;;
ww3_bound)
core=
data="w3adatmd $memcode w3gdatmd w3wdatmd w3idatmd w3odatmd"
prop="$smcm"
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode $tr $trx $stx $nlx $btx $is wmmdatmd w3parall w3triamd $uostmd"
IO='w3iobcmd w3iogrmd w3dispmd w3gsrumd'
aux="constants w3servmd w3timemd w3arrymd w3cspcmd w3nmlboundmd" ;;
aux="constants mpicomm w3servmd w3timemd w3arrymd w3cspcmd w3nmlboundmd" ;;
ww3_bounc)
core=
data="w3adatmd $memcode w3gdatmd w3wdatmd w3idatmd w3odatmd"
prop="$smcm"
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode $stx $nlx $btx $is wmmdatmd w3parall w3triamd $uostmd"
IO='w3iobcmd w3iogrmd w3dispmd w3gsrumd'
aux="constants w3servmd w3arrymd w3timemd w3cspcmd w3nmlbouncmd" ;;
aux="constants mpicomm w3servmd w3arrymd w3timemd w3cspcmd w3nmlbouncmd" ;;
ww3_prep)
core='w3fldsmd'
data="$memcode w3gdatmd w3adatmd w3idatmd w3odatmd w3wdatmd wmmdatmd"
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode w3triamd $stx $flx $nlx $btx $is $uostmd"
IO="w3iogrmd $oasismd $agcmmd $ogcmmd $igcmmd"
aux="constants w3servmd w3timemd $tidecode w3arrymd w3dispmd w3gsrumd w3parall" ;;
aux="constants mpicomm w3servmd w3timemd $tidecode w3arrymd w3dispmd w3gsrumd w3parall" ;;
ww3_prnc)
core='w3fldsmd'
data="$memcode w3gdatmd w3adatmd w3idatmd w3odatmd w3wdatmd wmmdatmd"
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode w3triamd $stx $flx $nlx $btx $is w3parall $uostmd"
IO="w3iogrmd $oasismd $agcmmd $ogcmmd $igcmmd"
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd w3tidemd w3nmlprncmd" ;;
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd w3tidemd w3nmlprncmd" ;;
ww3_prtide)
core='w3fldsmd'
data="wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
prop="$pr $smcm"
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode w3triamd $stx $nlx $btx $is w3parall $uostmd"
IO="w3iogrmd $oasismd $agcmmd $ogcmmd $igcmmd"
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd $tidecode" ;;
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd $tidecode" ;;
ww3_shel)
core='w3fldsmd w3initmd w3wavemd w3wdasmd w3updtmd'
data="wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
Expand All @@ -863,7 +863,7 @@ create_file_list()
sourcet="$sourcet $is $db $tr $bs $refcode $igcode w3parall $uostmd"
IO="w3iogrmd w3iogomd w3iopomd w3iotrmd w3iorsmd w3iobcmd $oasismd $agcmmd $ogcmmd $igcmmd"
IO="$IO w3iosfmd w3partmd"
aux="constants w3servmd w3timemd $tidecode w3arrymd w3dispmd w3cspcmd w3gsrumd"
aux="constants mpicomm w3servmd w3timemd $tidecode w3arrymd w3dispmd w3cspcmd w3gsrumd"
aux="$aux w3nmlshelmd $pdlibyow" ;;
ww3_multi|ww3_multi_esmf)
if [ "$prog" = "ww3_multi" ]
Expand All @@ -879,7 +879,7 @@ create_file_list()
sourcet="$pdlibcode $pdlibyow $setupcode w3parall w3triamd w3srcemd $dsx $flx $ln $st $nl $bt $ic $is $db $tr $bs $refcode $igcode $uostmd"
IO='w3iogrmd w3iogomd w3iopomd wmiopomd'
IO="$IO w3iotrmd w3iorsmd w3iobcmd w3iosfmd w3partmd $oasismd $agcmmd $ogcmmd $igcmmd"
aux="constants $tidecode w3servmd w3timemd w3arrymd w3dispmd w3cspcmd w3gsrumd $mprfaux"
aux="constants mpicomm $tidecode w3servmd w3timemd w3arrymd w3dispmd w3cspcmd w3gsrumd $mprfaux"
aux="$aux wmunitmd w3nmlmultimd"
if [ "$scrip" = 'SCRIP' ]
then
Expand All @@ -899,7 +899,7 @@ create_file_list()
sourcet="$pdlibcode $pdlibyow w3triamd w3srcemd $dsx $flx $ln $st $nl $bt $db $tr $bs $refcode $igcode $is $ic $uostmd"
IO='w3iogrmd w3iogomd w3iopomd wmiopomd'
IO="$IO w3iotrmd w3iorsmd w3iobcmd w3iosfmd w3partmd $oasismd $agcmmd $ogcmmd $igcmmd"
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3cspcmd w3gsrumd $mprfaux $tidecode"
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3cspcmd w3gsrumd $mprfaux $tidecode"
aux="$aux wmunitmd w3nmlmultimd"
if [ "$scrip" = 'SCRIP' ]
then
Expand All @@ -917,104 +917,104 @@ create_file_list()
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode $tr $trx $stx $flx $nlx $btx $is $uostmd"
IO='w3iogrmd w3iogomd'
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="$aux" ;;
ww3_ounf)
core='w3initmd'
data="wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode w3parall w3triamd $stx $flx $nlx $btx $is $uostmd"
IO='w3iogrmd w3iogomd w3iorsmd w3iopomd'
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="$aux w3nmlounfmd $smco w3ounfmetamd w3metamd" ;;
ww3_outp)
core=
data="wmmdatmd w3parall w3triamd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
prop=
sourcet="$pdlibcode $pdlibyow $setupcode $flx $ln $st $nl $bt $ic $is $db $tr $bs $igcode $uostmd"
IO='w3bullmd w3iogrmd w3iopomd w3partmd'
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" ;;
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" ;;
ww3_ounp)
core=
data="wmmdatmd w3parall w3triamd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
prop=
sourcet="$pdlibcode $pdlibyow $setupcode $flx $ln $st $nl $bt $ic $is $db $tr $bs $igcode $uostmd"
IO='w3bullmd w3iogrmd w3iopomd w3partmd'
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="$aux w3nmlounpmd" ;;
ww3_trck)
core=
data="$memcode w3gdatmd w3odatmd"
prop=
sourcet=
IO=
aux="constants w3servmd w3timemd w3gsrumd" ;;
aux="constants mpicomm w3servmd w3timemd w3gsrumd" ;;
ww3_trnc)
core=
data="$memcode w3gdatmd w3odatmd"
prop=
sourcet=
IO=
aux="constants w3servmd w3timemd w3gsrumd w3nmltrncmd" ;;
aux="constants mpicomm w3servmd w3timemd w3gsrumd w3nmltrncmd" ;;
ww3_grib)
core=
data="w3parall wmmdatmd w3triamd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode $stx $flx $nlx $btx $is $uostmd"
IO='w3iogrmd w3iogomd'
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="$aux" ;;
ww3_gspl)
core='w3fldsmd'
data="$memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode wmmdatmd w3parall w3triamd $stx $flx $nlx $btx $is $uostmd"
IO="w3iogrmd $oasismd $agcmmd $ogcmmd $igcmmd"
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd $tidecode" ;;
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd $tidecode" ;;
ww3_gint)
core=
data="w3parall wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
IO='w3iogrmd w3iogomd'
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $st $nl $is $uostmd"
aux="constants w3triamd w3servmd w3arrymd w3dispmd w3timemd w3gsrumd"
aux="constants mpicomm w3triamd w3servmd w3arrymd w3dispmd w3timemd w3gsrumd"
aux="$aux" ;;
gx_outf)
core=
data="$memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode wmmdatmd w3parall w3triamd $stx $flx $nlx $btx $tr $bs $is $uostmd"
IO='w3iogrmd w3iogomd'
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="$aux" ;;
gx_outp)
core=
data="$memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd"
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode wmmdatmd w3parall w3triamd $ln $flx $st $nlx $btx $tr $bs $is $ic $uostmd"
IO='w3iogrmd w3iopomd'
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" ;;
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" ;;
ww3_systrk)
core='w3strkmd'
data="$memcode w3gdatmd w3adatmd w3idatmd w3odatmd w3wdatmd"
prop=
sourcet="$pdlibcode $pdlibyow $db $bt $setupcode wmmdatmd w3dispmd w3triamd $ln $stx $flx $nlx $btx $tr $bs $is $uostmd"
IO=
aux="constants w3servmd w3timemd w3arrymd w3gsrumd w3parall" ;;
aux="constants mpicomm w3servmd w3timemd w3arrymd w3gsrumd w3parall" ;;
libww3|libww3.so)
core='w3fldsmd w3initmd w3wavemd w3wdasmd w3updtmd'
data='wmmdatmd w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd'
prop="$pr $smcm"
sourcet="w3triamd w3srcemd $dsx $flx $ln $st $nl $bt $ic $is $db $tr $bs $refcode $igcode $uostmd"
IO='w3iogrmd w3iogomd w3iopomd w3iotrmd w3iorsmd w3iobcmd w3iosfmd w3partmd'
aux="constants w3servmd w3timemd $tidecode w3arrymd w3dispmd w3cspcmd w3gsrumd" ;;
aux="constants mpicomm w3servmd w3timemd $tidecode w3arrymd w3dispmd w3cspcmd w3gsrumd" ;;
ww3_uprstr)
core=
data='wmmdatmd w3triamd w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd'
prop=
sourcet="$memcode $pdlibcode $pdlibyow $flx $ln $st $nl $bt $ic $is $db $tr $bs $uostmd"
IO='w3iogrmd w3iogomd w3iorsmd'
aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="constants mpicomm w3servmd w3timemd w3arrymd w3dispmd w3gsrumd"
aux="$aux w3parall w3nmluprstrmd" ;;
esac

Expand Down
6 changes: 5 additions & 1 deletion model/src/PDLIB/yowdatapool.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
!
!> Has fancy data
module yowDatapool
use MPI, only: MPI_COMM_WORLD, MPI_INTEGER, MPI_REAL4, MPI_REAL8, MPI_STATUS_SIZE
use MPI, only: MPI_INTEGER, MPI_REAL4, MPI_REAL8, MPI_STATUS_SIZE
#ifdef W3_MPI
USE MPICOMM, only: MPI_COMM_WW3 => MPI_COMM_WORLD
#endif
!
implicit none
!#ifdef USE_SINGLE
! !> single precision. Enable with compiler flag -DUSE_SINGLE
Expand Down
1 change: 1 addition & 0 deletions model/src/cmake/src_list.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set(c_src w3getmem.c)
# Core files always built
set(ftn_src
constants.F90
mpicomm.F90
w3adatmd.F90
w3arrymd.F90
w3bullmd.F90
Expand Down
2 changes: 1 addition & 1 deletion model/src/cmake/switches.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
},
{
"name": "NL2",
"build_files": ["w3snl2md.F90", "mod_xnl4v5.f90", "serv_xnl4v5.f90", "mod_fileio.f90", "mod_constants.f90"],
"build_files": ["w3snl2md.F90", "mod_xnl4v5.f90", "serv_xnl4v5.f90", "mod_fileio.f90", "mod_constants.f90", "mod_mpicomm.f90"],
"conflicts": ["OMPG", "OMPH"]
},
{
Expand Down
73 changes: 73 additions & 0 deletions model/src/mpicomm.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
!> @file
!> @brief Defines MPI communicator id as constants for global use.
!>
!> @author H. L. Tolman @date 05-Jun-2018
!>
#include "w3macros.h"

!>
!> @brief Define some mpi constants for global use
!>
!> @author H. L. Tolman @date 05-Jun-2018
!>
!
#ifndef ENDIANNESS
#define ENDIANNESS "native"
#endif
!
!/ ------------------------------------------------------------------- /
MODULE MPICOMM
!/
!/ +-----------------------------------+
!/ | WAVEWATCH III NOAA/NCEP |
!/ | H. L. Tolman |
!/ | FORTRAN 90 |
!/ | Last update : 05-Jun-2018 |
!/ +-----------------------------------+
!/
!/ 11-Nov-1999 : Fortran 90 version. ( version 2.00 )
!/ 29-May-2009 : Preparing distribution version. ( version 3.14 )
!/ 25-Jun-2011 : Adding Kelvin functions. ( version 4.05 )
!/ 03-Sep-2012 : Adding TSTOUT flag. ( version 4.10 )
!/ 28-Feb-2013 : Adding cap at 0.5 in FWTABLE ( version 4.08 )
!/ 20-Jan-2017 : Add parameters for ESMF ( version 6.02 )
!/ 01-Mar-2018 : Add UNDEF parameter ( version 6.02 )
!/ 05-Jun-2018 : Add PDLIB parameters ( version 6.04 )
!/
!/ Copyright 2009-2012 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
!/ reserved. WAVEWATCH III is a trademark of the NWS.
!/ No unauthorized use without permission.
!/
! 1. Purpose :
!
! Define some mpi constants for global use
!
! 2. Variables and types :
!
! Name Type Scope Description
! ----------------------------------------------------------------
! UNDEF Real Global Value for undefined variable in output
! ----------------------------------------------------------------
!/ ------------------------------------------------------------------- /
!/
!
!#ifdef W3_MPI
! INCLUDE "mpif.h"
!#endif

INTEGER :: MPI_COMM_WW3=0 !< MPI_COMM_WW3
!
! Parameters in support of running as ESMF component
!
! --- Flag indicating whether or not the model has been invoked as an
! external Component. This flag is set to true in the external
! module during initialization.
LOGICAL :: IS_EXTERNAL_COMPONENT = .FALSE. !< IS_EXTERNAL_COMPONENT Flag for model invoked via external executable.
!
CONTAINS

!/
!/ End of module MPICOMM ------------------------------------------- /
!/
END MODULE MPICOMM
2 changes: 1 addition & 1 deletion model/src/w3gsrumd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9631,7 +9631,7 @@ SUBROUTINE EXTCDE(IEXIT)
LOGICAL :: RUN
CALL MPI_INITIALIZED ( RUN, IERR_MPI )
IF ( RUN ) THEN
CALL MPI_ABORT ( MPI_COMM_WORLD, IEXIT, IERR_MPI )
CALL MPI_ABORT ( MPI_COMM_WW3, IEXIT, IERR_MPI )
END IF
#endif
CALL EXIT(IEXIT)
Expand Down
3 changes: 3 additions & 0 deletions model/src/w3initmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD,
UA, UD, U10, U10D, AS
#ifdef W3_MPI
USE W3ADATMD, ONLY: MPI_COMM_WAVE, MPI_COMM_WCMP
USE MPICOMM
#endif
USE W3IDATMD, ONLY: FLLEV, FLCUR, FLWIND, FLICE, FLTAUA, FLRHOA,&
FLMDN, FLMTH, FLMVS, FLIC1, FLIC2, FLIC3, &
Expand Down Expand Up @@ -562,6 +563,8 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD,
#endif
!
#ifdef W3_MPI
MPI_COMM_WW3=MPI_COMM_WORLD !< MPI_COMM_WW3

MPI_COMM_WAVE = MPI_COMM
CALL MPI_COMM_SIZE ( MPI_COMM_WAVE, NTPROC, IERR_MPI )
NAPROC = NTPROC
Expand Down
6 changes: 5 additions & 1 deletion model/src/w3servmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ MODULE W3SERVMD
!/ ------------------------------------------------------------------- /

! module default
#ifdef W3_MPI
USE MPICOMM
#endif
!
implicit none

PUBLIC
Expand Down Expand Up @@ -864,7 +868,7 @@ SUBROUTINE EXTCDE ( IEXIT, UNIT, MSG, FILE, LINE, COMM )
IF (PRESENT(COMM)) THEN
WRITE(*,'(/A,I6/)') 'EXTCDE COMM=', COMM
END IF
CALL MPI_ABORT ( MPI_COMM_WORLD, IEXIT, IERR_MPI )
CALL MPI_ABORT ( MPI_COMM_WW3, IEXIT, IERR_MPI )
END IF
END IF
#endif
Expand Down
Loading

0 comments on commit 1ef96e9

Please sign in to comment.