Skip to content
Open
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
26 changes: 14 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ jobs:
matrix:
build_type: [Release,Bit,Debug]
name:
- linux gnu-12
- linux nvhpc-24.3
- linux gnu-13
- linux nvhpc-25.9
- linux intel-classic
- linux intel-llvm

include:

- name: linux gnu-12
os: ubuntu-22.04
compiler: gnu-12
compiler_cc: gcc-12
compiler_cxx: g++-12
compiler_fc: gfortran-12
- name: linux gnu-13
os: ubuntu-24.04
compiler: gnu-13
compiler_cc: gcc-13
compiler_cxx: g++-13
compiler_fc: gfortran-13
caching: true

- name: linux nvhpc-24.3
os: ubuntu-22.04
compiler: nvhpc-24.3
- name: linux nvhpc-25.9
os: ubuntu-24.04
compiler: nvhpc
compiler_cc: nvc
compiler_cxx: nvc++
compiler_fc: nvfortran
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
if: contains( matrix.compiler, 'nvhpc' )
shell: bash -eux {0}
run: |
${ECRAD_TOOLS}/install-nvhpc.sh --prefix /opt/nvhpc --version 24.3
${ECRAD_TOOLS}/install-nvhpc.sh --prefix /opt/nvhpc --version 25.9
source /opt/nvhpc/env.sh
echo "${NVHPC_DIR}/compilers/bin" >> $GITHUB_PATH
echo "NVHPC_ROOT=${NVHPC_DIR}" >> $GITHUB_ENV
Expand Down Expand Up @@ -181,9 +181,11 @@ jobs:
dependencies: |
ecmwf/ecbuild
ecmwf-ifs/fiat
ecmwf-ifs/field_api@refs/heads/main
dependency_branch: develop
dependency_cmake_options: |
ecmwf-ifs/fiat: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTS=OFF"
ecmwf-ifs/field_api: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTS=OFF"
cmake_options: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.cmake_options }} -DENABLE_SINGLE_PRECISION=ON -DENABLE_BITIDENTITY_TESTING=ON"
ctest_options: "${{ matrix.ctest_options }}"

Expand Down
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ if( HAVE_FIAT AND fiat_HAVE_MPI )
list( APPEND ECRAD_COMPILE_DEFINITIONS EASY_NETCDF_READ_MPI )
endif()

ecbuild_add_option(
FEATURE FIELD_API
DEFAULT ON
DESCRIPTION "Enable FIELD_API-based driver variant"
REQUIRED_PACKAGES "field_api"
)

find_program(FYPP fypp)
ecbuild_add_option(
FEATURE FYPP
DEFAULT OFF
DESCRIPTION "Use FYPP to re-generate Fortran code for FIELD_API-based driver variant"
CONDITION NOT FYPP-NOTFOUND
)

