Skip to content

Commit

Permalink
Merge pull request #105 from ecmwf-ifs/naml-loki-stmt-func-inline
Browse files Browse the repository at this point in the history
Loki: Always inline stmt functions from C-headers
  • Loading branch information
reuterbal authored Dec 19, 2024
2 parents 751a953 + fa1391b commit 842c1b8
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 400 deletions.
2 changes: 1 addition & 1 deletion bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ projects :
- loki :
git : https://github.com/ecmwf-ifs/loki
version : v0.2.9
version : main
require : ecbuild
cmake : >
LOKI_ENABLE_TESTS=OFF
Expand Down
20 changes: 0 additions & 20 deletions src/cloudsc_loki/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ if( HAVE_CLOUDSC_LOKI )

set( LOKI_FRONTEND "fp" CACHE STRING "Frontend parser for Loki transforms" )

# OFP frontend cannot deal with statement functions, so we toggle them here
set( CLOUDSC_DEFINE_STMT_FUNC "" )
if(NOT "${LOKI_FRONTEND}" STREQUAL "ofp")
set( CLOUDSC_DEFINE_STMT_FUNC CLOUDSC_STMT_FUNC )
endif()

####################################################
## Idempotence mode: ##
## * Internal "do-nothing" mode for Loki debug ##
Expand All @@ -54,8 +48,6 @@ if( HAVE_CLOUDSC_LOKI )
MODE idem
CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/cloudsc_loki.config
CPP
DEFINITIONS
${CLOUDSC_DEFINE_STMT_FUNC}
FRONTEND ${LOKI_FRONTEND}
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -133,8 +125,6 @@ if( HAVE_CLOUDSC_LOKI )
MODE idem-stack
CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/cloudsc_loki.config
CPP
DEFINITIONS
${CLOUDSC_DEFINE_STMT_FUNC}
FRONTEND ${LOKI_FRONTEND}
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -220,8 +210,6 @@ if( HAVE_CLOUDSC_LOKI )
MODE sca
CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/cloudsc_loki.config
CPP
DEFINITIONS
${CLOUDSC_DEFINE_STMT_FUNC}
FRONTEND ${LOKI_FRONTEND}
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -284,8 +272,6 @@ if( HAVE_CLOUDSC_LOKI )
MODE claw-cpu
CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/cloudsc_loki.config
CPP
DEFINITIONS
${CLOUDSC_DEFINE_STMT_FUNC}
FRONTEND ${LOKI_FRONTEND}
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -391,7 +377,6 @@ if( HAVE_CLOUDSC_LOKI )
CPP
DEFINITIONS
CLOUDSC_GPU_TIMING
${CLOUDSC_DEFINE_STMT_FUNC}
FRONTEND ${LOKI_FRONTEND}
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -466,7 +451,6 @@ if( HAVE_CLOUDSC_LOKI )
CPP
DEFINITIONS
CLOUDSC_GPU_TIMING
${CLOUDSC_DEFINE_STMT_FUNC}
FRONTEND ${LOKI_FRONTEND}
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -524,7 +508,6 @@ if( HAVE_CLOUDSC_LOKI )
CPP
DEFINITIONS
CLOUDSC_GPU_TIMING
${CLOUDSC_DEFINE_STMT_FUNC}
FRONTEND ${LOKI_FRONTEND}
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -588,7 +571,6 @@ if( HAVE_CLOUDSC_LOKI )
CPP
DEFINITIONS
CLOUDSC_GPU_TIMING
${CLOUDSC_DEFINE_STMT_FUNC}
FRONTEND ${LOKI_FRONTEND}
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -835,8 +817,6 @@ endif()
${COMMON_MODULE}/yomcst.F90
${COMMON_MODULE}/yoethf.F90
${COMMON_MODULE}/yoecldp.F90
${COMMON_MODULE}/fcttre_mod.F90
${COMMON_MODULE}/fccld_mod.F90
INCLUDES ${COMMON_INCLUDE}
XMOD ${_TARGET_XMOD_DIR} ${XMOD_DIR}
BUILDDIR ${CMAKE_CURRENT_BINARY_DIR}/loki-c
Expand Down
7 changes: 0 additions & 7 deletions src/cloudsc_loki/cloudsc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,11 @@ SUBROUTINE CLOUDSC &
!===============================================================================

USE PARKIND1 , ONLY : JPIM, JPRB
USE YOMPHYDER ,ONLY : STATE_TYPE
USE YOMCST , ONLY : RG, RD, RCPD, RETV, RLVTT, RLSTT, RLMLT, RTT, RV
USE YOETHF , ONLY : R2ES, R3LES, R3IES, R4LES, R4IES, R5LES, R5IES, &
& R5ALVCP, R5ALSCP, RALVDCP, RALSDCP, RALFDCP, RTWAT, RTICE, RTICECU, &
& RTWAT_RTICE_R, RTWAT_RTICECU_R, RKOOP1, RKOOP2
USE YOECLDP , ONLY : TECLDP, NCLDQV, NCLDQL, NCLDQR, NCLDQI, NCLDQS, NCLV
#ifndef CLOUDSC_STMT_FUNC
USE FCTTRE_MOD, ONLY: FOEDELTA, FOEALFA, FOEEWM, FOEEICE, FOEELIQ, FOELDCP, FOELDCPM, FOEDEM
USE FCCLD_MOD, ONLY : FOKOOP
#endif

IMPLICIT NONE

Expand Down Expand Up @@ -494,10 +489,8 @@ SUBROUTINE CLOUDSC &

REAL(KIND=JPRB) :: PSUM_SOLQA(KLON)

#ifdef CLOUDSC_STMT_FUNC
#include "fcttre.func.h"
#include "fccld.func.h"
#endif

!===============================================================================
!IF (LHOOK) CALL DR_HOOK('CLOUDSC',0,ZHOOK_HANDLE)
Expand Down
15 changes: 15 additions & 0 deletions src/cloudsc_loki/cloudsc_loki.config
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ frontend = 'FP'
[frontend_args."yoecldp.F90"]
frontend = 'FP'

[frontend_args."cloudsc.F90"]
preprocess = true


# Define specific transformation settings
# -------------------------------------------------------------------
Expand Down Expand Up @@ -122,6 +125,18 @@ frontend = 'FP'
check_bounds = true


[transformations.InlineTransformation]
classname = 'InlineTransformation'
module = 'loki.transformations'
[transformations.InlineTransformation.options]
inline_internals = false
inline_marked = true
inline_stmt_funcs = true
remove_dead_code = true
allowed_aliases = 'JL'
resolve_sequence_association = false


# Loki-SCC family of transformations
# -------------------------------------------------------------------
# A set of transformation passes that transforms SIMD vectorisation
Expand Down
7 changes: 0 additions & 7 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ list(APPEND CLOUDSC_COMMON_SOURCES
module/cloudsc_mpi_mod.F90
)

if(NOT ENABLE_USE_STMT_FUNC)
list(APPEND CLOUDSC_COMMON_SOURCES
module/fcttre_mod.F90
module/fccld_mod.F90
)
endif()

list(APPEND CLOUDSC_CUDA_SOURCES
module/fccld_mod.cuf.F90
module/fcttre_mod.cuf.F90
Expand Down
41 changes: 0 additions & 41 deletions src/common/module/fccld_mod.F90

This file was deleted.

Loading

0 comments on commit 842c1b8

Please sign in to comment.