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
ae6fef98
Commit
ae6fef98
authored
3 weeks ago
by
Moritz Hanke
Browse files
Options
Downloads
Patches
Plain Diff
WIP: improves test coverage of routine yac_basic_grid_to_file_parallel
parent
e7d8bc7e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/core/test_basic_grid_parallel.c
+92
-0
92 additions, 0 deletions
tests/core/test_basic_grid_parallel.c
with
92 additions
and
0 deletions
tests/core/test_basic_grid_parallel.c
+
92
−
0
View file @
ae6fef98
...
...
@@ -343,6 +343,98 @@ int main(void) {
}
// decomp
}
{
// check grid with varying number of corners per cell
size_t
nbr_vertices
[
NUM_PROCS
]
=
{
4
,
5
,
3
};
size_t
nbr_cells
[
NUM_PROCS
]
=
{
1
,
1
,
1
};
int
num_vertices_per_cell
[
NUM_PROCS
][
1
]
=
{{
4
},{
5
},{
3
}};
double
lon_vertices
[
NUM_PROCS
][
5
]
=
{{
0
,
1
,
1
,
0
},
{
1
,
2
,
2
,
1
.
5
,
1
},
{
0
,
1
,
1
.
5
}};
double
lat_vertices
[
NUM_PROCS
][
5
]
=
{{
0
,
0
,
1
,
1
},
{
0
,
0
,
1
,
1
.
5
,
1
},
{
1
,
1
,
1
.
5
}};
int
cell_to_vertex
[
NUM_PROCS
][
5
]
=
{{
0
,
1
,
2
,
3
},
{
0
,
1
,
2
,
3
,
4
},
{
0
,
1
,
2
}};
char
const
*
grid_name
=
"test_grid"
;
struct
yac_basic_grid
*
grid
=
yac_basic_grid_unstruct_deg_new
(
grid_name
,
nbr_vertices
[
comm_rank
],
nbr_cells
[
comm_rank
],
num_vertices_per_cell
[
comm_rank
],
lon_vertices
[
comm_rank
],
lat_vertices
[
comm_rank
],
cell_to_vertex
[
comm_rank
]);
yac_int
cell_global_ids
[
NUM_PROCS
][
1
]
=
{{
0
},
{
1
},
{
2
}};
int
core_cell_mask
[
NUM_PROCS
][
1
]
=
{{
1
},
{
1
},
{
1
}};
yac_int
vertex_global_ids
[
NUM_PROCS
][
5
]
=
{{
0
,
1
,
4
,
3
},
{
1
,
2
,
5
,
6
,
4
},
{
3
,
4
,
6
}};
int
core_vertex_mask
[
NUM_PROCS
][
5
]
=
{{
1
,
1
,
1
,
1
},
{
1
,
1
,
1
,
1
,
1
},
{
1
,
1
,
1
}};
yac_int
edge_global_ids
[
NUM_PROCS
][
5
]
=
{{
0
,
1
,
3
,
5
},
{
2
,
3
,
4
,
8
,
7
},
{
5
,
6
,
7
}};
int
core_edge_mask
[
NUM_PROCS
][
5
]
=
{{
1
,
1
,
1
,
1
},
{
1
,
1
,
1
,
1
,
1
},
{
1
,
1
,
1
}};
struct
yac_basic_grid_data
*
grid_data
=
yac_basic_grid_get_data
(
grid
);
grid_data
->
cell_ids
=
to_pointer
(
cell_global_ids
[
comm_rank
],
grid_data
->
num_cells
*
sizeof
(
cell_global_ids
[
0
]));
grid_data
->
core_cell_mask
=
to_pointer
(
core_cell_mask
[
comm_rank
],
grid_data
->
num_cells
*
sizeof
(
core_cell_mask
[
0
]));
grid_data
->
vertex_ids
=
to_pointer
(
vertex_global_ids
[
comm_rank
],
grid_data
->
num_vertices
*
sizeof
(
vertex_global_ids
[
0
]));
grid_data
->
core_vertex_mask
=
to_pointer
(
core_vertex_mask
[
comm_rank
],
grid_data
->
num_vertices
*
sizeof
(
core_vertex_mask
[
0
]));
grid_data
->
edge_ids
=
to_pointer
(
edge_global_ids
[
comm_rank
],
grid_data
->
num_edges
*
sizeof
(
edge_global_ids
[
0
]));
grid_data
->
core_edge_mask
=
to_pointer
(
core_edge_mask
[
comm_rank
],
grid_data
->
num_edges
*
sizeof
(
core_edge_mask
[
0
][
0
]));
// set up io configuration
clear_yac_io_env
();
setenv
(
"YAC_IO_RANK_LIST"
,
"0,2"
,
1
);
setenv
(
"YAC_IO_MAX_NUM_RANKS_PER_NODE"
,
"3"
,
1
);
// write distributed grid to file
char
const
*
grid_filename
=
"test_basic_grid_parallel.nc"
;
yac_basic_grid_to_file_parallel
(
grid
,
grid_filename
,
MPI_COMM_WORLD
);
yac_basic_grid_delete
(
grid
);
MPI_Barrier
(
MPI_COMM_WORLD
);
if
(
comm_rank
==
0
)
{
enum
{
NUM_CELLS
=
3
,
NUM_CRN
=
5
};
double
ref_clo
[
NUM_CELLS
][
NUM_CRN
]
=
{{
0
,
1
,
1
,
0
,
DBL_MAX
},{
1
,
2
,
2
,
1
.
5
,
1
},{
0
,
1
,
1
.
5
,
DBL_MAX
,
DBL_MAX
}};
double
ref_cla
[
NUM_CELLS
][
NUM_CRN
]
=
{{
0
,
0
,
1
,
1
,
DBL_MAX
},{
0
,
0
,
1
,
1
.
5
,
1
},{
1
,
1
,
1
.
5
,
DBL_MAX
,
DBL_MAX
}};
int
ref_cell_global_ids
[
NUM_CELLS
]
=
{
0
,
1
,
2
};
int
ref_core_cell_mask
[
NUM_CELLS
]
=
{
1
,
1
,
1
};
int
ref_vertex_global_ids
[
NUM_CELLS
][
NUM_CRN
]
=
{{
0
,
1
,
4
,
3
,
INT_MAX
},{
1
,
2
,
5
,
6
,
4
},{
3
,
4
,
6
,
INT_MAX
,
INT_MAX
}};
int
ref_core_vertex_mask
[
NUM_CELLS
][
NUM_CRN
]
=
{{
1
,
1
,
1
,
1
,
INT_MAX
},{
1
,
1
,
1
,
1
,
1
},{
1
,
1
,
1
,
INT_MAX
,
INT_MAX
}};
int
ref_edge_global_ids
[
NUM_CELLS
][
NUM_CRN
]
=
{{
0
,
3
,
5
,
1
,
INT_MAX
},
{
2
,
4
,
8
,
7
,
3
},
{
5
,
7
,
6
,
INT_MAX
,
INT_MAX
}};
int
ref_core_edge_mask
[
NUM_CELLS
][
NUM_CRN
]
=
{{
1
,
1
,
1
,
1
,
INT_MAX
},{
1
,
1
,
1
,
1
,
1
},{
1
,
1
,
1
,
INT_MAX
,
INT_MAX
}};
check_grid_file
(
grid_filename
,
grid_name
,
NUM_CELLS
,
NUM_CRN
,
&
ref_cla
[
0
][
0
],
&
ref_clo
[
0
][
0
],
NULL
,
NULL
,
ref_cell_global_ids
,
ref_core_cell_mask
,
&
ref_vertex_global_ids
[
0
][
0
],
&
ref_core_vertex_mask
[
0
][
0
],
&
ref_edge_global_ids
[
0
][
0
],
&
ref_core_edge_mask
[
0
][
0
]);
}
MPI_Barrier
(
MPI_COMM_WORLD
);
delete_file
(
grid_filename
);
}
xt_finalize
();
MPI_Finalize
();
...
...
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