Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
yaxt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dkrz-sw
yaxt
Commits
9f87d0a6
Commit
9f87d0a6
authored
5 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Add test to verify xmap spread correctly updates max pos.
parent
48519239
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_xmap_common_parallel.c
+14
-0
14 additions, 0 deletions
tests/test_xmap_common_parallel.c
tests/test_xmap_common_parallel_f.f90
+19
-4
19 additions, 4 deletions
tests/test_xmap_common_parallel_f.f90
with
33 additions
and
4 deletions
tests/test_xmap_common_parallel.c
+
14
−
0
View file @
9f87d0a6
...
...
@@ -280,6 +280,7 @@ test_maxpos(xmap_constructor xmap_new, MPI_Comm comm,
xt_idxlist_delete
(
dst_idxlist
);
// test
// 1. test that initial max positions are in range
int
max_pos_dst
=
xt_xmap_get_max_dst_pos
(
xmap
),
max_pos_src
=
xt_xmap_get_max_src_pos
(
xmap
);
if
(
max_pos_dst
<
indices_per_rank
-
1
)
...
...
@@ -287,6 +288,7 @@ test_maxpos(xmap_constructor xmap_new, MPI_Comm comm,
if
(
max_pos_src
<
indices_per_rank
-
1
)
PUT_ERR
(
"error in xt_xmap_get_max_src_pos
\n
"
);
// 2. expand range and verify it is reflected in max pos
int
pos_update1
[
indices_per_rank
];
for
(
int
i
=
0
;
i
<
indices_per_rank
;
++
i
)
pos_update1
[
i
]
=
2
*
i
;
...
...
@@ -299,6 +301,7 @@ test_maxpos(xmap_constructor xmap_new, MPI_Comm comm,
if
(
max_pos_src_u
<
(
indices_per_rank
-
1
)
*
2
)
PUT_ERR
(
"error in xt_xmap_get_max_src_pos
\n
"
);
// 3. contract range again and verify max pos is updated
int
pos_update2
[
2
*
indices_per_rank
];
for
(
int
i
=
0
;
i
<
2
*
indices_per_rank
;
++
i
)
pos_update2
[
i
]
=
i
/
2
;
...
...
@@ -312,10 +315,21 @@ test_maxpos(xmap_constructor xmap_new, MPI_Comm comm,
if
(
max_pos_src_u2
>=
indices_per_rank
)
PUT_ERR
(
"error in xt_xmap_get_max_src_pos
\n
"
);
// 4. apply spread and check max pos range
int
spread
[]
=
{
0
,
indices_per_rank
*
3
};
Xt_xmap
xmsp
=
xt_xmap_spread
(
xmap
,
2
,
spread
,
spread
);
int
max_pos_dst_s
=
xt_xmap_get_max_dst_pos
(
xmsp
),
max_pos_src_s
=
xt_xmap_get_max_src_pos
(
xmsp
);
if
(
max_pos_dst_s
<
(
indices_per_rank
-
1
)
*
3
)
PUT_ERR
(
"error in xt_xmap_get_max_dst_pos
\n
"
);
if
(
max_pos_src_s
<
(
indices_per_rank
-
1
)
*
3
)
PUT_ERR
(
"error in xt_xmap_get_max_src_pos
\n
"
);
// cleanup
xt_xmap_delete
(
xmap
);
xt_xmap_delete
(
xmup
);
xt_xmap_delete
(
xmup2
);
xt_xmap_delete
(
xmsp
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/test_xmap_common_parallel_f.f90
+
19
−
4
View file @
9f87d0a6
...
...
@@ -55,7 +55,7 @@ MODULE test_xmap_common_parallel
xt_xmap_get_num_destinations
,
xt_xmap_get_num_sources
,
&
xt_xmap_get_destination_ranks
,
xt_xmap_get_source_ranks
,
&
xt_xmap_get_max_dst_pos
,
xt_xmap_get_max_src_pos
,
&
xt_xmap_update_positions
xt_xmap_update_positions
,
xt_xmap_spread
IMPLICIT
NONE
PRIVATE
PUBLIC
::
xmap_parallel_test_main
...
...
@@ -302,15 +302,15 @@ CONTAINS
INTEGER
,
INTENT
(
in
)
::
indices_per_rank
! first setup simple pattern of boundary exchange
TYPE
(
xt_idxlist
)
::
src_idxlist
,
dst_idxlist
TYPE
(
xt_xmap
)
::
xmap
,
xmup
,
xmup2
TYPE
(
xt_xmap
)
::
xmap
,
xmup
,
xmup2
,
xmsp
INTEGER
::
indices_for_exch
INTEGER
(
xt_int_kind
)
::
src_index
(
indices_per_rank
),
&
dst_index
(
indices_per_rank
)
INTEGER
::
max_pos_src
,
max_pos_dst
,
max_pos_src_u
,
max_pos_dst_u
,
&
max_pos_src_u2
,
max_pos_dst_u2
max_pos_src_u2
,
max_pos_dst_u2
,
max_pos_src_s
,
max_pos_dst_s
INTEGER
::
comm_rank
,
comm_size
,
world_size
INTEGER
::
ierror
INTEGER
::
i
INTEGER
::
i
,
xmspread
(
2
)
INTEGER
::
pos_update1
(
indices_per_rank
),
pos_update2
(
2
*
indices_per_rank
)
CALL
mpi_comm_rank
(
comm
,
comm_rank
,
ierror
)
...
...
@@ -346,6 +346,7 @@ CONTAINS
CALL
xt_idxlist_delete
(
dst_idxlist
)
! test
! 1. test that initial max positions are in range
max_pos_dst
=
xt_xmap_get_max_dst_pos
(
xmap
)
max_pos_src
=
xt_xmap_get_max_src_pos
(
xmap
)
IF
(
max_pos_src
<
indices_per_rank
-1
)
&
...
...
@@ -353,6 +354,7 @@ CONTAINS
IF
(
max_pos_dst
<
indices_per_rank
-1
)
&
CALL
test_abort
(
"error in xt_xmap_get_max_dst_pos"
,
filename
,
__
LINE__
)
! 2. expand range and verify it is reflected in max pos
DO
i
=
1
,
indices_per_rank
pos_update1
(
i
)
=
(
i
-1
)
*
2
END
DO
...
...
@@ -366,6 +368,7 @@ CONTAINS
IF
(
max_pos_dst_u
<
(
indices_per_rank
-1
)
*
2
)
&
CALL
test_abort
(
"error in xt_xmap_get_max_dst_pos"
,
filename
,
__
LINE__
)
! 3. contract range again and verify max pos is updated
DO
i
=
1
,
indices_per_rank
*
2
pos_update2
(
i
)
=
(
i
-1
)/
2
END
DO
...
...
@@ -378,10 +381,22 @@ CONTAINS
IF
(
max_pos_dst_u2
>=
indices_per_rank
)
&
CALL
test_abort
(
"error in xt_xmap_get_max_dst_pos"
,
filename
,
__
LINE__
)
! 4. apply spread and check max pos range
xmspread
(
1
)
=
0
xmspread
(
2
)
=
indices_per_rank
*
3
xmsp
=
xt_xmap_spread
(
xmap
,
2
,
xmspread
,
xmspread
)
max_pos_dst_s
=
xt_xmap_get_max_dst_pos
(
xmsp
)
max_pos_src_s
=
xt_xmap_get_max_src_pos
(
xmsp
)
IF
(
max_pos_dst_s
<
(
indices_per_rank
-1
)
*
3
)
&
CALL
test_abort
(
"error in xt_xmap_get_max_dst_pos"
,
filename
,
__
LINE__
)
IF
(
max_pos_src_s
<
(
indices_per_rank
-1
)
*
3
)
&
CALL
test_abort
(
"error in xt_xmap_get_max_src_pos"
,
filename
,
__
LINE__
)
! cleanup
CALL
xt_xmap_delete
(
xmap
)
CALL
xt_xmap_delete
(
xmup
)
CALL
xt_xmap_delete
(
xmup2
)
CALL
xt_xmap_delete
(
xmsp
)
END
SUBROUTINE
test_maxpos
SUBROUTINE
check_pair_xmap
(
xmap
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment