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
cdf34bf1
Commit
cdf34bf1
authored
2 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Extend tests for better coverage.
parent
36c3f153
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.c
+11
-7
11 additions, 7 deletions
tests/test_xmap_common.c
tests/test_xmap_common_f.f90
+42
-15
42 additions, 15 deletions
tests/test_xmap_common_f.f90
with
53 additions
and
22 deletions
tests/test_xmap_common.c
+
11
−
7
View file @
cdf34bf1
...
...
@@ -56,7 +56,8 @@
#include
"test_xmap_common.h"
static
void
test_xmap1
(
xmap_constructor
new_xmap
,
MPI_Comm
comm
);
test_xmap1
(
xmap_constructor
new_xmap
,
int
lsize
,
MPI_Comm
comm
);
static
void
test_xmap2
(
xmap_constructor
new_xmap
,
MPI_Comm
comm
);
...
...
@@ -78,7 +79,9 @@ xt_xmap_self_test_main(xmap_constructor new_xmap)
xt_mpi_comm_mark_exclusive
(
comms
[
1
]);
for
(
size_t
i
=
0
;
i
<
2
;
++
i
)
{
test_xmap1
(
new_xmap
,
comms
[
i
]);
static
const
int
lsizes
[
2
]
=
{
7
,
1023
};
for
(
size_t
j
=
0
;
j
<
2
;
++
j
)
test_xmap1
(
new_xmap
,
lsizes
[
j
],
comms
[
i
]);
test_xmap2
(
new_xmap
,
comms
[
i
]);
}
...
...
@@ -158,17 +161,18 @@ static inline void shift_idx(Xt_int idx[], int num, int offset) {
}
static
void
test_xmap1
(
xmap_constructor
new_xmap
,
MPI_Comm
comm
)
test_xmap1
(
xmap_constructor
new_xmap
,
int
lsize
,
MPI_Comm
comm
)
{
struct
Xt_stripe
src_stripe
,
dst_stripe
;
// source index list
src_stripe
.
nstrides
=
7
;
src_stripe
.
start
=
(
Xt_int
)(
1
+
(
Xt_int
)
my_rank
*
src_stripe
.
nstrides
);
src_stripe
.
nstrides
=
lsize
;
src_stripe
.
start
=
(
Xt_int
)(
1
+
(
Xt_int
)
my_rank
*
(
Xt_int
)
lsize
);
src_stripe
.
stride
=
1
;
// destination index list
dst_stripe
.
nstrides
=
src_stripe
.
nstrides
;
dst_stripe
.
start
=
(
Xt_int
)(
src_stripe
.
start
+
src_stripe
.
nstrides
-
1
);
dst_stripe
.
nstrides
=
lsize
;
dst_stripe
.
start
=
(
Xt_int
)(
src_stripe
.
start
+
lsize
-
1
);
dst_stripe
.
stride
=
-
1
;
test_self_xmap_construct_idxstripes
(
&
src_stripe
,
1
,
&
dst_stripe
,
1
,
...
...
This diff is collapsed.
Click to expand it.
tests/test_xmap_common_f.f90
+
42
−
15
View file @
cdf34bf1
...
...
@@ -80,8 +80,9 @@ CONTAINS
TYPE
(
xt_xmap
)
::
res
END
FUNCTION
xmap_new
END
INTERFACE
INTEGER
::
ierror
,
i
INTEGER
::
ierror
,
i
,
j
INTEGER
::
comms
(
2
)
INTEGER
(
xi
),
PARAMETER
::
lsize
(
2
)
=
(/
7_xi
,
1023_xi
/)
CALL
init_mpi
CALL
xt_initialize
(
mpi_comm_world
)
...
...
@@ -96,7 +97,10 @@ CONTAINS
CALL
xt_mpi_comm_mark_exclusive
(
comms
(
2
))
DO
i
=
1
,
SIZE
(
comms
)
CALL
test_xmap1
(
xmap_new
,
comms
(
i
))
DO
j
=
1
,
2
CALL
test_xmap1a
(
xmap_new
,
lsize
(
j
),
comms
(
i
))
CALL
test_xmap1b
(
xmap_new
,
lsize
(
j
),
comms
(
i
))
END
DO
CALL
test_xmap2
(
xmap_new
,
comms
(
i
))
END
DO
...
...
@@ -208,7 +212,7 @@ CONTAINS
CALL
xt_xmap_delete
(
xmap_copy
)
END
SUBROUTINE
test_self_xmap_construct_idxlist
SUBROUTINE
test_xmap1
(
xmap_new
,
comm
)
SUBROUTINE
test_xmap1
a
(
xmap_new
,
lsize
,
comm
)
INTERFACE
FUNCTION
xmap_new
(
src_idxlist
,
dst_idxlist
,
comm
)
RESULT
(
res
)
IMPORT
::
xt_idxlist
,
xt_xmap
...
...
@@ -219,22 +223,45 @@ CONTAINS
TYPE
(
xt_xmap
)
::
res
END
FUNCTION
xmap_new
END
INTERFACE
INTEGER
(
xi
),
INTENT
(
in
)
::
lsize
INTEGER
,
INTENT
(
in
)
::
comm
INTEGER
(
xi
)
::
i
INTEGER
(
xi
),
PARAMETER
::
num_src_idx
=
7
,
num_dst_idx
=
7
INTEGER
(
xi
)
::
src_index_list
(
num_src_idx
),
&
dst_index_list
(
num_dst_idx
)
DO
i
=
1_xi
,
num_src_idx
src_index_list
(
i
)
=
i
INTEGER
(
xt_int_kind
)
::
src_indices
(
lsize
),
dst_indices
(
lsize
),
i
DO
i
=
1_xi
,
lsize
src_indices
(
i
)
=
i
END
DO
CALL
shift_idx
(
src_ind
ex_list
,
num_src_idx
)
DO
i
=
1_xi
,
num_dst_idx
dst_ind
ex_list
(
i
)
=
num_dst_idx
-
i
+
1_xi
CALL
shift_idx
(
src_ind
ices
,
lsize
)
DO
i
=
1_xi
,
lsize
dst_ind
ices
(
i
)
=
lsize
-
i
+
1_xi
END
DO
CALL
shift_idx
(
dst_index_list
,
num_dst_idx
)
CALL
test_self_xmap_construct
(
src_index_list
,
dst_index_list
,
xmap_new
,
comm
)
END
SUBROUTINE
test_xmap1
CALL
shift_idx
(
dst_indices
,
lsize
)
CALL
test_self_xmap_construct
(
src_indices
,
dst_indices
,
&
xmap_new
,
comm
)
END
SUBROUTINE
test_xmap1a
SUBROUTINE
test_xmap1b
(
xmap_new
,
lsize
,
comm
)
INTERFACE
FUNCTION
xmap_new
(
src_idxlist
,
dst_idxlist
,
comm
)
RESULT
(
res
)
IMPORT
::
xt_idxlist
,
xt_xmap
IMPLICIT
NONE
TYPE
(
xt_idxlist
),
INTENT
(
in
)
::
src_idxlist
TYPE
(
xt_idxlist
),
INTENT
(
in
)
::
dst_idxlist
INTEGER
,
INTENT
(
in
)
::
comm
TYPE
(
xt_xmap
)
::
res
END
FUNCTION
xmap_new
END
INTERFACE
INTEGER
(
xi
),
INTENT
(
in
)
::
lsize
INTEGER
,
INTENT
(
in
)
::
comm
TYPE
(
xt_stripe
)
::
src_stripe
(
1
),
dst_stripe
(
1
)
src_stripe
(
1
)
=
xt_stripe
(
1_xi
+
INT
(
my_rank
,
xi
)
*
lsize
,
&
1_xi
,
INT
(
lsize
,
c_int
))
dst_stripe
(
1
)
=
xt_stripe
(
INT
(
my_rank
+1
,
xi
)
*
lsize
,
&
-1_xi
,
INT
(
lsize
,
c_int
))
CALL
test_self_xmap_construct
(
src_stripe
,
dst_stripe
,
&
xmap_new
,
comm
)
END
SUBROUTINE
test_xmap1b
SUBROUTINE
test_xmap2
(
xmap_new
,
comm
)
INTERFACE
...
...
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