Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Detection eddies
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Admin message
Gitlab has been updated. More info
here
and
there
.
Show more breadcrumbs
IPSL
LMD
DPAO
Detection eddies
Commits
7f24341b
Commit
7f24341b
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Use procedures `config_graph` and `read_grid`
parent
8f7b47c7
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
Overlap/Tests/test_send_recv.f90
+9
-48
9 additions, 48 deletions
Overlap/Tests/test_send_recv.f90
with
9 additions
and
48 deletions
Overlap/Tests/test_send_recv.f90
+
9
−
48
View file @
7f24341b
program
test_send_recv
program
test_send_recv
use
,
intrinsic
::
ISO_FORTRAN_ENV
! Libraries:
! Libraries:
use
ezmpi
,
only
:
ezmpi_bcast
use
ezmpi
,
only
:
ezmpi_bcast
use
jumble
,
only
:
get_command_arg_dyn
,
read_opcol
,
new_unit
,
deg_to_rad
,
&
use
jumble
,
only
:
get_command_arg_dyn
,
read_opcol
,
assert
assert
use
mpi_f08
,
only
:
mpi_init
,
mpi_finalize
,
MPI_Comm_rank
,
MPI_Comm_world
,
&
use
mpi_f08
,
only
:
mpi_init
,
mpi_finalize
,
MPI_Comm_rank
,
MPI_Comm_world
,
&
MPI_Comm_size
,
mpi_abort
,
MPI_TAG_UB
,
MPI_Comm_get_attr
,
&
MPI_Comm_size
,
mpi_abort
,
MPI_TAG_UB
,
MPI_Comm_get_attr
,
&
MPI_ADDRESS_KIND
,
MPI_io
,
MPI_ANY_SOURCE
MPI_ADDRESS_KIND
,
MPI_io
,
MPI_ANY_SOURCE
use
shapelib_03
,
only
:
dbf_read_attribute_03
use
shapelib_03
,
only
:
dbf_read_attribute_03
use
config_graph_m
,
only
:
config_graph
use
derived_types
,
only
:
snapshot
,
shpc_slice_handler
,
shpc_slice_meta
use
derived_types
,
only
:
snapshot
,
shpc_slice_handler
,
shpc_slice_meta
use
read_grid_m
,
only
:
read_grid
use
read_snapshot_m
,
only
:
read_snapshot
use
read_snapshot_m
,
only
:
read_snapshot
use
recv_snapshot_m
,
only
:
recv_snapshot
use
recv_snapshot_m
,
only
:
recv_snapshot
use
save_snapshot_m
,
only
:
save_snapshot
use
save_snapshot_m
,
only
:
save_snapshot
...
@@ -23,23 +22,9 @@ program test_send_recv
...
@@ -23,23 +22,9 @@ program test_send_recv
character
(
len
=
:),
allocatable
::
shpc_dir
character
(
len
=
:),
allocatable
::
shpc_dir
type
(
snapshot
)
s
type
(
snapshot
)
s
integer
rank
,
n_proc
,
copy
,
n_dates
,
unit
integer
rank
,
n_proc
,
copy
,
n_dates
logical
flag
logical
flag
INTEGER
(
KIND
=
MPI_ADDRESS_KIND
)
attribute_val
INTEGER
(
KIND
=
MPI_ADDRESS_KIND
)
attribute_val
real
::
corner_deg
(
2
)
=
[
0.125
,
-
59.875
]
! longitude and latitude of the corner of the whole grid, in degrees
real
::
step_deg
(
2
)
=
[
0.25
,
0.25
]
! longitude and latitude steps, in degrees
integer
::
nlon
=
120
,
nlat
=
120
integer
::
dist_lim
=
12
! We look for an overlapping eddy at dist_lim (in grid points) of
! the first extremum.
namelist
/
main_nml
/
dist_lim
namelist
/
grid_nml
/
corner_deg
,
step_deg
,
nlon
,
nlat
logical
periodic
! grid is periodic in longitude
TYPE
(
shpc_slice_handler
)
hshp
TYPE
(
shpc_slice_handler
)
hshp
type
(
shpc_slice_meta
)
ssm
type
(
shpc_slice_meta
)
ssm
...
@@ -61,27 +46,10 @@ program test_send_recv
...
@@ -61,27 +46,10 @@ program test_send_recv
call
assert
(
flag
,
"test_send_recv MPI_Comm_get_attr MPI_io"
)
call
assert
(
flag
,
"test_send_recv MPI_Comm_get_attr MPI_io"
)
call
assert
(
attribute_val
==
MPI_ANY_SOURCE
,
&
call
assert
(
attribute_val
==
MPI_ANY_SOURCE
,
&
"test_send_recv MPI_io MPI_ANY_SOURCE"
)
"test_send_recv MPI_io MPI_ANY_SOURCE"
)
write
(
unit
=
error_unit
,
nml
=
main_nml
)
write
(
unit
=
error_unit
,
fmt
=
*
)
"Enter namelist main_nml."
read
(
unit
=
*
,
nml
=
main_nml
)
write
(
unit
=
*
,
nml
=
main_nml
)
call
new_unit
(
unit
)
open
(
unit
,
file
=
shpc_dir
//
"/grid_nml.txt"
,
status
=
"old"
,
&
action
=
"read"
,
position
=
"rewind"
)
read
(
unit
,
nml
=
grid_nml
)
close
(
unit
)
! As we are requiring the grid spacing to be uniform, the value of
! "periodic" may be deduced from the values of step_deg(1) and nlon:
periodic
=
nint
(
360.
/
step_deg
(
1
))
==
nlon
print
*
,
"periodic = "
,
periodic
if
(
periodic
)
call
assert
(
2
*
dist_lim
*
step_deg
(
1
)
<
180.
,
&
"test_send_recv dist_lim"
)
copy
=
merge
(
dist_lim
,
0
,
periodic
)
end
if
end
if
call
read_grid
(
rank
,
shpc_dir
)
call
config_graph
(
rank
)
call
shpc_open
(
hshp
,
trim
(
shpc_dir
),
cyclone
=
.false.
,
slice
=
0
,
&
call
shpc_open
(
hshp
,
trim
(
shpc_dir
),
cyclone
=
.false.
,
slice
=
0
,
&
pszaccess
=
"rb"
)
pszaccess
=
"rb"
)
call
dbf_read_attribute_03
(
ssm
%
d0
,
hshp
%
extremum
,
hshp
%
extr_date
,
ishape
=
0
)
call
dbf_read_attribute_03
(
ssm
%
d0
,
hshp
%
extremum
,
hshp
%
extr_date
,
ishape
=
0
)
...
@@ -91,16 +59,9 @@ program test_send_recv
...
@@ -91,16 +59,9 @@ program test_send_recv
n_dates
=
size
(
ssm
%
ishape_last
)
n_dates
=
size
(
ssm
%
ishape_last
)
end
if
end
if
call
ezmpi_bcast
(
corner_deg
,
root
=
0
)
call
ezmpi_bcast
(
step_deg
,
root
=
0
)
call
ezmpi_bcast
(
nlon
,
root
=
0
)
call
ezmpi_bcast
(
nlat
,
root
=
0
)
call
ezmpi_bcast
(
copy
,
root
=
0
)
call
ezmpi_bcast
(
n_dates
,
root
=
0
)
call
ezmpi_bcast
(
n_dates
,
root
=
0
)
if
(
rank
==
1
)
call
read_snapshot
(
s
,
[
hshp
],
[
ssm
],
nlon
,
nlat
,
k
=
ssm
%
d0
,
&
if
(
rank
==
1
)
call
read_snapshot
(
s
,
[
hshp
],
[
ssm
],
k
=
ssm
%
d0
,
copy
=
copy
)
corner
=
corner_deg
*
deg_to_rad
,
step
=
step_deg
*
deg_to_rad
,
&
copy
=
copy
)
CALL
shpc_close
(
hshp
)
CALL
shpc_close
(
hshp
)
if
(
rank
==
1
)
then
if
(
rank
==
1
)
then
...
@@ -110,8 +71,8 @@ program test_send_recv
...
@@ -110,8 +71,8 @@ program test_send_recv
call
MPI_Comm_get_attr
(
MPI_Comm_world
,
MPI_TAG_UB
,
attribute_val
,
flag
)
call
MPI_Comm_get_attr
(
MPI_Comm_world
,
MPI_TAG_UB
,
attribute_val
,
flag
)
call
assert
(
flag
,
"test_send_recv MPI_Comm_get_attr MPI_TAG_UB"
)
call
assert
(
flag
,
"test_send_recv MPI_Comm_get_attr MPI_TAG_UB"
)
print
*
,
"MPI_TAG_UB = "
,
attribute_val
print
*
,
"MPI_TAG_UB = "
,
attribute_val
call
recv_snapshot
(
s
,
nlon
,
nlat
,
copy
,
source
=
1
,
tag
=
ssm
%
d0
)
call
recv_snapshot
(
s
,
source
=
1
,
tag
=
ssm
%
d0
)
call
save_snapshot
(
s
,
corner_deg
,
step_deg
,
nlon
,
nlat
,
copy
,
ssm
%
d0
)
call
save_snapshot
(
s
,
copy
,
ssm
%
d0
)
end
if
end
if
call
mpi_finalize
call
mpi_finalize
...
...
This diff is collapsed.
Click to expand it.
GUEZ Lionel
@guez
mentioned in commit
32c9d2b6
·
1 year ago
mentioned in commit
32c9d2b6
mentioned in commit 32c9d2b6e42a1270560debb60daac408cc769056
Toggle commit list
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