From c36ff9fcc8ccb218ab9fc49997d6d839489c2125 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 3 Oct 2023 10:30:02 -0400 Subject: [PATCH 1/6] Fixes for NVHPC --- Apps/Regrid_Util.F90 | 2 +- CHANGELOG.md | 2 ++ docs/tutorial/driver_app/Example_Driver.F90 | 1 + generic/OpenMP_Support.F90 | 5 ++++- gridcomps/Cap/FargparseCLI.F90 | 8 ++++---- .../History/MAPL_HistoryTrajectoryMod.F90 | 6 +++--- .../MAPL_HistoryTrajectoryMod_smod.F90 | 4 ++-- griddedio/TileIO.F90 | 20 +++++++++---------- 8 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Apps/Regrid_Util.F90 b/Apps/Regrid_Util.F90 index 7a247d05c615..5ce9f17d2d44 100644 --- a/Apps/Regrid_Util.F90 +++ b/Apps/Regrid_Util.F90 @@ -338,7 +338,7 @@ Program Regrid_Util subroutine main() - type(regrid_support) :: support + type(regrid_support), target :: support type(ESMF_VM) :: vm ! ESMF Virtual Machine diff --git a/CHANGELOG.md b/CHANGELOG.md index 71812fc383f8..05a14a0a6bc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Various fixes for NVHPCP work + ### Removed ### Deprecated diff --git a/docs/tutorial/driver_app/Example_Driver.F90 b/docs/tutorial/driver_app/Example_Driver.F90 index f974d002a624..b967506b94c0 100644 --- a/docs/tutorial/driver_app/Example_Driver.F90 +++ b/docs/tutorial/driver_app/Example_Driver.F90 @@ -5,6 +5,7 @@ program Example_Driver use MPI use MAPL + use mapl_CapOptionsMod, only: MAPL_CapOptions implicit none type (MAPL_Cap) :: cap diff --git a/generic/OpenMP_Support.F90 b/generic/OpenMP_Support.F90 index a6919efa4182..a00d53e3c4b8 100644 --- a/generic/OpenMP_Support.F90 +++ b/generic/OpenMP_Support.F90 @@ -595,6 +595,7 @@ subroutine copy_callbacks(state, multi_states, rc) type(CallbackMethodWrapper), pointer :: wrapper type(CallbackMap), pointer :: callbacks type(CallbackMapIterator) :: iter + procedure(), pointer :: userRoutine n_multi = size(multi_states) call get_callbacks(state, callbacks, _RC) @@ -604,7 +605,9 @@ subroutine copy_callbacks(state, multi_states, rc) do while (iter /= e) wrapper => iter%second() do i = 1, n_multi - call ESMF_MethodAdd(multi_states(i), label=iter%first(), userRoutine=wrapper%userRoutine, _RC) + !call ESMF_MethodAdd(multi_states(i), label=iter%first(), userRoutine=wrapper%userRoutine, _RC) + userRoutine => wrapper%userRoutine + call ESMF_MethodAdd(multi_states(i), label=iter%first(), userRoutine=userRoutine, _RC) end do call iter%next() end do diff --git a/gridcomps/Cap/FargparseCLI.F90 b/gridcomps/Cap/FargparseCLI.F90 index 68360a1b0a5f..a20695b722fb 100644 --- a/gridcomps/Cap/FargparseCLI.F90 +++ b/gridcomps/Cap/FargparseCLI.F90 @@ -8,7 +8,7 @@ module MAPL_FargparseCLIMod use gFTL2_IntegerVector use mapl_KeywordEnforcerMod use mapl_ExceptionHandling - use mapl_CapOptionsMod, only: MAPL_CapOptions !Rename is for backward compatibility. Remove renaming for 3.0 + use mapl_CapOptionsMod, only: MAPL_CapOptions_ => MAPL_CapOptions !Rename is for backward compatibility. Remove renaming for 3.0 implicit none private @@ -45,7 +45,7 @@ subroutine I_extraoptions(parser, rc) function new_CapOptions_from_fargparse(unusable, dummy, extra, rc) result (cap_options) class(KeywordEnforcer), optional, intent(in) :: unusable - type (MAPL_CapOptions) :: cap_options + type (MAPL_CapOptions_) :: cap_options character(*), intent(in) :: dummy !Needed for backward compatibility. Remove after 3.0 procedure(I_extraoptions), optional :: extra integer, optional, intent(out) :: rc @@ -230,7 +230,7 @@ end subroutine add_command_line_options subroutine fill_cap_options(fargparseCLI, cap_options, unusable, rc) class(MAPL_FargparseCLI), intent(inout) :: fargparseCLI - type(MAPL_CapOptions), intent(out) :: cap_options + type(MAPL_CapOptions_), intent(out) :: cap_options class(KeywordEnforcer), optional, intent(in) :: unusable integer, optional, intent(out) :: rc integer :: status @@ -416,7 +416,7 @@ end subroutine fill_cap_options !Function for backward compatibility. Remove for 3.0 function old_CapOptions_from_Fargparse( fargparseCLI, unusable, rc) result (cap_options) - type (MAPL_CapOptions) :: cap_options + type (MAPL_CapOptions_) :: cap_options type (MAPL_FargparseCLI), intent(inout) :: fargparseCLI class (KeywordEnforcer), optional, intent(in) :: unusable integer, optional, intent(out) :: rc diff --git a/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 b/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 index aa5755f6aaf7..f9722b7693f4 100644 --- a/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 +++ b/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 @@ -78,7 +78,7 @@ module HistoryTrajectoryMod integer :: obsfile_Te_index logical :: is_valid contains - procedure :: initialize + procedure :: initialize => initialize_ procedure :: reinitialize procedure :: create_variable => create_metadata_variable procedure :: create_file_handle @@ -113,7 +113,7 @@ module function HistoryTrajectory_from_config(config,string,clock,rc) result(tra integer, optional, intent(out) :: rc end function HistoryTrajectory_from_config - module subroutine initialize(this,items,bundle,timeInfo,vdata,recycle_track,rc) + module subroutine initialize_(this,items,bundle,timeInfo,vdata,recycle_track,rc) class(HistoryTrajectory), intent(inout) :: this type(GriddedIOitemVector), target, intent(inout) :: items type(ESMF_FieldBundle), intent(inout) :: bundle @@ -121,7 +121,7 @@ module subroutine initialize(this,items,bundle,timeInfo,vdata,recycle_track,rc) type(VerticalData), optional, intent(inout) :: vdata logical, optional, intent(inout) :: recycle_track integer, optional, intent(out) :: rc - end subroutine initialize + end subroutine initialize_ module subroutine reinitialize(this,rc) class(HistoryTrajectory), intent(inout) :: this diff --git a/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 b/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 index 3760c8b54cbf..9a4e30309310 100644 --- a/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 +++ b/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 @@ -140,7 +140,7 @@ end procedure - module procedure initialize + module procedure initialize_ integer :: status type(ESMF_Grid) :: grid type(variable) :: v @@ -223,7 +223,7 @@ _RETURN(_SUCCESS) - end procedure initialize + end procedure initialize_ module procedure reinitialize diff --git a/griddedio/TileIO.F90 b/griddedio/TileIO.F90 index 7b55aca9609c..88a5a518c1d5 100644 --- a/griddedio/TileIO.F90 +++ b/griddedio/TileIO.F90 @@ -12,6 +12,10 @@ module MAPL_TileIOMod private + type tile_buffer + real, allocatable :: ptr(:) + end type + type, public :: MAPL_TileIO private type(ESMF_FieldBundle) :: bundle @@ -22,10 +26,6 @@ module MAPL_TileIOMod procedure :: process_data_from_file end type MAPL_TileIO - type tile_buffer - real, allocatable :: ptr(:) - end type - interface MAPL_TileIO module procedure new_MAPL_TileIO end interface MAPL_TileIO @@ -40,13 +40,13 @@ function new_MAPL_TileIO(bundle,read_collection_id) result(TileIO) TileIO%bundle = bundle TileIO%read_collection_id = read_collection_id end function - + subroutine request_data_from_file(this,filename,timeindex,rc) class(MAPL_TileIO), intent(inout) :: this character(len=*), intent(in) :: filename integer, intent(in) :: timeindex integer, intent(out), optional :: rc - + integer :: status integer :: num_vars,i,rank type(ArrayReference) :: ref @@ -76,10 +76,10 @@ subroutine request_data_from_file(this,filename,timeindex,rc) allocate(this%tile_buffer(i)%ptr((0)),_STAT) end if ref = ArrayReference(this%tile_buffer(i)%ptr) - call i_clients%collective_prefetch_data(this%read_collection_id, filename, trim(names(i)), ref, & + call i_clients%collective_prefetch_data(this%read_collection_id, filename, trim(names(i)), ref, & start=local_start, global_start=global_start, global_count = global_count) - deallocate(local_start,global_start,global_count) - else + deallocate(local_start,global_start,global_count) + else _FAIL("rank >1 tile fields not supported") end if end do @@ -117,5 +117,5 @@ subroutine process_data_from_file(this,rc) deallocate(this%tile_buffer) _RETURN(_SUCCESS) end subroutine - + end module From 7a479afc23553e36f9d9ed1aff7a8e4930f070ad Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 4 Oct 2023 11:54:30 -0400 Subject: [PATCH 2/6] Submodule issue --- gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 b/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 index 9a4e30309310..704c2fb28993 100644 --- a/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 +++ b/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 @@ -540,7 +540,9 @@ if (mapl_am_I_root()) then - call sort_multi_arrays_by_time(lons_full, lats_full, times_R8_full, obstype_id_full, _RC) + ! NVHPC dies with NVFORTRAN-S-0155-Could not resolve generic procedure sort_multi_arrays_by_time + !call sort_multi_arrays_by_time(lons_full, lats_full, times_R8_full, obstype_id_full, _RC) + call sort_four_arrays_by_time(lons_full, lats_full, times_R8_full, obstype_id_full, _RC) call ESMF_ClockGet(this%clock,currTime=current_time,_RC) timeset(1) = current_time timeset(2) = current_time + this%epoch_frequency From 1a7f9e8b68a70871641e8aab8914011e15ec4242 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 22 Jan 2024 08:21:30 -0500 Subject: [PATCH 3/6] Fix bad merge --- gridcomps/History/MAPL_HistoryTrajectoryMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 b/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 index 3e90859c9f8a..060e33756aee 100644 --- a/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 +++ b/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 @@ -95,7 +95,7 @@ module function HistoryTrajectory_from_config(config,string,clock,rc) result(tra integer, optional, intent(out) :: rc end function HistoryTrajectory_from_config - module subroutine initialize_(this,items,bundle,timeInfo,vdata,recycle_track,rc) + module subroutine initialize_(this,items,bundle,timeInfo,vdata,reinitialize,rc) class(HistoryTrajectory), intent(inout) :: this type(GriddedIOitemVector), optional, intent(inout) :: items type(ESMF_FieldBundle), optional, intent(inout) :: bundle From d71b7cdb8deb01105f7505a95beb1833ed4884ab Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 22 Jan 2024 10:14:20 -0500 Subject: [PATCH 4/6] One more merge fix --- gridcomps/History/MAPL_HistoryTrajectoryMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 b/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 index 060e33756aee..9efd6ca1ac25 100644 --- a/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 +++ b/gridcomps/History/MAPL_HistoryTrajectoryMod.F90 @@ -69,7 +69,6 @@ module HistoryTrajectoryMod logical :: active contains procedure :: initialize => initialize_ - procedure :: reinitialize procedure :: create_variable => create_metadata_variable procedure :: create_file_handle procedure :: close_file_handle From ef867a17e1d17a34f0d416e4e08e1e9a02828785 Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Thu, 8 Feb 2024 12:33:32 -0500 Subject: [PATCH 5/6] Update gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 --- gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 b/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 index 0ff9bd14b4a0..d266b34e1f93 100644 --- a/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 +++ b/gridcomps/History/MAPL_HistoryTrajectoryMod_smod.F90 @@ -647,7 +647,6 @@ if (mapl_am_I_root()) then ! NVHPC dies with NVFORTRAN-S-0155-Could not resolve generic procedure sort_multi_arrays_by_time - !call sort_multi_arrays_by_time(lons_full, lats_full, times_R8_full, obstype_id_full, _RC) call sort_four_arrays_by_time(lons_full, lats_full, times_R8_full, obstype_id_full, _RC) call ESMF_ClockGet(this%clock,currTime=current_time,_RC) timeset(1) = current_time From 54a944183f8882aa02adcc4158aa8b87165fcee8 Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Thu, 8 Feb 2024 12:34:49 -0500 Subject: [PATCH 6/6] Update generic/OpenMP_Support.F90 --- generic/OpenMP_Support.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/OpenMP_Support.F90 b/generic/OpenMP_Support.F90 index a00d53e3c4b8..c2742a6c9a6c 100644 --- a/generic/OpenMP_Support.F90 +++ b/generic/OpenMP_Support.F90 @@ -605,7 +605,6 @@ subroutine copy_callbacks(state, multi_states, rc) do while (iter /= e) wrapper => iter%second() do i = 1, n_multi - !call ESMF_MethodAdd(multi_states(i), label=iter%first(), userRoutine=wrapper%userRoutine, _RC) userRoutine => wrapper%userRoutine call ESMF_MethodAdd(multi_states(i), label=iter%first(), userRoutine=userRoutine, _RC) end do