Skip to content

Commit

Permalink
Merge branch 'release/MAPL-v3' into feature/wdboggs/get_history_colle…
Browse files Browse the repository at this point in the history
…ction_output_info
  • Loading branch information
darianboggs committed May 23, 2024
2 parents 23329df + ed7041d commit f02fa5d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- fixed a bug in generate_newnxy in MAPL_SwathGridFactory.F90 (NX*NY=Ncore)
- pFIO Clients don't send "Done" message when there is no request
- Update `components.yaml`
- ESMA_cmake v3.45.1
Expand Down
58 changes: 30 additions & 28 deletions base/MAPL_SwathGridFactory.F90
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,8 @@ function make_new_grid(this, unusable, rc) result(grid)

_UNUSED_DUMMY(unusable)

!!if (mapl_am_I_root()) write(6,*) 'MAPL_SwathGridFactory.F90: bf this%create_basic_grid'
grid = this%create_basic_grid(_RC)
!!if (mapl_am_I_root()) write(6,*) 'MAPL_SwathGridFactory.F90: af this%create_basic_grid'
call this%add_horz_coordinates_from_file(grid,_RC)
!!if (mapl_am_I_root()) write(6,*) 'MAPL_SwathGridFactory.F90: af this%add_horz_coordinates_from_file'

_RETURN(_SUCCESS)
end function make_new_grid

Expand Down Expand Up @@ -485,6 +481,7 @@ subroutine initialize_from_config_with_prefix(this, config, prefix, unusable, rc

call lgr%debug(' %a %a', 'CurrTime =', trim(tmp))


if ( index(tmp, 'T') /= 0 .OR. index(tmp, '-') /= 0 ) then
call ESMF_TimeSet(currTime, timeString=tmp, _RC)
else
Expand Down Expand Up @@ -720,6 +717,7 @@ subroutine initialize_from_config_with_prefix(this, config, prefix, unusable, rc
endif
! ims is set at here
call this%check_and_fill_consistency(_RC)
call lgr%debug(' %a %i5 %i5', 'nx, ny (check_and_fill_consistency) = ', this%nx, this%ny)

_RETURN(_SUCCESS)

Expand Down Expand Up @@ -866,7 +864,6 @@ subroutine check_and_fill_consistency(this, unusable, rc)
call this%generate_newnxy(_RC)
end if
end if

_RETURN(_SUCCESS)

contains
Expand Down Expand Up @@ -1147,43 +1144,48 @@ subroutine generate_newnxy(this,unusable,rc)
class (KeywordEnforcer), optional, intent(in) :: unusable
integer, optional, intent(out) :: rc
integer :: n
integer :: j, pet_count

_UNUSED_DUMMY(unusable)

pet_count = this%nx * this%ny
n = this%im_world/this%nx
if (n < 2) then
this%nx = generate_new_decomp(this%im_world,this%nx)
deallocate(this%ims)
allocate(this%ims(0:this%nx-1))
call MAPL_DecomposeDim(this%im_world, this%ims, this%nx)
do j = this%im_world/2, 1, -1
if ( mod(pet_count, j) == 0 .and. this%im_world/j >= 2 ) then
exit ! found a decomposition
end if
end do
this%nx = j
this%ny = pet_count/j
end if

n = this%jm_world/this%ny
if (n < 2) then
this%ny = generate_new_decomp(this%jm_world,this%ny)
deallocate(this%jms)
allocate(this%jms(0:this%ny-1))
call MAPL_DecomposeDim(this%jm_world, this%jms, this%ny)
do j = this%jm_world/2, 1, -1
if ( mod(pet_count, j) == 0 .and. this%jm_world/j >=2 ) then
exit ! found a decomposition
end if
end do
this%ny = j
this%nx = pet_count/j
end if

if ( this%im_world/this%nx < 2 .OR. this%jm_world/this%ny < 2 ) then
_FAIL ('Algorithm failed')
end if

if (allocated(this%ims)) deallocate(this%ims)
allocate(this%ims(0:this%nx-1))
call MAPL_DecomposeDim(this%im_world, this%ims, this%nx)
if (allocated(this%jms)) deallocate(this%jms)
allocate(this%jms(0:this%ny-1))
call MAPL_DecomposeDim(this%jm_world, this%jms, this%ny)

_RETURN(_SUCCESS)

end subroutine generate_newnxy

function generate_new_decomp(im,nd) result(n)
integer, intent(in) :: im, nd
integer :: n
logical :: canNotDecomp

canNotDecomp = .true.
n = nd
do while(canNotDecomp)
if ( (im/n) < 2) then
n = n/2
else
canNotDecomp = .false.
end if
enddo
end function generate_new_decomp

subroutine init_halo(this, unusable, rc)
class (SwathGridFactory), target, intent(inout) :: this
Expand Down

0 comments on commit f02fa5d

Please sign in to comment.