From 582258e1098582d0c4a079088eb39341584fe224 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Fri, 17 May 2024 16:18:15 -0400 Subject: [PATCH 01/17] generic io --- GeomIO/Grid_PFIO.F90 | 38 +++++++++----- GeomIO/SharedIO.F90 | 114 +++++++++++++++++++++++++++++++++++++++- pfio/ArrayReference.F90 | 12 ++++- 3 files changed, 150 insertions(+), 14 deletions(-) diff --git a/GeomIO/Grid_PFIO.F90 b/GeomIO/Grid_PFIO.F90 index 88933d46e2d2..e4092b34e17b 100644 --- a/GeomIO/Grid_PFIO.F90 +++ b/GeomIO/Grid_PFIO.F90 @@ -3,9 +3,12 @@ module mapl3g_GridPFIO use mapl_ErrorHandling use mapl3g_GeomPFIO + use mapl3g_SharedIO use ESMF use PFIO use MAPL_BaseMod + use MAPL_FieldPointerUtilities + use, intrinsic :: iso_c_binding, only: c_ptr implicit none private @@ -30,11 +33,13 @@ subroutine stage_data_to_file(this, bundle, filename, time_index, rc) character(len=ESMF_MAXSTR), allocatable :: field_names(:) type(ESMF_Field) :: field type(ArrayReference) :: ref - real, pointer :: ptr2d(:,:) integer, allocatable :: local_start(:), global_start(:), global_count(:) + type(c_ptr) :: address + integer :: type_kind + type(ESMF_TypeKind_Flag) :: tk + integer, allocatable :: element_count(:), new_element_count(:) type(ESMF_Grid) :: grid - integer :: global_dim(3), i1, j1, in, jn collection_id = this%get_collection_id() call ESMF_FieldBundleGet(bundle, fieldCount=num_fields, _RC) @@ -42,16 +47,25 @@ subroutine stage_data_to_file(this, bundle, filename, time_index, rc) call ESMF_FieldBundleGet(bundle, fieldNameList=field_names, _RC) do i=1,num_fields call ESMF_FieldBundleGet(bundle, field_names(i), field=field, _RC) - ! all this logic needs to be generalized - call ESMF_FieldGet(field, farrayPtr=ptr2d, _RC) - allocate(global_start, source=[1,1,time_index]) - call ESMF_FieldGet(field, grid=grid, _RC) - call MAPL_GridGet(grid, globalCellCountPerDim=global_dim, _RC) - allocate(global_count, source=[global_dim(1),global_dim(2),1]) - call MAPL_GridGetInterior(grid, i1, in, j1, jn) - allocate(local_start, source=[i1, j1,1]) - ref = ArrayReference(ptr2d) - ! end generalization + + ! shape for server + element_count = FieldGetLocalElementCount(field, _RC) + call ESMF_FieldGet(field, grid=grid, typekind=tk, _RC) + + global_start = create_global_start(grid, element_count, time_index, _RC) + global_count = create_global_count(grid, element_count, _RC) + local_start = create_local_start(grid, element_count, _RC) + print*,'gs ',global_start + print*,'gc ',global_count + print*,'ls ',local_start + + ! generate array reference + call FieldGetCptr(field, address, _RC) + type_kind = esmf_to_pfio_type(tk, _RC) + new_element_count = create_file_shape(grid, element_count, _RC) + print*,'ne ',new_element_count + ref = ArrayReference(address, type_kind, new_element_count) + call o_clients%collective_stage_data(collection_id,filename, trim(field_names(i)), & ref, start=local_start, global_start=global_start, global_count=global_count) enddo diff --git a/GeomIO/SharedIO.F90 b/GeomIO/SharedIO.F90 index 250f2c7833e1..df0464b09d4f 100644 --- a/GeomIO/SharedIO.F90 +++ b/GeomIO/SharedIO.F90 @@ -5,6 +5,7 @@ module mapl3g_SharedIO use pfio use gFTL2_StringVector use mapl3g_geom_mgr + use MAPL_BaseMod implicit none @@ -13,9 +14,121 @@ module mapl3g_SharedIO public get_mapl_geom public create_time_variable public bundle_to_metadata + public esmf_to_pfio_type + public create_local_start + public create_global_count + public create_global_start + public create_file_shape contains + function create_file_shape(grid, field_shape, rc) result(file_shape) + integer, allocatable :: file_shape(:) + type(ESMF_Grid), intent(in) :: grid + integer, intent(in) :: field_shape(:) + integer, intent(out), optional :: rc + + integer :: status, sz, ungr, tile_count + call ESMF_GridGet(grid, tileCount=tile_count, _RC) + sz = size(field_shape) + ungr = sz - 2 + if (tile_count == 6) then + allocate(file_shape(sz+1)) + file_shape(1:sz+1) = [field_shape(1), field_shape(2), 1] + file_shape(3:ungr) = [field_shape(2+ungr:sz)] + else if (tile_count == 1) then + file_shape = field_shape + else + _FAIL("unsupported grid") + end if + + _RETURN(_SUCCESS) + end function create_file_shape + + function create_global_start(grid, field_shape, time_index, rc) result(global_start) + integer, allocatable :: global_start(:) + type(ESMF_Grid), intent(in) :: grid + integer, intent(in) :: field_shape(:) + integer, intent(in) :: time_index + integer, intent(out), optional :: rc + + integer :: status, sz, tile_count + call ESMF_GridGet(grid, tileCount=tile_count, _RC) + sz = size(field_shape) + + if (tile_count == 6) then + allocate(global_start(sz+2)) + global_start(1:sz+1) = 1 + global_start(sz+2) = time_index + else if (tile_count == 1) then + allocate(global_start(sz+1)) + global_start(1:sz) = 1 + global_start(sz+1) = time_index + else + _FAIL("unsupported grid") + end if + + _RETURN(_SUCCESS) + end function create_global_start + + function create_global_count(grid, field_shape, rc) result(global_count) + integer, allocatable :: global_count(:) + type(ESMF_Grid), intent(in) :: grid + integer, intent(in) :: field_shape(:) + integer, intent(out), optional :: rc + + integer :: status, sz, ungr, tile_count, global_dim(3) + call ESMF_GridGet(grid, tileCount=tile_count, _RC) + call MAPL_GridGet(grid, globalCellCountPerDim=global_dim, _RC) + sz = size(field_shape) + ungr = sz - 2 + + if (tile_count == 6) then + allocate(global_count(sz+2)) + global_count(1:3) =[global_dim(1),global_dim(1),6] + global_count(4:4+ungr-1) = field_shape(3:sz) + global_count(sz+2) = 1 + else if (tile_count == 1) then + allocate(global_count(sz+1)) + global_count(1:2) =[global_dim(1),global_dim(2)] + global_count(3:3+ungr-1) = field_shape(3:sz) + global_count(sz+1) = 1 + else + _FAIL("unsupported grid") + end if + + + _RETURN(_SUCCESS) + end function create_global_count + + function create_local_start(grid, field_shape, rc) result(local_start) + integer, allocatable :: local_start(:) + type(ESMF_Grid), intent(in) :: grid + integer, intent(in) :: field_shape(:) + integer, intent(out), optional :: rc + + integer :: status, sz, ungr, tile_count, i1, in, j1, jn, tile, global_dim(3) + call ESMF_GridGet(grid, tileCount=tile_count, _RC) + call MAPL_GridGetInterior(grid, i1,in, j1, jn) + call MAPL_GridGet(grid, globalCellCountPerDim=global_dim, _RC) + sz = size(field_shape) + ungr = sz - 2 + if (tile_count == 6) then + tile = 1 + (j1-1)/global_dim(1) + allocate(local_start(sz+2)) + local_start(1:3) = [i1, j1-(tile-1)*global_dim(1),tile] + local_start(4:4+ungr) = 1 + else if (tile_count == 1) then + allocate(local_start(sz+1)) + local_start(1:2) = [i1,j1] + local_start(3:3+ungr) = 1 + else + _FAIL("unsupported grid") + end if + + _RETURN(_SUCCESS) + end function create_local_start + function bundle_to_metadata(bundle, geom, rc) result(metadata) type(FileMetaData) :: metadata type(ESMF_FieldBundle), intent(in) :: bundle @@ -86,7 +199,6 @@ subroutine add_variable(metadata, field, rc) mapl_geom => get_mapl_geom(esmfgeom, _RC) grid_variables = mapl_geom%get_gridded_dims() dims = string_vec_to_comma_sep(grid_variables) - dims = 'lon,lat' call ESMF_FieldGet(field, name=fname, typekind = typekind, _RC) ! add vertical dimension diff --git a/pfio/ArrayReference.F90 b/pfio/ArrayReference.F90 index 67a9635ea132..25074f7a8c69 100644 --- a/pfio/ArrayReference.F90 +++ b/pfio/ArrayReference.F90 @@ -3,7 +3,7 @@ module pFIO_ArrayReferenceMod use, intrinsic :: iso_c_binding, only: C_NULL_PTR - use, intrinsic :: iso_c_binding, only: c_loc + use, intrinsic :: iso_c_binding, only: c_loc, c_ptr use, intrinsic :: iso_fortran_env, only: INT32 use, intrinsic :: iso_fortran_env, only: INT64 use, intrinsic :: iso_fortran_env, only: REAL32 @@ -25,6 +25,7 @@ module pFIO_ArrayReferenceMod end type ArrayReference interface ArrayReference + module procedure new_ArrayReference_from_param module procedure new_ArrayReference_0d module procedure new_ArrayReference_1d module procedure new_ArrayReference_2d @@ -35,6 +36,15 @@ module pFIO_ArrayReferenceMod contains + function new_ArrayReference_from_param(in_c_loc, in_kind, in_shape) result(reference) + type (ArrayReference) :: reference + type(c_ptr), intent(in) :: in_c_loc + integer, intent(in) :: in_kind + integer, intent(in) :: in_shape(:) + reference%base_address = in_c_loc + reference%shape = in_shape + reference%type_kind = in_kind + end function function new_ArrayReference_0d(scalar, rc) result(reference) type (ArrayReference) :: reference From 8b9a61f1db0c84405c01df2835bcb3288c13c7a3 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Fri, 17 May 2024 16:18:57 -0400 Subject: [PATCH 02/17] remove comment --- GeomIO/Grid_PFIO.F90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/GeomIO/Grid_PFIO.F90 b/GeomIO/Grid_PFIO.F90 index e4092b34e17b..a29f4774d63d 100644 --- a/GeomIO/Grid_PFIO.F90 +++ b/GeomIO/Grid_PFIO.F90 @@ -55,15 +55,11 @@ subroutine stage_data_to_file(this, bundle, filename, time_index, rc) global_start = create_global_start(grid, element_count, time_index, _RC) global_count = create_global_count(grid, element_count, _RC) local_start = create_local_start(grid, element_count, _RC) - print*,'gs ',global_start - print*,'gc ',global_count - print*,'ls ',local_start ! generate array reference call FieldGetCptr(field, address, _RC) type_kind = esmf_to_pfio_type(tk, _RC) new_element_count = create_file_shape(grid, element_count, _RC) - print*,'ne ',new_element_count ref = ArrayReference(address, type_kind, new_element_count) call o_clients%collective_stage_data(collection_id,filename, trim(field_names(i)), & From 05a7f1973f4b4da106dc625eb0e0f1cf76cc08ca Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Fri, 17 May 2024 16:24:34 -0400 Subject: [PATCH 03/17] make time optional --- GeomIO/Grid_PFIO.F90 | 7 +++---- GeomIO/SharedIO.F90 | 31 ++++++++++++++++++------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/GeomIO/Grid_PFIO.F90 b/GeomIO/Grid_PFIO.F90 index a29f4774d63d..c4d92ffadd67 100644 --- a/GeomIO/Grid_PFIO.F90 +++ b/GeomIO/Grid_PFIO.F90 @@ -48,13 +48,12 @@ subroutine stage_data_to_file(this, bundle, filename, time_index, rc) do i=1,num_fields call ESMF_FieldBundleGet(bundle, field_names(i), field=field, _RC) - ! shape for server element_count = FieldGetLocalElementCount(field, _RC) call ESMF_FieldGet(field, grid=grid, typekind=tk, _RC) - global_start = create_global_start(grid, element_count, time_index, _RC) - global_count = create_global_count(grid, element_count, _RC) - local_start = create_local_start(grid, element_count, _RC) + global_start = create_global_start(grid, element_count, time_index=time_index, _RC) + global_count = create_global_count(grid, element_count, have_time=.true., _RC) + local_start = create_local_start(grid, element_count, have_time=.true., _RC) ! generate array reference call FieldGetCptr(field, address, _RC) diff --git a/GeomIO/SharedIO.F90 b/GeomIO/SharedIO.F90 index df0464b09d4f..d74d964b7261 100644 --- a/GeomIO/SharedIO.F90 +++ b/GeomIO/SharedIO.F90 @@ -49,7 +49,7 @@ function create_global_start(grid, field_shape, time_index, rc) result(global_st integer, allocatable :: global_start(:) type(ESMF_Grid), intent(in) :: grid integer, intent(in) :: field_shape(:) - integer, intent(in) :: time_index + integer, optional, intent(in) :: time_index integer, intent(out), optional :: rc integer :: status, sz, tile_count @@ -71,28 +71,30 @@ function create_global_start(grid, field_shape, time_index, rc) result(global_st _RETURN(_SUCCESS) end function create_global_start - function create_global_count(grid, field_shape, rc) result(global_count) + function create_global_count(grid, field_shape, have_time, rc) result(global_count) integer, allocatable :: global_count(:) type(ESMF_Grid), intent(in) :: grid integer, intent(in) :: field_shape(:) + logical, optional, intent(in) :: have_time integer, intent(out), optional :: rc - integer :: status, sz, ungr, tile_count, global_dim(3) + integer :: status, sz, ungr, tile_count, global_dim(3), tm + if (present(have_time)) tm=1 call ESMF_GridGet(grid, tileCount=tile_count, _RC) call MAPL_GridGet(grid, globalCellCountPerDim=global_dim, _RC) sz = size(field_shape) ungr = sz - 2 if (tile_count == 6) then - allocate(global_count(sz+2)) + allocate(global_count(sz+1+tm)) global_count(1:3) =[global_dim(1),global_dim(1),6] global_count(4:4+ungr-1) = field_shape(3:sz) - global_count(sz+2) = 1 + if (have_time) global_count(sz+2) = 1 else if (tile_count == 1) then - allocate(global_count(sz+1)) + allocate(global_count(sz+tm)) global_count(1:2) =[global_dim(1),global_dim(2)] global_count(3:3+ungr-1) = field_shape(3:sz) - global_count(sz+1) = 1 + if (have_time) global_count(sz+1) = 1 else _FAIL("unsupported grid") end if @@ -101,27 +103,30 @@ function create_global_count(grid, field_shape, rc) result(global_count) _RETURN(_SUCCESS) end function create_global_count - function create_local_start(grid, field_shape, rc) result(local_start) + function create_local_start(grid, field_shape, have_time, rc) result(local_start) integer, allocatable :: local_start(:) type(ESMF_Grid), intent(in) :: grid integer, intent(in) :: field_shape(:) + logical, optional, intent(in) :: have_time integer, intent(out), optional :: rc - integer :: status, sz, ungr, tile_count, i1, in, j1, jn, tile, global_dim(3) + integer :: status, sz, ungr, tile_count, i1, in, j1, jn, tile, global_dim(3), tm call ESMF_GridGet(grid, tileCount=tile_count, _RC) call MAPL_GridGetInterior(grid, i1,in, j1, jn) call MAPL_GridGet(grid, globalCellCountPerDim=global_dim, _RC) + tm=0 + if (present(have_time)) tm=1 sz = size(field_shape) ungr = sz - 2 if (tile_count == 6) then tile = 1 + (j1-1)/global_dim(1) - allocate(local_start(sz+2)) + allocate(local_start(sz+1+tm)) local_start(1:3) = [i1, j1-(tile-1)*global_dim(1),tile] - local_start(4:4+ungr) = 1 + if (have_time) local_start(4:4+ungr) = 1 else if (tile_count == 1) then - allocate(local_start(sz+1)) + allocate(local_start(sz+tm)) local_start(1:2) = [i1,j1] - local_start(3:3+ungr) = 1 + if (have_time) local_start(3:3+ungr) = 1 else _FAIL("unsupported grid") end if From 7206057e2337763a302394f7e9943928954d4c2c Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Fri, 17 May 2024 16:31:33 -0400 Subject: [PATCH 04/17] fix bug --- GeomIO/SharedIO.F90 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/GeomIO/SharedIO.F90 b/GeomIO/SharedIO.F90 index d74d964b7261..ee3c3a2d8445 100644 --- a/GeomIO/SharedIO.F90 +++ b/GeomIO/SharedIO.F90 @@ -52,18 +52,20 @@ function create_global_start(grid, field_shape, time_index, rc) result(global_st integer, optional, intent(in) :: time_index integer, intent(out), optional :: rc - integer :: status, sz, tile_count + integer :: status, sz, tile_count, tm call ESMF_GridGet(grid, tileCount=tile_count, _RC) sz = size(field_shape) + tm = 0 + if (present(time_index)) tm=1 if (tile_count == 6) then - allocate(global_start(sz+2)) + allocate(global_start(sz+1+tm)) global_start(1:sz+1) = 1 - global_start(sz+2) = time_index + if (present(time_index)) global_start(sz+2) = time_index else if (tile_count == 1) then - allocate(global_start(sz+1)) + allocate(global_start(sz+tm)) global_start(1:sz) = 1 - global_start(sz+1) = time_index + if (present(time_index)) global_start(sz+1) = time_index else _FAIL("unsupported grid") end if From 3b40e69de7529af83a99f6d590f924f9f64052f5 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Fri, 17 May 2024 16:41:51 -0400 Subject: [PATCH 05/17] fix bug --- GeomIO/SharedIO.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GeomIO/SharedIO.F90 b/GeomIO/SharedIO.F90 index ee3c3a2d8445..aba155a97985 100644 --- a/GeomIO/SharedIO.F90 +++ b/GeomIO/SharedIO.F90 @@ -34,8 +34,8 @@ function create_file_shape(grid, field_shape, rc) result(file_shape) ungr = sz - 2 if (tile_count == 6) then allocate(file_shape(sz+1)) - file_shape(1:sz+1) = [field_shape(1), field_shape(2), 1] - file_shape(3:ungr) = [field_shape(2+ungr:sz)] + file_shape(1:3) = [field_shape(1), field_shape(2), 1] + file_shape(4:4+ungr-1) = [field_shape(2+ungr:sz)] else if (tile_count == 1) then file_shape = field_shape else From b09015489608720139aef23394fe768e38e52580 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Fri, 17 May 2024 16:45:04 -0400 Subject: [PATCH 06/17] fix bug --- GeomIO/SharedIO.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GeomIO/SharedIO.F90 b/GeomIO/SharedIO.F90 index aba155a97985..41ffd93d7e73 100644 --- a/GeomIO/SharedIO.F90 +++ b/GeomIO/SharedIO.F90 @@ -122,13 +122,13 @@ function create_local_start(grid, field_shape, have_time, rc) result(local_start ungr = sz - 2 if (tile_count == 6) then tile = 1 + (j1-1)/global_dim(1) + local_start=1 allocate(local_start(sz+1+tm)) local_start(1:3) = [i1, j1-(tile-1)*global_dim(1),tile] - if (have_time) local_start(4:4+ungr) = 1 else if (tile_count == 1) then allocate(local_start(sz+tm)) + local_start=1 local_start(1:2) = [i1,j1] - if (have_time) local_start(3:3+ungr) = 1 else _FAIL("unsupported grid") end if From ef78c108869ada093f844e2a294bb8d43fd381a4 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Fri, 17 May 2024 16:45:34 -0400 Subject: [PATCH 07/17] fix bug --- GeomIO/SharedIO.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeomIO/SharedIO.F90 b/GeomIO/SharedIO.F90 index 41ffd93d7e73..052993f5c819 100644 --- a/GeomIO/SharedIO.F90 +++ b/GeomIO/SharedIO.F90 @@ -122,8 +122,8 @@ function create_local_start(grid, field_shape, have_time, rc) result(local_start ungr = sz - 2 if (tile_count == 6) then tile = 1 + (j1-1)/global_dim(1) - local_start=1 allocate(local_start(sz+1+tm)) + local_start=1 local_start(1:3) = [i1, j1-(tile-1)*global_dim(1),tile] else if (tile_count == 1) then allocate(local_start(sz+tm)) From 517ade9fa35c1a809d54fcd9452bb97bc00fa3ec Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Mon, 20 May 2024 11:45:12 -0400 Subject: [PATCH 08/17] combine into one derived type --- GeomIO/CMakeLists.txt | 1 + GeomIO/Grid_PFIO.F90 | 13 ++-- GeomIO/SharedIO.F90 | 118 ----------------------------------- GeomIO/pFIOServerBounds.F90 | 120 ++++++++++++++++++++++++++++++++++++ pfio/ArrayReference.F90 | 14 ++--- 5 files changed, 136 insertions(+), 130 deletions(-) create mode 100644 GeomIO/pFIOServerBounds.F90 diff --git a/GeomIO/CMakeLists.txt b/GeomIO/CMakeLists.txt index 10c45bc1de62..bdcab8003489 100644 --- a/GeomIO/CMakeLists.txt +++ b/GeomIO/CMakeLists.txt @@ -6,6 +6,7 @@ set(srcs Geom_PFIO.F90 Grid_PFIO.F90 GeomCatagorizer.F90 + pFIOServerBounds.F90 ) esma_add_library(${this} diff --git a/GeomIO/Grid_PFIO.F90 b/GeomIO/Grid_PFIO.F90 index c4d92ffadd67..3fd1d4dbf9cc 100644 --- a/GeomIO/Grid_PFIO.F90 +++ b/GeomIO/Grid_PFIO.F90 @@ -8,6 +8,7 @@ module mapl3g_GridPFIO use PFIO use MAPL_BaseMod use MAPL_FieldPointerUtilities + use mapl3g_pFIOServerBounds use, intrinsic :: iso_c_binding, only: c_ptr implicit none private @@ -40,6 +41,7 @@ subroutine stage_data_to_file(this, bundle, filename, time_index, rc) integer, allocatable :: element_count(:), new_element_count(:) type(ESMF_Grid) :: grid + type(pFIOServerBounds) :: server_bounds collection_id = this%get_collection_id() call ESMF_FieldBundleGet(bundle, fieldCount=num_fields, _RC) @@ -51,14 +53,15 @@ subroutine stage_data_to_file(this, bundle, filename, time_index, rc) element_count = FieldGetLocalElementCount(field, _RC) call ESMF_FieldGet(field, grid=grid, typekind=tk, _RC) - global_start = create_global_start(grid, element_count, time_index=time_index, _RC) - global_count = create_global_count(grid, element_count, have_time=.true., _RC) - local_start = create_local_start(grid, element_count, have_time=.true., _RC) - + call server_bounds%create_server_bounds(grid, element_count, time_index=time_index, _RC) + global_start = server_bounds%get_global_start() + global_count = server_bounds%get_global_count() + local_start = server_bounds%get_local_start() + ! generate array reference call FieldGetCptr(field, address, _RC) type_kind = esmf_to_pfio_type(tk, _RC) - new_element_count = create_file_shape(grid, element_count, _RC) + new_element_count = server_bounds%get_file_shape() ref = ArrayReference(address, type_kind, new_element_count) call o_clients%collective_stage_data(collection_id,filename, trim(field_names(i)), & diff --git a/GeomIO/SharedIO.F90 b/GeomIO/SharedIO.F90 index 052993f5c819..7b0e3fe4b44e 100644 --- a/GeomIO/SharedIO.F90 +++ b/GeomIO/SharedIO.F90 @@ -15,127 +15,9 @@ module mapl3g_SharedIO public create_time_variable public bundle_to_metadata public esmf_to_pfio_type - public create_local_start - public create_global_count - public create_global_start - public create_file_shape contains - function create_file_shape(grid, field_shape, rc) result(file_shape) - integer, allocatable :: file_shape(:) - type(ESMF_Grid), intent(in) :: grid - integer, intent(in) :: field_shape(:) - integer, intent(out), optional :: rc - - integer :: status, sz, ungr, tile_count - call ESMF_GridGet(grid, tileCount=tile_count, _RC) - sz = size(field_shape) - ungr = sz - 2 - if (tile_count == 6) then - allocate(file_shape(sz+1)) - file_shape(1:3) = [field_shape(1), field_shape(2), 1] - file_shape(4:4+ungr-1) = [field_shape(2+ungr:sz)] - else if (tile_count == 1) then - file_shape = field_shape - else - _FAIL("unsupported grid") - end if - - _RETURN(_SUCCESS) - end function create_file_shape - - function create_global_start(grid, field_shape, time_index, rc) result(global_start) - integer, allocatable :: global_start(:) - type(ESMF_Grid), intent(in) :: grid - integer, intent(in) :: field_shape(:) - integer, optional, intent(in) :: time_index - integer, intent(out), optional :: rc - - integer :: status, sz, tile_count, tm - call ESMF_GridGet(grid, tileCount=tile_count, _RC) - sz = size(field_shape) - - tm = 0 - if (present(time_index)) tm=1 - if (tile_count == 6) then - allocate(global_start(sz+1+tm)) - global_start(1:sz+1) = 1 - if (present(time_index)) global_start(sz+2) = time_index - else if (tile_count == 1) then - allocate(global_start(sz+tm)) - global_start(1:sz) = 1 - if (present(time_index)) global_start(sz+1) = time_index - else - _FAIL("unsupported grid") - end if - - _RETURN(_SUCCESS) - end function create_global_start - - function create_global_count(grid, field_shape, have_time, rc) result(global_count) - integer, allocatable :: global_count(:) - type(ESMF_Grid), intent(in) :: grid - integer, intent(in) :: field_shape(:) - logical, optional, intent(in) :: have_time - integer, intent(out), optional :: rc - - integer :: status, sz, ungr, tile_count, global_dim(3), tm - if (present(have_time)) tm=1 - call ESMF_GridGet(grid, tileCount=tile_count, _RC) - call MAPL_GridGet(grid, globalCellCountPerDim=global_dim, _RC) - sz = size(field_shape) - ungr = sz - 2 - - if (tile_count == 6) then - allocate(global_count(sz+1+tm)) - global_count(1:3) =[global_dim(1),global_dim(1),6] - global_count(4:4+ungr-1) = field_shape(3:sz) - if (have_time) global_count(sz+2) = 1 - else if (tile_count == 1) then - allocate(global_count(sz+tm)) - global_count(1:2) =[global_dim(1),global_dim(2)] - global_count(3:3+ungr-1) = field_shape(3:sz) - if (have_time) global_count(sz+1) = 1 - else - _FAIL("unsupported grid") - end if - - - _RETURN(_SUCCESS) - end function create_global_count - - function create_local_start(grid, field_shape, have_time, rc) result(local_start) - integer, allocatable :: local_start(:) - type(ESMF_Grid), intent(in) :: grid - integer, intent(in) :: field_shape(:) - logical, optional, intent(in) :: have_time - integer, intent(out), optional :: rc - - integer :: status, sz, ungr, tile_count, i1, in, j1, jn, tile, global_dim(3), tm - call ESMF_GridGet(grid, tileCount=tile_count, _RC) - call MAPL_GridGetInterior(grid, i1,in, j1, jn) - call MAPL_GridGet(grid, globalCellCountPerDim=global_dim, _RC) - tm=0 - if (present(have_time)) tm=1 - sz = size(field_shape) - ungr = sz - 2 - if (tile_count == 6) then - tile = 1 + (j1-1)/global_dim(1) - allocate(local_start(sz+1+tm)) - local_start=1 - local_start(1:3) = [i1, j1-(tile-1)*global_dim(1),tile] - else if (tile_count == 1) then - allocate(local_start(sz+tm)) - local_start=1 - local_start(1:2) = [i1,j1] - else - _FAIL("unsupported grid") - end if - - _RETURN(_SUCCESS) - end function create_local_start - function bundle_to_metadata(bundle, geom, rc) result(metadata) type(FileMetaData) :: metadata type(ESMF_FieldBundle), intent(in) :: bundle diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 new file mode 100644 index 000000000000..cf3ad112a776 --- /dev/null +++ b/GeomIO/pFIOServerBounds.F90 @@ -0,0 +1,120 @@ +#include "MAPL_Generic.h" +module mapl3g_pFIOServerBounds + use mapl_ErrorHandlingMod + use esmf + use pfio + use gFTL2_StringVector + use MAPL_BaseMod + + implicit none + private + + public :: pFIOServerBounds + + integer, parameter :: grid_dims = 2 + + type :: pFIOServerBounds + private + integer, allocatable :: local_start(:) + integer, allocatable :: global_start(:) + integer, allocatable :: global_count(:) + integer, allocatable :: file_shape(:) + contains + procedure :: create_server_bounds + procedure :: get_local_start + procedure :: get_global_start + procedure :: get_global_count + procedure :: get_file_shape + end type pFIOServerBounds + + contains + + function get_local_start(this) result(local_start) + integer, allocatable :: local_start(:) + class(pFIOServerBounds), intent(in) :: this + local_start =this%local_start + end function get_local_start + + function get_global_start(this) result(global_start) + integer, allocatable :: global_start(:) + class(pFIOServerBounds), intent(in) :: this + global_start =this%global_start + end function get_global_start + + function get_global_count(this) result(global_count) + integer, allocatable :: global_count(:) + class(pFIOServerBounds), intent(in) :: this + global_count =this%global_count + end function get_global_count + + function get_file_shape(this) result(file_shape) + integer, allocatable :: file_shape(:) + class(pFIOServerBounds), intent(in) :: this + file_shape =this%file_shape + end function get_file_shape + + subroutine create_server_bounds(this, grid, field_shape, time_index, rc) + class(pFIOServerBounds), intent(inout) :: this + type(ESMF_Grid), intent(in) :: grid + integer, intent(in) :: field_shape(:) + integer, intent(in), optional :: time_index + integer, intent(out), optional :: rc + + integer :: status, tile_count, n_dims, ungrid_dims, tm, global_dim(3) + integer :: i1, in, j1, jn, tile + + call ESMF_GridGet(grid, tileCount=tile_count, _RC) + call MAPL_GridGetInterior(grid, i1,in, j1, jn) + call MAPL_GridGet(grid, globalCellCountPerDim=global_dim, _RC) + n_dims = size(field_shape) + ungrid_dims = n_dims - grid_dims + tm = 0 + if (present(time_index)) tm = 1 + + if (tile_count == 6) then + tile = 1 + (j1-1)/global_dim(1) + allocate(this%file_shape(n_dims+1)) + allocate(this%global_start(n_dims+1+tm)) + allocate(this%global_count(n_dims+1+tm)) + allocate(this%local_start(n_dims+1+tm)) + + this%file_shape(1:grid_dims+1) = [field_shape(1), field_shape(2) ,1] + this%file_shape(grid_dims+2:grid_dims+ungrid_dims+1) = [field_shape(grid_dims+ungrid_dims:n_dims)] + + this%global_start(1:n_dims+1) = 1 + if(present(time_index)) this%global_start(n_dims+2) = time_index + + this%global_count(1:grid_dims+1) =[global_dim(1), global_dim(1), tile_count] + this%global_count(grid_dims+2:grid_dims+ungrid_dims+1) = field_shape(grid_dims+1:n_dims) + if (present(time_index)) this%global_count(n_dims+2) = 1 + + this%local_start = 1 + this%local_start(1:grid_dims+1) = [i1, j1-(tile-1)*global_dim(1), tile] + + + else if (tile_count == 1) then + allocate(this%global_start(n_dims+tm)) + allocate(this%global_count(n_dims+tm)) + allocate(this%local_start(n_dims+tm)) + + this%file_shape = field_shape + + this%global_start(1:n_dims) = 1 + if (present(time_index)) this%global_start(n_dims+1) = time_index + + this%global_count(1:grid_dims) = [global_dim(1), global_dim(2)] + this%global_count(grid_dims+1:grid_dims+ungrid_dims) = field_shape(grid_dims:n_dims) + if (present(time_index)) this%global_count(n_dims+1) = 1 + + this%local_start = 1 + this%local_start(1:grid_dims) = [i1,j1] + + else + _FAIL("unsupported grid") + end if + _RETURN(_SUCCESS) + + end subroutine create_server_bounds + +end module mapl3g_pFIOServerBounds + diff --git a/pfio/ArrayReference.F90 b/pfio/ArrayReference.F90 index 25074f7a8c69..92b149608957 100644 --- a/pfio/ArrayReference.F90 +++ b/pfio/ArrayReference.F90 @@ -25,13 +25,13 @@ module pFIO_ArrayReferenceMod end type ArrayReference interface ArrayReference - module procedure new_ArrayReference_from_param - module procedure new_ArrayReference_0d - module procedure new_ArrayReference_1d - module procedure new_ArrayReference_2d - module procedure new_ArrayReference_3d - module procedure new_ArrayReference_4d - module procedure new_ArrayReference_5d + procedure new_ArrayReference_from_param + procedure new_ArrayReference_0d + procedure new_ArrayReference_1d + procedure new_ArrayReference_2d + procedure new_ArrayReference_3d + procedure new_ArrayReference_4d + procedure new_ArrayReference_5d end interface ArrayReference contains From 65c6955660ad535352c8ce71385a65f8160a9244 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Mon, 20 May 2024 11:48:18 -0400 Subject: [PATCH 09/17] fix bug --- GeomIO/pFIOServerBounds.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 index cf3ad112a776..d7d53273b16c 100644 --- a/GeomIO/pFIOServerBounds.F90 +++ b/GeomIO/pFIOServerBounds.F90 @@ -103,7 +103,7 @@ subroutine create_server_bounds(this, grid, field_shape, time_index, rc) if (present(time_index)) this%global_start(n_dims+1) = time_index this%global_count(1:grid_dims) = [global_dim(1), global_dim(2)] - this%global_count(grid_dims+1:grid_dims+ungrid_dims) = field_shape(grid_dims:n_dims) + this%global_count(grid_dims+1:grid_dims+ungrid_dims) = field_shape(grid_dims+1:n_dims) if (present(time_index)) this%global_count(n_dims+1) = 1 this%local_start = 1 From 1011f1be4bd52d50e95bf426652c56a1d89b1e6a Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Mon, 20 May 2024 12:55:28 -0400 Subject: [PATCH 10/17] change name --- GeomIO/Grid_PFIO.F90 | 2 +- GeomIO/pFIOServerBounds.F90 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GeomIO/Grid_PFIO.F90 b/GeomIO/Grid_PFIO.F90 index 3fd1d4dbf9cc..c94975d79a82 100644 --- a/GeomIO/Grid_PFIO.F90 +++ b/GeomIO/Grid_PFIO.F90 @@ -53,7 +53,7 @@ subroutine stage_data_to_file(this, bundle, filename, time_index, rc) element_count = FieldGetLocalElementCount(field, _RC) call ESMF_FieldGet(field, grid=grid, typekind=tk, _RC) - call server_bounds%create_server_bounds(grid, element_count, time_index=time_index, _RC) + call server_bounds%initialize(grid, element_count, time_index=time_index, _RC) global_start = server_bounds%get_global_start() global_count = server_bounds%get_global_count() local_start = server_bounds%get_local_start() diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 index d7d53273b16c..d2a132d1ac46 100644 --- a/GeomIO/pFIOServerBounds.F90 +++ b/GeomIO/pFIOServerBounds.F90 @@ -20,7 +20,7 @@ module mapl3g_pFIOServerBounds integer, allocatable :: global_count(:) integer, allocatable :: file_shape(:) contains - procedure :: create_server_bounds + procedure :: initialize procedure :: get_local_start procedure :: get_global_start procedure :: get_global_count @@ -53,7 +53,7 @@ function get_file_shape(this) result(file_shape) file_shape =this%file_shape end function get_file_shape - subroutine create_server_bounds(this, grid, field_shape, time_index, rc) + subroutine initialize(this, grid, field_shape, time_index, rc) class(pFIOServerBounds), intent(inout) :: this type(ESMF_Grid), intent(in) :: grid integer, intent(in) :: field_shape(:) @@ -114,7 +114,7 @@ subroutine create_server_bounds(this, grid, field_shape, time_index, rc) end if _RETURN(_SUCCESS) - end subroutine create_server_bounds + end subroutine initialize end module mapl3g_pFIOServerBounds From 7dfd41bf04894a8a6010fdfe54e1476ec08ff65e Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Mon, 20 May 2024 13:12:24 -0400 Subject: [PATCH 11/17] move allocation --- GeomIO/pFIOServerBounds.F90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 index d2a132d1ac46..ac18bb97c627 100644 --- a/GeomIO/pFIOServerBounds.F90 +++ b/GeomIO/pFIOServerBounds.F90 @@ -61,7 +61,7 @@ subroutine initialize(this, grid, field_shape, time_index, rc) integer, intent(out), optional :: rc integer :: status, tile_count, n_dims, ungrid_dims, tm, global_dim(3) - integer :: i1, in, j1, jn, tile + integer :: i1, in, j1, jn, tile, extra_file_dim call ESMF_GridGet(grid, tileCount=tile_count, _RC) call MAPL_GridGetInterior(grid, i1,in, j1, jn) @@ -71,12 +71,15 @@ subroutine initialize(this, grid, field_shape, time_index, rc) tm = 0 if (present(time_index)) tm = 1 + extra_file_dim = 0 + if (tile_count == 6) extra_file_dim = 1 + allocate(this%file_shape(n_dims+extra_file_dim)) + allocate(this%global_start(n_dims+extra_file_dim+tm)) + allocate(this%global_count(n_dims+extra_file_dim+tm)) + allocate(this%local_start(n_dims+extra_file_dim+tm)) + if (tile_count == 6) then tile = 1 + (j1-1)/global_dim(1) - allocate(this%file_shape(n_dims+1)) - allocate(this%global_start(n_dims+1+tm)) - allocate(this%global_count(n_dims+1+tm)) - allocate(this%local_start(n_dims+1+tm)) this%file_shape(1:grid_dims+1) = [field_shape(1), field_shape(2) ,1] this%file_shape(grid_dims+2:grid_dims+ungrid_dims+1) = [field_shape(grid_dims+ungrid_dims:n_dims)] @@ -93,9 +96,6 @@ subroutine initialize(this, grid, field_shape, time_index, rc) else if (tile_count == 1) then - allocate(this%global_start(n_dims+tm)) - allocate(this%global_count(n_dims+tm)) - allocate(this%local_start(n_dims+tm)) this%file_shape = field_shape From a6890d10f60e23bd29c3aac0374ca8eaba7d9027 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Mon, 20 May 2024 13:32:43 -0400 Subject: [PATCH 12/17] update --- GeomIO/pFIOServerBounds.F90 | 55 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 index ac18bb97c627..702bd0e2a216 100644 --- a/GeomIO/pFIOServerBounds.F90 +++ b/GeomIO/pFIOServerBounds.F90 @@ -60,58 +60,55 @@ subroutine initialize(this, grid, field_shape, time_index, rc) integer, intent(in), optional :: time_index integer, intent(out), optional :: rc - integer :: status, tile_count, n_dims, ungrid_dims, tm, global_dim(3) - integer :: i1, in, j1, jn, tile, extra_file_dim + integer :: status, tile_count, n_dims, tm, global_dim(3) + integer :: i1, in, j1, jn, tile, extra_file_dim, file_dims, new_grid_dims call ESMF_GridGet(grid, tileCount=tile_count, _RC) call MAPL_GridGetInterior(grid, i1,in, j1, jn) call MAPL_GridGet(grid, globalCellCountPerDim=global_dim, _RC) n_dims = size(field_shape) - ungrid_dims = n_dims - grid_dims + tm = 0 if (present(time_index)) tm = 1 extra_file_dim = 0 if (tile_count == 6) extra_file_dim = 1 - allocate(this%file_shape(n_dims+extra_file_dim)) - allocate(this%global_start(n_dims+extra_file_dim+tm)) - allocate(this%global_count(n_dims+extra_file_dim+tm)) - allocate(this%local_start(n_dims+extra_file_dim+tm)) - - if (tile_count == 6) then - tile = 1 + (j1-1)/global_dim(1) - this%file_shape(1:grid_dims+1) = [field_shape(1), field_shape(2) ,1] - this%file_shape(grid_dims+2:grid_dims+ungrid_dims+1) = [field_shape(grid_dims+ungrid_dims:n_dims)] + new_grid_dims = grid_dims + extra_file_dim + file_dims = n_dims + extra_file_dim - this%global_start(1:n_dims+1) = 1 - if(present(time_index)) this%global_start(n_dims+2) = time_index + allocate(this%file_shape(file_dims)) + allocate(this%global_start(file_dims+tm)) + allocate(this%global_count(file_dims+tm)) + allocate(this%local_start(file_dims+tm)) - this%global_count(1:grid_dims+1) =[global_dim(1), global_dim(1), tile_count] - this%global_count(grid_dims+2:grid_dims+ungrid_dims+1) = field_shape(grid_dims+1:n_dims) - if (present(time_index)) this%global_count(n_dims+2) = 1 + this%file_shape(new_grid_dims+1:file_dims) = [field_shape(grid_dims+1:n_dims)] - this%local_start = 1 - this%local_start(1:grid_dims+1) = [i1, j1-(tile-1)*global_dim(1), tile] + this%global_start(1:file_dims+1) = 1 + if(present(time_index)) this%global_start(file_dims+1) = time_index + this%global_count(new_grid_dims+1:file_dims) = field_shape(grid_dims+1:n_dims) + if (present(time_index)) this%global_count(file_dims+1) = 1 - else if (tile_count == 1) then - - this%file_shape = field_shape + this%local_start = 1 - this%global_start(1:n_dims) = 1 - if (present(time_index)) this%global_start(n_dims+1) = time_index + if (tile_count == 6) then - this%global_count(1:grid_dims) = [global_dim(1), global_dim(2)] - this%global_count(grid_dims+1:grid_dims+ungrid_dims) = field_shape(grid_dims+1:n_dims) - if (present(time_index)) this%global_count(n_dims+1) = 1 + tile = 1 + (j1-1)/global_dim(1) + this%file_shape(1:new_grid_dims) = [field_shape(1), field_shape(2) ,1] + this%global_count(1:new_grid_dims) =[global_dim(1), global_dim(1), tile_count] + this%local_start(1:new_grid_dims) = [i1, j1-(tile-1)*global_dim(1), tile] - this%local_start = 1 - this%local_start(1:grid_dims) = [i1,j1] + else if (tile_count == 1) then + + this%file_shape(1:new_grid_dims) = [field_shape(1), field_shape(2)] + this%global_count(1:new_grid_dims) = [global_dim(1), global_dim(2)] + this%local_start(1:new_grid_dims) = [i1,j1] else _FAIL("unsupported grid") end if + _RETURN(_SUCCESS) end subroutine initialize From 1d20bee91e112049584242445080e397000f3267 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Mon, 20 May 2024 13:34:22 -0400 Subject: [PATCH 13/17] update --- GeomIO/pFIOServerBounds.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 index 702bd0e2a216..e2c81408fa7e 100644 --- a/GeomIO/pFIOServerBounds.F90 +++ b/GeomIO/pFIOServerBounds.F90 @@ -84,7 +84,7 @@ subroutine initialize(this, grid, field_shape, time_index, rc) this%file_shape(new_grid_dims+1:file_dims) = [field_shape(grid_dims+1:n_dims)] - this%global_start(1:file_dims+1) = 1 + this%global_start(1:file_dims) = 1 if(present(time_index)) this%global_start(file_dims+1) = time_index this%global_count(new_grid_dims+1:file_dims) = field_shape(grid_dims+1:n_dims) From 2a42cfbca68a1cf3c985545a9da4b7691f191b09 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Mon, 20 May 2024 13:34:56 -0400 Subject: [PATCH 14/17] remove bracket --- GeomIO/pFIOServerBounds.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 index e2c81408fa7e..6bbd878dfea6 100644 --- a/GeomIO/pFIOServerBounds.F90 +++ b/GeomIO/pFIOServerBounds.F90 @@ -82,7 +82,7 @@ subroutine initialize(this, grid, field_shape, time_index, rc) allocate(this%global_count(file_dims+tm)) allocate(this%local_start(file_dims+tm)) - this%file_shape(new_grid_dims+1:file_dims) = [field_shape(grid_dims+1:n_dims)] + this%file_shape(new_grid_dims+1:file_dims) = field_shape(grid_dims+1:n_dims) this%global_start(1:file_dims) = 1 if(present(time_index)) this%global_start(file_dims+1) = time_index From 89eeacb7f15758293ae59e5b51118d2d9e4a2fe2 Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Mon, 20 May 2024 15:15:38 -0400 Subject: [PATCH 15/17] Update GeomIO/pFIOServerBounds.F90 --- GeomIO/pFIOServerBounds.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 index 6bbd878dfea6..2f8f885e8409 100644 --- a/GeomIO/pFIOServerBounds.F90 +++ b/GeomIO/pFIOServerBounds.F90 @@ -107,7 +107,7 @@ subroutine initialize(this, grid, field_shape, time_index, rc) else _FAIL("unsupported grid") - end if + end select _RETURN(_SUCCESS) From 730324679bb2634f388a190c09731c37c2b1a201 Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Mon, 20 May 2024 15:17:15 -0400 Subject: [PATCH 16/17] Update GeomIO/pFIOServerBounds.F90 --- GeomIO/pFIOServerBounds.F90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 index 2f8f885e8409..a7f3c1fa45ad 100644 --- a/GeomIO/pFIOServerBounds.F90 +++ b/GeomIO/pFIOServerBounds.F90 @@ -92,20 +92,21 @@ subroutine initialize(this, grid, field_shape, time_index, rc) this%local_start = 1 - if (tile_count == 6) then + select case (tile_count) + case (6) then ! Assume cubed-sphere tile = 1 + (j1-1)/global_dim(1) this%file_shape(1:new_grid_dims) = [field_shape(1), field_shape(2) ,1] this%global_count(1:new_grid_dims) =[global_dim(1), global_dim(1), tile_count] this%local_start(1:new_grid_dims) = [i1, j1-(tile-1)*global_dim(1), tile] - else if (tile_count == 1) then + case (1) then this%file_shape(1:new_grid_dims) = [field_shape(1), field_shape(2)] this%global_count(1:new_grid_dims) = [global_dim(1), global_dim(2)] this%local_start(1:new_grid_dims) = [i1,j1] - else + case default _FAIL("unsupported grid") end select From e0ce5ec8d9767e22c025aa1bcdeafd1c954d3ecc Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Mon, 20 May 2024 15:25:54 -0400 Subject: [PATCH 17/17] Update GeomIO/pFIOServerBounds.F90 --- GeomIO/pFIOServerBounds.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GeomIO/pFIOServerBounds.F90 b/GeomIO/pFIOServerBounds.F90 index a7f3c1fa45ad..b8fad0db644a 100644 --- a/GeomIO/pFIOServerBounds.F90 +++ b/GeomIO/pFIOServerBounds.F90 @@ -93,14 +93,14 @@ subroutine initialize(this, grid, field_shape, time_index, rc) this%local_start = 1 select case (tile_count) - case (6) then ! Assume cubed-sphere + case (6) ! Assume cubed-sphere tile = 1 + (j1-1)/global_dim(1) this%file_shape(1:new_grid_dims) = [field_shape(1), field_shape(2) ,1] this%global_count(1:new_grid_dims) =[global_dim(1), global_dim(1), tile_count] this%local_start(1:new_grid_dims) = [i1, j1-(tile-1)*global_dim(1), tile] - case (1) then + case (1) this%file_shape(1:new_grid_dims) = [field_shape(1), field_shape(2)] this%global_count(1:new_grid_dims) = [global_dim(1), global_dim(2)]