-
Notifications
You must be signed in to change notification settings - Fork 344
Decomp mod unittest #3699
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
Merged
Merged
Decomp mod unittest #3699
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6b171e8
Some updates to CMakeLists that get closer, but aren't quite working …
ekluzek 9ffd4d3
Merge branch 'b4b-dev' into add_decomp_init_unittest
ekluzek e75078a
Merge branch 'b4b-dev' into add_decomp_init_unittest
ekluzek 195c3d9
Merge remote-tracking branch 'escomp/b4b-dev' into add_decomp_init_un…
ekluzek e56de4c
Get a simple test of DecompMod for get_proc_bounds and get_clump_boun…
ekluzek 0461ea5
These changes build in using mpi-serial, on Derecho it requires setti…
ekluzek 5e4fc9a
Revert "These changes build in using mpi-serial, on Derecho it requir…
ekluzek 394eb0e
Merge remote-tracking branch 'escomp/b4b-dev' into decompMod_unittest
ekluzek 1297aa1
Update src/main/test/decomp_test/test_decompMod.pf
ekluzek e744db5
Update src/main/test/decomp_test/test_decompMod.pf
ekluzek 5ac060d
Remove the addition of FATES directories as it causes a fail on the f…
ekluzek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| set(pfunit_sources | ||
| test_decompMod.pf) | ||
|
|
||
| add_pfunit_ctest(decomp | ||
| TEST_SOURCES "${pfunit_sources}" | ||
| LINK_LIBRARIES clm csm_share esmf | ||
| EXTRA_FINALIZE unittest_finalize_esmf | ||
| EXTRA_USE unittestInitializeAndFinalize) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| module test_decompMod | ||
|
|
||
| ! Tests of decompMod | ||
|
|
||
| use funit | ||
| use decompMod | ||
| use shr_kind_mod , only : r8 => shr_kind_r8 | ||
|
|
||
| implicit none | ||
|
|
||
| @TestCase | ||
| type, extends(TestCase) :: TestDecompMod | ||
| contains | ||
| procedure :: setUp | ||
| procedure :: tearDown | ||
| procedure :: create_simpleSingleDecomp | ||
| end type TestDecompMod | ||
|
|
||
| integer, parameter :: ni = 2 | ||
| integer, parameter :: nj = 2 | ||
|
|
||
| contains | ||
|
|
||
| ! ======================================================================== | ||
| ! Helper routines | ||
| ! ======================================================================== | ||
|
|
||
| subroutine setUp(this) | ||
| class(TestDecompMod), intent(inout) :: this | ||
|
|
||
| call this%create_simpleSingleDecomp() | ||
| end subroutine setUp | ||
|
|
||
| subroutine tearDown(this) | ||
| class(TestDecompMod), intent(inout) :: this | ||
|
|
||
| call decompmod_clean() | ||
|
|
||
| end subroutine tearDown | ||
|
|
||
| subroutine create_simpleSingleDecomp(this) | ||
| use spmdMod, only : iam | ||
| class(TestDecompMod), intent(inout) :: this | ||
|
|
||
| integer :: clump_pproc | ||
| ! TOTO: When decompMod has it's own allocate method that could be used here | ||
ekluzek marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| nclumps = 1 | ||
| clump_pproc = nclumps | ||
| allocate(procinfo%cid(clump_pproc)) | ||
| allocate(clumps(nclumps)) | ||
| ! Set the procinfo and clumps values | ||
| ! TOD: Use initialization method when available (currently in decompInitMod) | ||
ekluzek marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| procinfo%cid = 1 | ||
| procinfo%ncells = ni*nj | ||
| procinfo%begg = 1 | ||
| procinfo%endg = procinfo%ncells | ||
| procinfo%nclumps = nclumps | ||
| clumps(:)%owner = iam | ||
| clumps(:)%begg = 1 | ||
| clumps(:)%endg = procinfo%ncells | ||
|
|
||
| end subroutine create_simpleSingleDecomp | ||
| ! ======================================================================== | ||
| ! Begin tests | ||
| ! ======================================================================== | ||
|
|
||
| @Test | ||
| subroutine test_get_clump_bounds(this) | ||
| class(TestDecompMod), intent(inout) :: this | ||
|
|
||
| type(bounds_type) :: bounds | ||
| integer :: n | ||
|
|
||
| do n = 1, procinfo%nclumps | ||
| call get_clump_bounds(n, bounds) | ||
| @assertEqual(bounds%level, bounds_level_clump) | ||
| @assertEqual(bounds%clump_index, n) | ||
| end do | ||
| end subroutine test_get_clump_bounds | ||
|
|
||
| @Test | ||
| subroutine test_get_proc_bounds(this) | ||
| class(TestDecompMod), intent(inout) :: this | ||
|
|
||
| type(bounds_type) :: bounds | ||
|
|
||
| ! Add optional argument, just to test that it can handle it | ||
| call get_proc_bounds(bounds, allow_call_from_threaded_region=.true.) | ||
| @assertEqual(bounds%level, bounds_level_proc) | ||
| @assertEqual(bounds%clump_index, -1) | ||
| end subroutine test_get_proc_bounds | ||
|
|
||
| @Test | ||
| subroutine test_proc_clump_bounds_equal(this) | ||
| class(TestDecompMod), intent(inout) :: this | ||
|
|
||
| type(bounds_type) :: bounds_clump, bounds_proc | ||
|
|
||
| @assertTrue(procinfo%nclumps == 1) | ||
| call get_clump_bounds(1, bounds_clump) | ||
| call get_proc_bounds(bounds_proc) | ||
| @assertEqual(bounds_proc%begg, bounds_clump%begg) | ||
| @assertEqual(bounds_proc%endg, bounds_clump%endg) | ||
| end subroutine test_proc_clump_bounds_equal | ||
|
|
||
| end module test_decompMod | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.