ecbuild_add_option(
FEATURE OMP
DEFAULT ON
Expand Down
51 changes: 35 additions & 16 deletions driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ ecbuild_add_library(
ecrad_driver_read_input.F90
ecrad_driver_config.F90
print_matrix_mod.F90
PUBLIC_INCLUDES
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/module_driver_lib>"
PUBLIC_DEFINITIONS
$<$<NOT:${HAVE_OMP}>:NO_OPENMP>
PUBLIC_LIBS
ecrad.${PREC}
ecrad_base.${PREC}
$<${HAVE_OMP}:OpenMP::OpenMP_Fortran>
)
set_target_properties( driver_lib.${PREC}
PROPERTIES
Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/module_driver_lib"
)

ecbuild_add_executable(
TARGET ecrad_${PREC}
Expand All @@ -45,7 +51,6 @@ ecbuild_add_executable(
TARGET ecrad_ifs_blocked_${PREC}
SOURCES
ecrad_ifs_driver_blocked.F90
ifs_blocking.F90
LIBS
ifs.${PREC}
driver_lib.${PREC}
Expand Down Expand Up @@ -75,24 +80,38 @@ if( CMAKE_BUILD_TYPE MATCHES "Debug" )
endif()
endif()

if( HAVE_FIELD_API )
ecbuild_add_executable(
TARGET ecrad_ifs_field_api_${PREC}
SOURCES
ecrad_ifs_driver_field_api.F90
LIBS
ifs_field_api.${PREC}
driver_lib.${PREC}
LINKER_LANGUAGE Fortran
)
endif()

# Create a symlink for each driver without the precision suffix.
# The default is to link to the double precision version if it is built,
# and single precision otherwise.
if ( "${PREC}" STREQUAL "dp" OR NOT HAVE_DOUBLE_PRECISION )
foreach( tgt ecrad ecrad_ifs ecrad_ifs_blocked )
add_custom_command(
TARGET ${tgt}_${PREC}
POST_BUILD
COMMAND
"${CMAKE_COMMAND}" -E create_symlink ${tgt}_${PREC} ${tgt}
BYPRODUCTS ${tgt}
WORKING_DIRECTORY
"${CMAKE_BINARY_DIR}/bin"
COMMENT "Creating symbolic link from ${tgt} to ${tgt}_${PREC}"
)
install(
FILES ${CMAKE_BINARY_DIR}/bin/${tgt}
DESTINATION bin
)
foreach( tgt ecrad ecrad_ifs ecrad_ifs_blocked ecrad_ifs_field_api )
if( TARGET ${tgt}_${PREC} )
add_custom_command(
TARGET ${tgt}_${PREC}
POST_BUILD
COMMAND
"${CMAKE_COMMAND}" -E create_symlink ${tgt}_${PREC} ${tgt}
BYPRODUCTS ${tgt}
WORKING_DIRECTORY
"${CMAKE_BINARY_DIR}/bin"
COMMENT "Creating symbolic link from ${tgt} to ${tgt}_${PREC}"
)
install(
FILES ${CMAKE_BINARY_DIR}/bin/${tgt}
DESTINATION bin
)
endif()
endforeach()
endif()
6 changes: 3 additions & 3 deletions driver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $(IFS_EXECUTABLE): $(OBJECTS) ../lib/*.a ecrad_ifs_driver.o
$(FC) $(FCFLAGS) ecrad_ifs_driver.o $(OBJECTS) -lifs $(LIBS) -o $(IFS_EXECUTABLE)

$(IFS_BLOCKED_EXECUTABLE): $(OBJECTS) ../lib/*.a ecrad_ifs_driver_blocked.o
$(FC) $(FCFLAGS) ifs_blocking.o ecrad_ifs_driver_blocked.o $(OBJECTS) -lifs $(LIBS) -o $(IFS_BLOCKED_EXECUTABLE)
$(FC) $(FCFLAGS) ecrad_ifs_driver_blocked.o $(OBJECTS) -lifs $(LIBS) -o $(IFS_BLOCKED_EXECUTABLE)

test_%: test_%.F90 ../lib/*.a
$(FC) $(FCFLAGS) $< $(LIBS) -o $@
Expand All @@ -47,7 +47,7 @@ clean:

ecrad_driver.o: ecrad_driver_config.o ecrad_driver_read_input.o
ecrad_ifs_driver.o: ecrad_driver_config.o ecrad_driver_read_input.o
ecrad_ifs_driver_blocked.o: ecrad_driver_config.o ecrad_driver_read_input.o ifs_blocking.o
ecrad_driver_read_input.o ifs_blocking.o: ecrad_driver_config.o
ecrad_ifs_driver_blocked.o: ecrad_driver_config.o ecrad_driver_read_input.o
ecrad_driver_read_input.o: ecrad_driver_config.o

.PHONY: driver ifs_driver test_programs all
86 changes: 45 additions & 41 deletions driver/ecrad_ifs_driver_blocked.F90
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ program ecrad_ifs_driver
use radiation_constants, only : Pi
use ecrad_driver_config, only : driver_config_type
use ecrad_driver_read_input, only : read_input
use radintg_zrgp_mod, only : radintg_zrgp_type
use ifs_blocking, only : ifs_copy_inputs_to_blocked, ifs_copy_fluxes_from_blocked
use easy_netcdf
use ifs_blocking

implicit none

Expand All @@ -94,14 +95,14 @@ program ecrad_ifs_driver
type(flux_type) :: flux

! Additional arrays passed to radiation_scheme
real(jprb), allocatable, dimension(:) :: ccn_land, ccn_sea, sin_latitude, longitude_rad, land_frac
real(jprb), allocatable, dimension(:) :: sin_latitude, longitude_rad, land_frac
real(jprb), allocatable, dimension(:,:) :: pressure_fl, temperature_fl
real(jprb), allocatable, dimension(:) :: flux_sw_direct_normal, flux_uv, flux_par, flux_par_clear, &
& emissivity_out
real(jprb), allocatable, dimension(:,:) :: flux_diffuse_band, flux_direct_band

! Bespoke data types to set-up the blocked memory layout
type(ifs_config_type) :: ifs_config
type(radintg_zrgp_type) :: zrgp_fields
real(kind=jprb), allocatable :: zrgp(:,:,:) ! monolithic IFS data structure
#ifdef BITIDENTITY_TESTING
integer, allocatable :: iseed(:,:) ! Seed for random number generator
Expand Down Expand Up @@ -341,8 +342,6 @@ program ecrad_ifs_driver
if(allocated(flux%lw_derivatives)) flux%lw_derivatives(:,:) = 0._jprb

! Allocate memory for additional arrays
allocate(ccn_land(ncol))
allocate(ccn_sea(ncol))
allocate(land_frac(ncol))
allocate(pressure_fl(ncol,nlev))
allocate(temperature_fl(ncol,nlev))
Expand All @@ -354,18 +353,23 @@ program ecrad_ifs_driver
allocate(flux_diffuse_band(ncol,yradiation%yrerad%nsw))
allocate(flux_direct_band(ncol,yradiation%yrerad%nsw))

ccn_land = yradiation%yrerad%rccnlnd
ccn_sea = yradiation%yrerad%rccnsea
pressure_fl = 0.5_jprb * (thermodynamics%pressure_hl(:,1:nlev)+thermodynamics%pressure_hl(:,2:nlev+1))
temperature_fl = 0.5_jprb * (thermodynamics%temperature_hl(:,1:nlev)+thermodynamics%temperature_hl(:,2:nlev+1))

! --------------------------------------------------------
! Section 4a: Reshuffle into blocked memory layout
! --------------------------------------------------------

call ifs_setup_indices(driver_config, ifs_config, yradiation, nlev)
call ifs_copy_inputs_to_blocked(driver_config, ifs_config, yradiation,&
& ncol, nlev, single_level, thermodynamics, gas, cloud, aerosol,&
call zrgp_fields%setup(nlev, &
& yradiation%yrerad%nlwemiss, yradiation%yrerad%nlwout, &
& yradiation%yrerad%nsw, 0, 0, 0, &
& yradiation%rad_config%n_aerosol_types, &
& driver_config%iverbose>4, .false., .false., &
& yradiation%yrerad%lapproxlwupdate, yradiation%yrerad%lapproxswupdate, &
& .false., yradiation%yrerad%ldiagforcing)

call ifs_copy_inputs_to_blocked(zrgp_fields, yradiation,&
& ncol, nlev, nproma, single_level, thermodynamics, gas, cloud, aerosol,&
& sin_latitude, longitude_rad, land_frac, pressure_fl, temperature_fl,&
& zrgp &
#ifdef BITIDENTITY_TESTING
Expand Down Expand Up @@ -415,40 +419,40 @@ program ecrad_ifs_driver
& nlev, yradiation%rad_config%n_aerosol_types, & ! nlev, naerosols
& single_level%solar_irradiance, & ! solar_irrad
! array inputs
& zrgp(1,ifs_config%iamu0,ib), zrgp(1,ifs_config%its,ib), & ! mu0, skintemp
& zrgp(1,ifs_config%iald,ib) , zrgp(1,ifs_config%ialp,ib), & ! albedo_dif, albedo_dir
& zrgp(1,ifs_config%iemiss,ib), & ! spectral emissivity
& zrgp(1,ifs_config%iccnl,ib), zrgp(1,ifs_config%iccno,ib) ,& ! CCN concentration, land and sea
& zrgp(1,ifs_config%igelam,ib),zrgp(1,ifs_config%igemu,ib), & ! longitude, sine of latitude
& zrgp(1,ifs_config%islm,ib), & ! land sea mask
& zrgp(1,ifs_config%ipr,ib), zrgp(1,ifs_config%iti,ib), & ! full level pressure and temperature
& zrgp(1,ifs_config%iaprs,ib), zrgp(1,ifs_config%ihti,ib), & ! half-level pressure and temperature
& zrgp(1,ifs_config%iwv,ib), zrgp(1,ifs_config%iico2,ib), &
& zrgp(1,ifs_config%iich4,ib), zrgp(1,ifs_config%iin2o,ib), &
& zrgp(1,ifs_config%ino2,ib), zrgp(1,ifs_config%ic11,ib), &
& zrgp(1,ifs_config%ic12,ib), zrgp(1,ifs_config%ic22,ib), &
& zrgp(1,ifs_config%icl4,ib), zrgp(1,ifs_config%ioz,ib), &
& zrgp(1,ifs_config%iclc,ib), zrgp(1,ifs_config%ilwa,ib), &
& zrgp(1,ifs_config%iiwa,ib), zrgp(1,ifs_config%irwa,ib), &
& zrgp(1,ifs_config%iswa,ib), &
& zrgp(1,ifs_config%iaer,ib), zrgp(1,ifs_config%iaero,ib), &
& zrgp(1,zrgp_fields%iamu0,ib), zrgp(1,zrgp_fields%its,ib), & ! mu0, skintemp
& zrgp(1,zrgp_fields%iald,ib) , zrgp(1,zrgp_fields%ialp,ib), & ! albedo_dif, albedo_dir
& zrgp(1,zrgp_fields%iemiss,ib), & ! spectral emissivity
& zrgp(1,zrgp_fields%iccnl,ib), zrgp(1,zrgp_fields%iccno,ib) ,& ! CCN concentration, land and sea
& zrgp(1,zrgp_fields%igelam,ib),zrgp(1,zrgp_fields%igemu,ib), & ! longitude, sine of latitude
& zrgp(1,zrgp_fields%islm,ib), & ! land sea mask
& zrgp(1,zrgp_fields%ipr,ib), zrgp(1,zrgp_fields%iti,ib), & ! full level pressure and temperature
& zrgp(1,zrgp_fields%iaprs,ib), zrgp(1,zrgp_fields%ihti,ib), & ! half-level pressure and temperature
& zrgp(1,zrgp_fields%iwv,ib), zrgp(1,zrgp_fields%iico2,ib), &
& zrgp(1,zrgp_fields%iich4,ib), zrgp(1,zrgp_fields%iin2o,ib), &
& zrgp(1,zrgp_fields%ino2,ib), zrgp(1,zrgp_fields%ic11,ib), &
& zrgp(1,zrgp_fields%ic12,ib), zrgp(1,zrgp_fields%ic22,ib), &
& zrgp(1,zrgp_fields%icl4,ib), zrgp(1,zrgp_fields%ioz,ib), &
& zrgp(1,zrgp_fields%iclc,ib), zrgp(1,zrgp_fields%ilwa,ib), &
& zrgp(1,zrgp_fields%iiwa,ib), zrgp(1,zrgp_fields%irwa,ib), &
& zrgp(1,zrgp_fields%iswa,ib), &
& zrgp(1,zrgp_fields%iaer,ib), zrgp(1,zrgp_fields%iaero,ib), &
! flux outputs
& zrgp(1,ifs_config%ifrso,ib), zrgp(1,ifs_config%ifrth,ib), &
& zrgp(1,ifs_config%iswfc,ib), zrgp(1,ifs_config%ilwfc,ib),&
& zrgp(1,ifs_config%ifrsod,ib),zrgp(1,ifs_config%ifrted,ib), &
& zrgp(1,ifs_config%ifrsodc,ib),zrgp(1,ifs_config%ifrtedc,ib),&
& zrgp(1,ifs_config%ifdir,ib), zrgp(1,ifs_config%icdir,ib), &
& zrgp(1,ifs_config%isudu,ib), &
& zrgp(1,ifs_config%iuvdf,ib), zrgp(1,ifs_config%iparf,ib), &
& zrgp(1,ifs_config%iparcf,ib),zrgp(1,ifs_config%itincf,ib), &
& zrgp(1,ifs_config%iemit,ib) ,zrgp(1,ifs_config%ilwderivative,ib), &
& zrgp(1,ifs_config%iswdiffuseband,ib), zrgp(1,ifs_config%iswdirectband,ib)&
& zrgp(1,zrgp_fields%ifrso,ib), zrgp(1,zrgp_fields%ifrth,ib), &
& zrgp(1,zrgp_fields%iswfc,ib), zrgp(1,zrgp_fields%ilwfc,ib),&
& zrgp(1,zrgp_fields%ifrsod,ib),zrgp(1,zrgp_fields%ifrted,ib), &
& zrgp(1,zrgp_fields%ifrsodc,ib),zrgp(1,zrgp_fields%ifrtedc,ib),&
& zrgp(1,zrgp_fields%ifdir,ib), zrgp(1,zrgp_fields%icdir,ib), &
& zrgp(1,zrgp_fields%isudu,ib), &
& zrgp(1,zrgp_fields%iuvdf,ib), zrgp(1,zrgp_fields%iparf,ib), &
& zrgp(1,zrgp_fields%iparcf,ib),zrgp(1,zrgp_fields%itincf,ib), &
& zrgp(1,zrgp_fields%iemit,ib) ,zrgp(1,zrgp_fields%ilwderivative,ib), &
& zrgp(1,zrgp_fields%iswdiffuseband,ib), zrgp(1,zrgp_fields%iswdirectband,ib)&
#ifdef BITIDENTITY_TESTING
! To validate results against standalone ecrad, we overwrite effective
! radii, cloud overlap and seed with input values
& ,pre_liq=zrgp(1,ifs_config%ire_liq,ib), &
& pre_ice=zrgp(1,ifs_config%ire_ice,ib), &
& pcloud_overlap=zrgp(1,ifs_config%ioverlap,ib), &
& ,pre_liq=zrgp(1,zrgp_fields%ire_liq,ib), &
& pre_ice=zrgp(1,zrgp_fields%ire_ice,ib), &
& pcloud_overlap=zrgp(1,zrgp_fields%ioverlap,ib), &
& iseed=iseed(:,ib) &
#endif
& )
Expand Down Expand Up @@ -478,7 +482,7 @@ program ecrad_ifs_driver
! Section 4c: Copy fluxes from blocked memory data
! --------------------------------------------------------

call ifs_copy_fluxes_from_blocked(driver_config, ifs_config, yradiation, ncol, nlev,&
call ifs_copy_fluxes_from_blocked(zrgp_fields, yradiation, ncol, nlev, nproma, &
& zrgp, flux, flux_sw_direct_normal, flux_uv, flux_par, flux_par_clear, &
& emissivity_out, flux_diffuse_band, flux_direct_band)

Expand Down
Loading
Loading