Skip to content

Commit

Permalink
IFS-SOURCE-ECWAM-SYNC: don't use ecflow_light in standalone builds
Browse files Browse the repository at this point in the history
  • Loading branch information
awnawab committed Dec 6, 2023
1 parent 2d60936 commit 88ce0c5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
cmake_minimum_required( VERSION 3.24 FATAL_ERROR )
find_package( ecbuild 3.4 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild )

set(PARENT_PROJECT_NAME "${PROJECT_NAME}")
if( NOT ECWAM_PROJECT_NAME )
set( ECWAM_PROJECT_NAME ecwam )
endif()
Expand Down Expand Up @@ -89,6 +90,12 @@ if( HAVE_OMP )
set( OpenMP_Fortran_LIBRARIES OpenMP::OpenMP_Fortran )
endif()

### Check if this is a standalone ecWAM build
set(ECWAM_STANDALONE 0)
if(PROJECT_IS_TOP_LEVEL OR (PARENT_PROJECT_NAME STREQUAL "ecwam-bundle"))
set(ECWAM_STANDALONE 1)
endif()

### Sources

include(ecwam_compile_flags)
Expand Down
4 changes: 2 additions & 2 deletions src/ecwam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ endif()
ecbuild_add_library(
TARGET ${ecwam}
SOURCES ${ecwam_srcs}
PUBLIC_LIBS fiat parkind_${prec} ecflow_lightf ${ecwam}_intfb
PUBLIC_LIBS fiat parkind_${prec} $<$<NOT:${ECWAM_STANDALONE}>:ecflow_lightf> ${ecwam}_intfb
${MPI_Fortran_LIBRARIES}
${${PNAME}_OCEANMODEL_LIBRARIES}
PRIVATE_LIBS eccodes_f90
Expand All @@ -432,7 +432,7 @@ ecbuild_add_library(
field_api_${prec}
PUBLIC_INCLUDES $<INSTALL_INTERFACE:include>
PRIVATE_INCLUDES ${${PNAME}_OCEANMODEL_INCLUDE_DIRS}
PUBLIC_DEFINITIONS ${ECWAM_DEFINITIONS}
PUBLIC_DEFINITIONS ${ECWAM_DEFINITIONS} $<${ECWAM_STANDALONE}:_ECWAM_STANDALONE>
)

ecwam_target_fortran_module_directory(
Expand Down
25 changes: 25 additions & 0 deletions src/ecwam/wavemdl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ SUBROUTINE WAVEMDL (CBEGDAT, PSTEP, KSTOP, KSTPW, &
USE YOWASSI , ONLY : WAMASSI
USE YOWGRIB , ONLY : IGRIB_GET_VALUE
USE MPL_MODULE, ONLY : MPL_BARRIER, MPL_GATHERV
#ifndef _ECWAM_STANDALONE
USE ECFLOW_LIGHT, ONLY : ECFLOW_LIGHT_UPDATE_METER
#endif
! ---------------------------------------------------------------------

IMPLICIT NONE
Expand Down Expand Up @@ -286,10 +288,12 @@ SUBROUTINE WAVEMDL (CBEGDAT, PSTEP, KSTOP, KSTPW, &
LOGICAL :: LLINIT
LOGICAL :: LLINIT_FIELDG

#ifndef _ECWAM_STANDALONE
CHARACTER(LEN = 64) :: METER_NAME
INTEGER(KIND=JWIM) :: METER_VALUE
INTEGER(KIND=JWIM) :: ERROR
CHARACTER(LEN = 16) :: ERROR_STR
#endif

DATA LFRST /.TRUE./
DATA LFRSTCHK /.TRUE./
Expand Down Expand Up @@ -666,6 +670,26 @@ SUBROUTINE WAVEMDL (CBEGDAT, PSTEP, KSTOP, KSTPW, &
CALL DIFDATE (CDATEF, CDTPRO, IFCST)
IFCSTEP_HOUR=IFCST/3600
IF (IRANK == 1) THEN
#ifdef _ECWAM_STANDALONE
WRITE(CLSETEV,' (A25,'' step '',I8,''&'') ') CMETER,IFCSTEP_HOUR
CLSMSNAME=" "
CLECFNAME=" "
CALL GET_ENVIRONMENT_VARIABLE(NAME=CL_CPENV, VALUE=CLSMSNAME, LENGTH=ICPLEN)
CALL GET_ENVIRONMENT_VARIABLE(NAME=CL_CPENV_ECF, VALUE=CLECFNAME, LENGTH=ICPLEN_ECF)
IF( ICPLEN == 0 ) CLSMSNAME = 'NOSMS'
IF( ICPLEN_ECF == 0 ) CLECFNAME = 'NOECF'
IF ((ICPLEN > 0.AND.CLSMSNAME(1:5) /= 'NOSMS') .OR. &
& (ICPLEN_ECF > 0.AND.CLECFNAME(1:5) /= 'NOECF') ) THEN
CALL SYSTEM(CLSETEV)
WRITE(IU06,'(2X,A25,I8,'' posted '')') CMETER,IFCSTEP_HOUR
ELSE
WRITE(IU06,'(A25,I8)') CMETER,IFCSTEP_HOUR
WRITE(IU06,*) 'not posted because neither SMSNAME'
WRITE(IU06,*) ICPLEN, CLSMSNAME
WRITE(IU06,*) 'nor ECF_NAME is defined. '
WRITE(IU06,*) ICPLEN_ECF, CLECFNAME
ENDIF
#else
METER_NAME = "step"
METER_VALUE = IFCSTEP_HOUR

Expand All @@ -674,6 +698,7 @@ SUBROUTINE WAVEMDL (CBEGDAT, PSTEP, KSTOP, KSTPW, &

WRITE(ERROR_STR, *) ERROR
WRITE(NULERR,FMT='("Update task meter finished, with result """,A,"""")') TRIM(ERROR_STR)
#endif
ENDIF
ENDIF

Expand Down

0 comments on commit 88ce0c5

Please sign in to comment.