Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loki: Always inline stmt functions from C-headers #105

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()

Comment on lines -33 to -38
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

####################################################
## 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