Skip to content
Open
Show file tree
Hide file tree
Changes from 81 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
5471960
Exit with error when incorrect argument applied
samhatfield Jul 3, 2025
9b1c055
Fix typo: baseargs -> base_args
samhatfield Jul 3, 2025
07e1b4f
Make sure base_args is expanded properly
samhatfield Jul 3, 2025
653cecc
Initial implementation
Jul 4, 2025
33cf796
Implement dump-checksums
Jul 4, 2025
de15138
typo
Jul 4, 2025
b61e65a
dump with gather (not working)
Jul 4, 2025
b3f485d
fix crashes
Jul 4, 2025
e24f2a9
small refactoring
Jul 4, 2025
93377c3
typo
Jul 4, 2025
f37bb3e
add checksums for lam
Jul 4, 2025
276bf7e
Merge remote-tracking branch 'ecmwf/develop' into dump-crcs
Jul 4, 2025
c79dd56
change filename
Jul 4, 2025
9e86a4a
Add script to compare checksums
Jul 7, 2025
5a95205
python3
Jul 7, 2025
21db9d2
Add unit test for checksum
Jul 7, 2025
a13d6c8
Merge branch 'dump-checksums' of https://github.com/dhaumont/ectrans …
Jul 7, 2025
f6a97e6
rename txt in checksums
Jul 7, 2025
17731e8
remove initialization of arrays before inv_trans
Jul 7, 2025
327c5e1
rename checksums
Jul 7, 2025
b11f38e
adding underscore in checksums
Jul 7, 2025
881d086
remove typo correction after fix in another branch
Jul 7, 2025
c17ab29
Merge branch 'develop' into dump-checksums
Jul 7, 2025
35a6865
Change color enum
Jul 7, 2025
a1795a4
Split long function calls and reorder arguments
Jul 7, 2025
6c4c9e3
fix naming of checksums files
Jul 8, 2025
ec38922
Fix indentation
Jul 10, 2025
67cf8ce
Fix out-of-bound access in Nvidia debug mode
Jul 10, 2025
06d62a8
The test compare_checksum will trigger other tests
Jul 10, 2025
4850f25
Indent if
samhatfield Jul 10, 2025
1f3b3ac
Fix out-of-bound access in Nvidia debug mode for lam
Jul 10, 2025
8f9a3b3
Merge branch 'dump-checksums' of https://github.com/dhaumont/ectrans …
Jul 10, 2025
8b4bca9
Merge branch 'develop' into dump-checksums
Jul 10, 2025
0ff0555
Add missing False statement
Jul 10, 2025
173b345
Merge branch 'develop' into dump-checksums
Aug 1, 2025
5157617
Introduction of field API interface in ectrans
Aug 1, 2025
f690b01
remove the clamp
Aug 1, 2025
2a7aa87
Ensure bit reproductibility on CPU for nvhpc by clamping small spectr…
Aug 1, 2025
8bee757
Merge branch 'develop' into field_api_interface
Sep 22, 2025
5f3bbc1
fix compilation error - unit test fail
Sep 22, 2025
cceb0df
compilation OK
Sep 24, 2025
139b63e
adding ivsetc and fix initialization bug
Sep 24, 2025
4e273f5
implement zgp
Sep 25, 2025
1f222f6
rename scalar to scalar3
Sep 25, 2025
6fd0c5e
rename
Sep 25, 2025
8fdabd1
call 1 working
Sep 25, 2025
4a13d05
fix crash
Sep 25, 2025
be6d356
Remove debug write statements
Sep 25, 2025
c3a2d47
invert ns and ew scalar derivatives
Sep 25, 2025
13289bc
fix some offset errors
Sep 25, 2025
33ba60f
remove start and end computation
Sep 25, 2025
12ae322
remove start and end computation
Sep 25, 2025
1e15620
indentation
Sep 25, 2025
68717ed
Fix order
Sep 25, 2025
60de653
rename the derivatives for u and v from ns to ew
Sep 25, 2025
7baa6aa
adding unit tests for field-api
Sep 26, 2025
9546644
Merge develop into field_api_interface branch
Sep 26, 2025
c71ce22
Merge branch 'field_api_interface_merge' into field_api_interface
Sep 26, 2025
ddde970
rename B into MAKE_FIELD
Oct 22, 2025
7a758a8
Merge remote-tracking branch 'ecmwf/develop' into field_api_interface
Nov 12, 2025
2bd0671
Make field_api a REQUIRED_PACKAGES
Nov 12, 2025
d3c5042
remove output_wrapped_fields, output_fields_lists and SYNCHOST_RDWR_W…
Nov 12, 2025
b682f3c
remove fspgl_intfg.h
Nov 12, 2025
dac476f
indentation and lower case
Nov 12, 2025
dafa4db
field_api_basic_type_mod.F90 is not precision specific anymore
Nov 12, 2025
620326d
change ectrans link instruction in CMake to include the plaftorm_tag
Nov 12, 2025
e636642
fix incorrect number of fields wrapped
Nov 12, 2025
3c506ab
rename local variables in field_api_helper
Nov 12, 2025
d05dc84
Fix compilation error with NVHPC after merge
Nov 12, 2025
41b01bd
Revert "field_api_basic_type_mod.F90 is not precision specific anymore"
Nov 13, 2025
b233e3d
Fix compilation error on MPI::MPI_Fortran
Nov 13, 2025
3fc859c
remove nvhpc compilation directives
Nov 13, 2025
008ef1d
adding documentation about wrapped_fields and fields_lists
Nov 13, 2025
41fd1f4
Fix wrong merge of dump_checksums
Nov 13, 2025
0bd76d1
fix build for ENABLE_GPU_AWARE_MPI=OFF
Nov 14, 2025
e673165
Revert "fix build for ENABLE_GPU_AWARE_MPI=OFF"
Nov 14, 2025
30dc1aa
improve compare_checksums
Nov 14, 2025
453eb0c
change unit tests for field_api
Nov 14, 2025
3c1e77a
split dump_checksuns into 4 functions
Nov 17, 2025
252d7a0
Merge branch 'develop' into field_api_interface
Nov 17, 2025
174b0b1
Revert "remove nvhpc compilation directives"
Nov 18, 2025
501fa6a
Fix uninitialized variable
Nov 20, 2025
c90fa73
change the way we link with Openccc for ectrans_field_api
Nov 20, 2025
f060de5
add conditional OpenACC compilation
Nov 21, 2025
28feac0
Merge remote-tracking branch 'ecmwf/develop' into field_api_interface
dhaumont Jan 6, 2026
d810d5f
Split long lines
dhaumont Jan 6, 2026
88af96b
Enable FIELD_API in HPC build configuration
dhaumont Jan 7, 2026
ae111c6
Disable field_api tests when feature FIELD_API is disabled
wdeconinck Jan 8, 2026
ce5ae51
Add field_api as dependency in build-hpc CI
wdeconinck Jan 8, 2026
9bf2044
Remove unique symbols for ectrans_field_api
wdeconinck Jan 8, 2026
d4768aa
Merge pull request #4 from wdeconinck/field_api_interface
dhaumont Jan 9, 2026
ecbf2d2
Unused variables
dhaumont Jan 9, 2026
059309a
Add intent in and missing kind
dhaumont Jan 9, 2026
7cc7912
Remove ISPUV
dhaumont Jan 9, 2026
c7af7ea
Refactor LS and LG with optional arguments and remove the JPASS that …
dhaumont Jan 9, 2026
fd0ef29
Fix crash with Intel compiler
Jan 9, 2026
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
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ if( (NOT HAVE_CPU) AND (NOT HAVE_GPU) )
endif()

