Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YAC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
YAC
Commits
edc6f16c
Commit
edc6f16c
authored
2 months ago
by
Moritz Hanke
Browse files
Options
Downloads
Patches
Plain Diff
improves test coverage of raw data exchange
parent
3fb6f882
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mci/instance.c
+2
-0
2 additions, 0 deletions
src/mci/instance.c
tests/mci/test_dummy_coupling_raw_c.c
+125
-3
125 additions, 3 deletions
tests/mci/test_dummy_coupling_raw_c.c
with
127 additions
and
3 deletions
src/mci/instance.c
+
2
−
0
View file @
edc6f16c
...
...
@@ -1211,7 +1211,9 @@ static void generate_interpolations(
sizeof
(
double
))))
{
yac_interpolation_delete
(
interp
);
interp
=
NULL
;
yac_interpolation_exchange_delete
(
interp_exch
,
"generate_interpolations"
);
interp_exch
=
NULL
;
yac_interp_weights_data_free
(
interp_weights_data
);
yac_interp_weights_data_init
(
&
interp_weights_data
);
...
...
This diff is collapsed.
Click to expand it.
tests/mci/test_dummy_coupling_raw_c.c
+
125
−
3
View file @
edc6f16c
...
...
@@ -437,9 +437,8 @@ int main(void) {
.
frac_mask_fallback_value
=
frac_mask_fallback_value
},
{
// TEST_IDX = 10
// test in which the process that has the only role of source
// does not send any data (with fractional masking)
// in addition this test check time reduction capabilities
// test in the target field is generated from multiple source point
// sets
.
field
=
{{.
name
=
"source_field_multi"
,
.
point_ids
=
(
int
[]){
src_cell_point_id
,
src_cell_point_id
},
...
...
@@ -454,6 +453,24 @@ int main(void) {
.
coupling_period
=
"1"
,
.
interp_stack_config
=
interp_stack_callback
,
.
frac_mask_fallback_value
=
YAC_FRAC_MASK_NO_VALUE
},
{
// TEST_IDX = 11
// test in which a source field is sent to two target fields
// (one using raw data exchange and the other does not)
.
field
=
{{.
name
=
"source_field_comp"
,
.
point_ids
=
(
int
[]){
src_cell_point_id
},
.
mask_ids
=
(
int
[]){
src_cell_mask_id_quarter
},
.
global_ids
=
(
int
*
[]){
is_src
?
src_cell_global_ids
[
src_rank
]
:
NULL
},
.
num_points
=
1
},
{.
name
=
"target_field_comp_raw"
,
.
point_ids
=
(
int
[]){
tgt_cell_point_id
},
.
global_ids
=
(
int
*
[]){
is_tgt
?
tgt_cell_global_ids
[
tgt_rank
]
:
NULL
},
.
mask_ids
=
(
int
[]){
-
1
},
.
num_points
=
1
}},
.
coupling_period
=
"1"
,
.
interp_stack_config
=
interp_stack_conserv
,
.
frac_mask_fallback_value
=
YAC_FRAC_MASK_NO_VALUE
}
};
...
...
@@ -500,6 +517,23 @@ int main(void) {
test_configs
[
i
].
interp_stack_config
,
0
,
0
,
ext_couple_config
);
}
int
tgt_field_non_raw_id
;
if
(
is_tgt
)
{
// define a file that will not use raw data exchange
// it will receive data from a source field, which also sends data
// to a target that uses raw data exchange
yac_cdef_field
(
"target_field_comb_non_raw"
,
tgt_comp_id
,
&
tgt_cell_point_id
,
1
,
1
,
"1"
,
YAC_TIME_UNIT_SECOND
,
&
tgt_field_non_raw_id
);
yac_cdef_couple
(
src_comp_name
,
src_grid_name
,
"source_field_comp"
,
tgt_comp_name
,
tgt_grid_name
,
"target_field_comb_non_raw"
,
"1"
,
YAC_TIME_UNIT_SECOND
,
YAC_REDUCTION_TIME_AVERAGE
,
interp_stack_conserv
,
0
,
0
);
}
else
{
tgt_field_non_raw_id
=
-
1
;
}
// end definition phase
yac_cenddef
();
...
...
@@ -949,6 +983,94 @@ int main(void) {
ref_tgt_field_data
[
0
]);
}
{
// test with multiple targets
enum
{
TEST_IDX
=
11
,
COLLECTION_SIZE
=
1
};
int
src_field_id
=
test_configs
[
TEST_IDX
].
field
[
SRC
].
id
;
int
tgt_field_id
=
test_configs
[
TEST_IDX
].
field
[
TGT
].
id
;
double
***
src_field_buffer
=
test_configs
[
TEST_IDX
].
src_field_buffer
;
double
ref_tgt_field_data
[
1
][
GLOBAL_NUM_TGT_CELLS
]
=
{{
fixed_value
,
0
.
25
*
(
2
),
0
.
25
*
(
2
),
0
.
25
*
(
3
),
0
.
25
*
(
2
+
3
+
4
),
0
.
25
*
(
2
+
4
),
0
.
25
*
(
3
),
0
.
25
*
(
3
+
4
),
0
.
25
*
(
4
)}};
switch
(
1
*
is_src
+
2
*
is_tgt
)
{
case
(
0
):
{
// neither source nor target
break
;
}
case
(
1
):
{
// only source
// send source data
yac_cput
(
src_field_id
,
COLLECTION_SIZE
,
src_field
,
&
info
,
&
ierror
);
yac_cwait
(
src_field_id
);
break
;
}
case
(
2
):
{
// only target
// receive source field buffer
yac_cget_raw
(
tgt_field_id
,
COLLECTION_SIZE
,
src_field_buffer
,
&
info
,
&
ierror
);
break
;
}
case
(
3
):
{
// source and target
yac_cput
(
src_field_id
,
COLLECTION_SIZE
,
src_field
,
&
send_info
,
&
ierror
);
yac_cget_raw
(
tgt_field_id
,
COLLECTION_SIZE
,
src_field_buffer
,
&
recv_info
,
&
ierror
);
info
=
recv_info
;
break
;
}
default:
{
PUT_ERR
(
"ERROR: invalid process type"
);
yac_cfinalize
();
return
TEST_EXIT_CODE
;
}
}
// role
check_results
(
is_tgt
,
info
,
COLLECTION_SIZE
,
NUM_TGT_CELLS
,
src_field_buffer
,
NULL
,
test_configs
[
TEST_IDX
].
interp_weights_data
,
test_configs
[
TEST_IDX
].
field
[
TGT
].
global_ids
[
0
],
ref_tgt_field_data
[
0
]);
if
(
is_tgt
)
{
double
tgt_field_data
[
COLLECTION_SIZE
][
NUM_TGT_CELLS
];
double
*
tgt_field
[
COLLECTION_SIZE
];
for
(
size_t
i
=
0
;
i
<
COLLECTION_SIZE
;
++
i
)
tgt_field
[
i
]
=
tgt_field_data
[
i
];
// initialise target field
for
(
size_t
i
=
0
;
i
<
COLLECTION_SIZE
;
++
i
)
for
(
size_t
j
=
0
;
j
<
NUM_TGT_CELLS
;
++
j
)
tgt_field
[
i
][
j
]
=
-
1
.
0
;
yac_cget
(
tgt_field_non_raw_id
,
COLLECTION_SIZE
,
tgt_field
,
&
info
,
&
ierror
);
// if data was received
if
((
info
==
YAC_ACTION_COUPLING
)
||
(
info
==
YAC_ACTION_GET_FOR_RESTART
))
{
// check results
int
*
tgt_global_ids
=
test_configs
[
TEST_IDX
].
field
[
TGT
].
global_ids
[
0
];
for
(
size_t
i
=
0
;
i
<
COLLECTION_SIZE
;
++
i
)
for
(
size_t
j
=
0
;
j
<
NUM_TGT_CELLS
;
++
j
)
if
(
fabs
(
tgt_field_data
[
i
][
j
]
-
ref_tgt_field_data
[
0
][
tgt_global_ids
[
j
]])
>
RESULT_TOL
)
PUT_ERR
(
"wrong results"
);
}
}
}
yac_cfree_ext_couple_config
(
ext_couple_config
);
yac_cfree_interp_stack_config
(
interp_stack_conserv
);
yac_cfree_interp_stack_config
(
interp_stack_callback
);
...
...
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