Skip to content

Commit 842c1b8

Browse files
authored
Merge pull request #105 from ecmwf-ifs/naml-loki-stmt-func-inline
Loki: Always inline stmt functions from C-headers
2 parents 751a953 + fa1391b commit 842c1b8

File tree

7 files changed

+16
-400
lines changed

7 files changed

+16
-400
lines changed

bundle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ projects :
3636
3737
- loki :
3838
git : https://github.com/ecmwf-ifs/loki
39-
version : v0.2.9
39+
version : main
4040
require : ecbuild
4141
cmake : >
4242
LOKI_ENABLE_TESTS=OFF

src/cloudsc_loki/CMakeLists.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ if( HAVE_CLOUDSC_LOKI )
3030

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

33-
# OFP frontend cannot deal with statement functions, so we toggle them here
34-
set( CLOUDSC_DEFINE_STMT_FUNC "" )
35-
if(NOT "${LOKI_FRONTEND}" STREQUAL "ofp")
36-
set( CLOUDSC_DEFINE_STMT_FUNC CLOUDSC_STMT_FUNC )
37-
endif()
38-
3933
####################################################
4034
## Idempotence mode: ##
4135
## * Internal "do-nothing" mode for Loki debug ##
@@ -54,8 +48,6 @@ if( HAVE_CLOUDSC_LOKI )
5448
MODE idem
5549
CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/cloudsc_loki.config
5650
CPP
57-
DEFINITIONS
58-
${CLOUDSC_DEFINE_STMT_FUNC}
5951
FRONTEND ${LOKI_FRONTEND}
6052
SOURCES
6153
${CMAKE_CURRENT_SOURCE_DIR}
@@ -133,8 +125,6 @@ if( HAVE_CLOUDSC_LOKI )
133125
MODE idem-stack
134126
CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/cloudsc_loki.config
135127
CPP
136-
DEFINITIONS
137-
${CLOUDSC_DEFINE_STMT_FUNC}
138128
FRONTEND ${LOKI_FRONTEND}
139129
SOURCES
140130
${CMAKE_CURRENT_SOURCE_DIR}
@@ -220,8 +210,6 @@ if( HAVE_CLOUDSC_LOKI )
220210
MODE sca
221211
CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/cloudsc_loki.config
222212
CPP
223-
DEFINITIONS
224-
${CLOUDSC_DEFINE_STMT_FUNC}
225213
FRONTEND ${LOKI_FRONTEND}
226214
SOURCES
227215
${CMAKE_CURRENT_SOURCE_DIR}
@@ -284,8 +272,6 @@ if( HAVE_CLOUDSC_LOKI )
284272
MODE claw-cpu
285273
CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/cloudsc_loki.config
286274
CPP
287-
DEFINITIONS
288-
${CLOUDSC_DEFINE_STMT_FUNC}
289275
FRONTEND ${LOKI_FRONTEND}
290276
SOURCES
291277
${CMAKE_CURRENT_SOURCE_DIR}
@@ -391,7 +377,6 @@ if( HAVE_CLOUDSC_LOKI )
391377
CPP
392378
DEFINITIONS
393379
CLOUDSC_GPU_TIMING
394-
${CLOUDSC_DEFINE_STMT_FUNC}
395380
FRONTEND ${LOKI_FRONTEND}
396381
SOURCES
397382
${CMAKE_CURRENT_SOURCE_DIR}
@@ -466,7 +451,6 @@ if( HAVE_CLOUDSC_LOKI )
466451
CPP
467452
DEFINITIONS
468453
CLOUDSC_GPU_TIMING
469-
${CLOUDSC_DEFINE_STMT_FUNC}
470454
FRONTEND ${LOKI_FRONTEND}
471455
SOURCES
472456
${CMAKE_CURRENT_SOURCE_DIR}
@@ -524,7 +508,6 @@ if( HAVE_CLOUDSC_LOKI )
524508
CPP
525509
DEFINITIONS
526510
CLOUDSC_GPU_TIMING
527-
${CLOUDSC_DEFINE_STMT_FUNC}
528511
FRONTEND ${LOKI_FRONTEND}
529512
SOURCES
530513
${CMAKE_CURRENT_SOURCE_DIR}
@@ -588,7 +571,6 @@ if( HAVE_CLOUDSC_LOKI )
588571
CPP
589572
DEFINITIONS
590573
CLOUDSC_GPU_TIMING
591-
${CLOUDSC_DEFINE_STMT_FUNC}
592574
FRONTEND ${LOKI_FRONTEND}
593575
SOURCES
594576
${CMAKE_CURRENT_SOURCE_DIR}
@@ -835,8 +817,6 @@ endif()
835817
${COMMON_MODULE}/yomcst.F90
836818
${COMMON_MODULE}/yoethf.F90
837819
${COMMON_MODULE}/yoecldp.F90
838-
${COMMON_MODULE}/fcttre_mod.F90
839-
${COMMON_MODULE}/fccld_mod.F90
840820
INCLUDES ${COMMON_INCLUDE}
841821
XMOD ${_TARGET_XMOD_DIR} ${XMOD_DIR}
842822
BUILDDIR ${CMAKE_CURRENT_BINARY_DIR}/loki-c

src/cloudsc_loki/cloudsc.F90

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,11 @@ SUBROUTINE CLOUDSC &
135135
!===============================================================================
136136

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

149144
IMPLICIT NONE
150145

@@ -494,10 +489,8 @@ SUBROUTINE CLOUDSC &
494489

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

497-
#ifdef CLOUDSC_STMT_FUNC
498492
#include "fcttre.func.h"
499493
#include "fccld.func.h"
500-
#endif
501494

502495
!===============================================================================
503496
!IF (LHOOK) CALL DR_HOOK('CLOUDSC',0,ZHOOK_HANDLE)

src/cloudsc_loki/cloudsc_loki.config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ frontend = 'FP'
8383
[frontend_args."yoecldp.F90"]
8484
frontend = 'FP'
8585

86+
[frontend_args."cloudsc.F90"]
87+
preprocess = true
88+
8689

8790
# Define specific transformation settings
8891
# -------------------------------------------------------------------
@@ -122,6 +125,18 @@ frontend = 'FP'
122125
check_bounds = true
123126

124127

128+
[transformations.InlineTransformation]
129+
classname = 'InlineTransformation'
130+
module = 'loki.transformations'
131+
[transformations.InlineTransformation.options]
132+
inline_internals = false
133+
inline_marked = true
134+
inline_stmt_funcs = true
135+
remove_dead_code = true
136+
allowed_aliases = 'JL'
137+
resolve_sequence_association = false
138+
139+
125140
# Loki-SCC family of transformations
126141
# -------------------------------------------------------------------
127142
# A set of transformation passes that transforms SIMD vectorisation

src/common/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ list(APPEND CLOUDSC_COMMON_SOURCES
2828
module/cloudsc_mpi_mod.F90
2929
)
3030

31-
if(NOT ENABLE_USE_STMT_FUNC)
32-
list(APPEND CLOUDSC_COMMON_SOURCES
33-
module/fcttre_mod.F90
34-
module/fccld_mod.F90
35-
)
36-
endif()
37-
3831
list(APPEND CLOUDSC_CUDA_SOURCES
3932
module/fccld_mod.cuf.F90
4033
module/fcttre_mod.cuf.F90

src/common/module/fccld_mod.F90

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)