-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parallelization for mmf groundwater scheme #139
base: develop
Are you sure you want to change the base?
Conversation
Thank you, Zhe, for testing.
|
The results are identical - I run ncdiff to see the difference from two runs are 0. |
@CharlesZheZhang I suggest using something like nccmp to do the comparison, I think this is a more robust check and it is standard in regression testing. With options like: nccmp -dsSqf file1.nc file2.nc should report: Files "file1.nc" and "file2.nc" are identical. If there are any data differences it will report stats on them. |
#endif | ||
#ifdef MPP_LAND | ||
rcount=float(ncount) | ||
call sum_real1(rcount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any issue here when using different precision? since sum_real1 is a single precision function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just write a new sum_integer function?
@@ -225,8 +225,7 @@ subroutine LATERALFLOW (NoahmpIO, ISLTYP,WTD,QLAT,FDEPTH,TOPO,LANDMASK,DELTAT,A | |||
! USE NOAHMP_TABLES, ONLY : DKSAT_TABLE | |||
|
|||
#ifdef MPP_LAND | |||
! MPP_LAND only for HRLDAS Noah-MP/WRF-Hydro - Prasanth Valayamkunnath (06/10/2022) | |||
use module_mpp_land, only: mpp_land_com_real, mpp_land_com_integer, global_nx, global_ny, my_id | |||
use module_mpp_land !, only: mpp_land_lr_com, mpp_land_ub_com, mpp_land_sync, global_nx, global_ny, my_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the comment if not needed
jtsh=max(jts,jds+1) | ||
jteh=min(jte,jde-2) | ||
jteh=min(jte,jde-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these don't change answers for non-parallel runs?
itsh=its | ||
iteh=ite | ||
jtsh=jts | ||
jteh=jte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these don't change answers for non-parallel runs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question. I am also curious about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the LIS group, we actually did something similar to these indices when adding MMF parallel into Noah-MP-4.0.1.
See this code change:
https://github.com/NASA-LIS/LISF/pull/1418/files#diff-7737fa95c763c3f4c44635b9bf558d8a063138b94eb0e208fc2209d2ed65ef3e
Scroll down to Lines 329 to 338 in the new code.
We haven't merged this PR yet, but will be doing it soon.
Thanks @barlage , good suggestion. |
OK, maybe I misunderstood something here. Some of my comments are based on whether the new code reproduces the old code, i.e., are these non-answer changing modifications? So, there should probably be four tests:
|
There is no old mpi because originally MMF in HRLDAS cannot be run in a mpi mode. |
I agree that you should also test old code serial compared to new code serial |
Given the removal of DM_PARALLEL, does there also need to be WRF and MPAS tests? |
good point. I haven't thought about this. maybe we should use both DM_PARALLEL and MPP_LAND if we do not want to have two MMF code versions in HRLDAS and WRF/MPAS? I am not even sure about if current MPAS can run with MMF in parallel given the unstructured grids (I am not familiar with the parallelization of MPAS). |
OK, I assume this probably doesn't work in MPAS yet. The use of HRLDAS specific (or any parent system) code in noahmp code is generally not a good idea. This MPP_LAND directive should probably be changed to something like MPI_HRLDAS or DM_PARALLEL_HRLDAS or something more clearly associated with HRLDAS. Now I'm questioning whether these changes should be in the general noahmp code. First, I really hate #ifdef directives since it makes the code difficult to read/understand. Second, how will this parallelization fit into other parent models? Thinking of how this fits into @dmocko 's comment, do additional parent models just keep adding more ifdefs? I know you are just trying to get parallel code committed but there are some bigger questions here for these non-column model processes. |
Hi Mike and Cenlin, |
Yes, we need to find a way to make sure these changes work with all different parent models. |
Hi Mike and Cenlin, thank you for your suggestions. I have conducted a some tests with different hrldas/noahmp versions and both single and mpi run (v4.5, master, and the new mpi in this commit). The short summary for the tests is - the master code has very minimum changes from the v4.5 only on the upper domain boundary, and the new mpi code is identical to the master code in both single run and mpi run. The mpi run (with 16 cpu is much faster, only 3/8 of the single cpu run time). Three versions are used: Four simulations are run: The v4.5 single cpu run shows minor differences results from the master version and the new mpi, the differences are all in the upper boundary of the domain. For the master version and the new mpi version, results are identical. Please see my note in shared google drive: |
Thank you, Zhe! This means the MPI fix implemented by Gonzalo is correct. We will then need to think about an effective way for the MPI flag so that it can be compatible with different host models. |
@CharlesZheZhang are the differences between 1 and 2 expected? This could indicate that there is a problem in the new implementation (or that there was a problem in the old code). |
Adding parallelization capacity for mmf groundwater scheme
Code modifications done by Gonzalo (gonzalo.miguez@usc.es) and Prasanth (prasanth@iisertvm.ac.in),
tested and implemented by Zhe (zhezhang@ucar.edu)
Two codes are changed under noahmp directory:
/src/GroundWaterMmfMod.F90
/drivers/hrldas/NoahmpGroundwaterInitMod.F90
Essentially use mpp_land in Lateralflow subroutine and groundwater init subroutine:
https://github.com/CharlesZheZhang/noahmp/blob/30d661ab921372103dbd73da44a23d373cbb2618/drivers/hrldas/NoahmpGroundwaterInitMod.F90#L22
These lines moved to under subroutine NoahmpGroundwaterInitMain(grid, NoahmpIO)
Also let all distributed tiles communicate when reaching equilibrium within the 500 loops of lateralflow calls:
https://github.com/CharlesZheZhang/noahmp/blob/30d661ab921372103dbd73da44a23d373cbb2618/drivers/hrldas/NoahmpGroundwaterInitMod.F90#L123