if( HAVE_GPU )
if( HAVE_MPI)
ecbuild_find_package( NAME MPI REQUIRED COMPONENTS Fortran )
endif()
if( HAVE_ACC )
set( GPU_OFFLOAD "ACC" )
elseif( HAVE_OMP )
Expand Down Expand Up @@ -178,6 +181,12 @@ ecbuild_add_option( FEATURE ECTRANS4PY

ectrans_find_lapack()

ecbuild_add_option( FEATURE FIELD_API
DEFAULT OFF
DESCRIPTION "Compile field API interface to ectrans"
REQUIRED_PACKAGES "field_api"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed

)

### Add sources
include( ectrans_compile_options )
add_subdirectory( src )
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ add_subdirectory(etrans)
if(HAVE_ECTRANS4PY)
add_subdirectory(ectrans4py)
endif()
if(HAVE_FIELD_API)
add_subdirectory(field_api)
endif()
121 changes: 121 additions & 0 deletions src/field_api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

function(generate_file)
set (options)
set (oneValueArgs INPUT OUTPUT BACKEND)
set (multiValueArgs)
cmake_parse_arguments(_PAR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(output ${_PAR_OUTPUT})
set(input ${_PAR_INPUT})
set(backend ${_PAR_BACKEND})
set(sed_rules ${PROJECT_SOURCE_DIR}/src/field_api/sedrenames.txt)

set( JPRB_dp JPRD )
set( jprb_dp jprd )
set( JPRB_sp JPRM )
set( jprb_sp jprm )
set( JPRB_gpu_dp JPRD )
set( jprb_gpu_dp jprd )
set( JPRB_gpu_sp JPRM )
set( jprb_gpu_sp jprm )

add_custom_command(
OUTPUT ${output}
COMMAND cat ${sed_rules} |
sed -e "s/VARIANTDESIGNATOR/${backend}/g" |
sed -e "s/TYPEDESIGNATOR_UPPER/${JPRB_${backend}}/g" |
sed -e "s/TYPEDESIGNATOR_LOWER/${jprb_${backend}}/g" |
sed -rf - ${input} > ${output}
DEPENDS ${input} ${sed_rules}
COMMENT "Generating ${output}"
VERBATIM
)
endfunction(generate_file)

function(generate_backend_sources)
set (options)
set (oneValueArgs BACKEND DESTINATION OUTPUT)
set (multiValueArgs)

cmake_parse_arguments(_PAR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(backend ${_PAR_BACKEND})
set(destination ${_PAR_DESTINATION})

set(files)
list( APPEND files
field_api_ectrans_mod.F90
trans/dir_trans_field_api.F90
trans/inv_trans_field_api.F90
field_api_basic_type_mod.F90
)

set(outfiles)
foreach(file_i ${files})
get_filename_component(outfile_name ${file_i} NAME)
get_filename_component(outfile_name_we ${file_i} NAME_WE)
get_filename_component(outfile_ext ${file_i} EXT)
get_filename_component(outfile_dir ${file_i} DIRECTORY)
set(outfile "${destination}/${file_i}")

generate_file(BACKEND ${backend} INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${file_i} OUTPUT ${outfile})
list(APPEND outfiles ${outfile})
endforeach(file_i)
set(${_PAR_OUTPUT} ${outfiles} PARENT_SCOPE)
endfunction(generate_backend_sources)

set( BUILD_INTERFACE_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include/ectrans )

set (platforms)
if (HAVE_CPU)
list(APPEND platforms cpu)
endif()
if (HAVE_GPU)
list(APPEND platforms gpu)
endif()
foreach(platform ${platforms})
foreach( prec dp sp)
if( HAVE_${prec})
if (${platform} MATCHES "gpu")
set (platform_tag "gpu_")
else()
set (platform_tag "")
endif()

generate_backend_sources(BACKEND ${platform_tag}${prec}
OUTPUT ectrans_field_api_${platform_tag}${prec}_src
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/generated/ectrans_field_api_${platform_tag}${prec})

ecbuild_add_library(
TARGET ectrans_field_api_${platform_tag}${prec}
LINKER_LANGUAGE Fortran
SOURCES ${ectrans_field_api_${platform_tag}${prec}_src}
PUBLIC_LIBS ectrans_${platform_tag}${prec} field_api_${prec} fiat parkind_${prec}
PUBLIC_INCLUDES $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/trans/include/ectrans>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/field_api/include>
)

ectrans_target_fortran_module_directory(
TARGET ectrans_field_api_${platform_tag}${prec}
MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/module/ectrans
INSTALL_DIRECTORY module/ectrans
)

if (${platform} MATCHES "gpu")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wdeconinck Are these lines to add -acc compilation OK, or should I proceed in another way?

if( CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC" )
set_source_files_properties( ${ectrans_field_api_${platform_tag}${prec}_src} PROPERTIES COMPILE_OPTIONS "-acc" )
# set_source_files_properties( ${ectrans_field_api_${platform_tag}${prec}_src} PROPERTIES COMPILE_OPTIONS "-O1" )
endif()
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fix how OpenACC is linked in:

Suggested change
if (${platform} MATCHES "gpu")
if( CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC" )
set_source_files_properties( ${ectrans_field_api_${platform_tag}${prec}_src} PROPERTIES COMPILE_OPTIONS "-acc" )
# set_source_files_properties( ${ectrans_field_api_${platform_tag}${prec}_src} PROPERTIES COMPILE_OPTIONS "-O1" )
endif()
endif()
if (${platform} MATCHES "gpu")
if (HAVE_ACC)
target_link_libraries( ectrans_field_api_${platform_tag}${prec} PRIVATE OpenACC::OpenACC_Fortran )
endif()
endif()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wdeconinck
Not sure what to do here. I just removed the instructions from L109 to 114, which had nothing to do with linkin,. they were adding the compilation options -acc -o1 to the field_api interface file.
I did not add the target_link_libraries, and it seems that everything compiles fine without.
Is it mandatory ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UPDATE: I had to put them back, otherwise the files in the field_api folder were not compiled with "-acc"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Normally target_link_libraries( ectrans_field_api_${platform_tag}${prec} PRIVATE OpenACC::OpenACC_Fortran ) should do a number of things given OpenACC::OpenACC_Fortran is a cmake target:

  • compile the files with the -acc flag and others possibly when defined in the toolchain as "OpenACC_Fortran_FLAGS"
  • add link flags or link libraries
  • add include directories defined by the target

Because it is marked as PRIVATE it does not propagate the compile flags to downstream, which is good. But then when downstream also needs those flags then that code is responsible to link with OpenACC itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wdeconinck Thanks for the explanation. It is fixed now

endif()

endforeach()
endforeach()



24 changes: 24 additions & 0 deletions src/field_api/field_api_basic_type_mod.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
! (C) Copyright 2001- ECMWF.
! (C) Copyright 2001- Meteo-France.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
! In applying this licence, ECMWF does not waive the privileges and immunities
! granted to it by virtue of its status as an intergovernmental organisation
! nor does it submit to any jurisdiction.

MODULE FIELD_API_BASIC_TYPE_MOD

USE FIELD_BASIC_MODULE, ONLY: FIELD_BASIC

IMPLICIT NONE

TYPE FIELD_BASIC_PTR
! A pointer to field API field with additional METADA
CLASS (FIELD_BASIC), POINTER :: PTR ! POINTER TO FIELD_BASIC from field API
INTEGER, ALLOCATABLE :: IVSET(:) ! b-set for spectral fields
CHARACTER(LEN=10) :: NAME ! Name
END TYPE

END MODULE FIELD_API_BASIC_TYPE_MOD

Loading