Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
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
particle_methods
hysop
Commits
d6843871
Commit
d6843871
authored
4 years ago
by
EXT Jean-Matthieu Etancelin
Browse files
Options
Downloads
Patches
Plain Diff
fix mpi bridge
parent
0a4aa2d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!24
Resolve "Add python3.x support"
,
!15
WIP: Resolve "HySoP with tasks"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hysop/core/mpi/bridge.py
+9
-4
9 additions, 4 deletions
hysop/core/mpi/bridge.py
hysop/core/mpi/topo_tools.py
+8
-13
8 additions, 13 deletions
hysop/core/mpi/topo_tools.py
hysop/problem.py
+4
-1
4 additions, 1 deletion
hysop/problem.py
with
21 additions
and
18 deletions
hysop/core/mpi/bridge.py
+
9
−
4
View file @
d6843871
...
@@ -376,10 +376,15 @@ class BridgeOverlap(Bridge):
...
@@ -376,10 +376,15 @@ class BridgeOverlap(Bridge):
def
_build_send_recv_dict
(
self
):
def
_build_send_recv_dict
(
self
):
# Compute local intersections : i.e. find which grid points
# Compute local intersections : i.e. find which grid points
# are on both source and target mesh.
# are on both source and target mesh.
indices_source
=
TopoTools
.
gather_global_indices_overlap
(
# Filter out the empty slices (due to none topologies)
self
.
_source
,
self
.
comm
,
self
.
domain
)
indices_source
=
dict
([(
rk
,
sl
)
for
rk
,
sl
in
indices_target
=
TopoTools
.
gather_global_indices_overlap
(
TopoTools
.
gather_global_indices_overlap
(
self
.
_target
,
self
.
comm
,
self
.
domain
)
self
.
_source
,
self
.
comm
,
self
.
domain
).
iteritems
()
if
not
all
([
_
==
slice
(
0
,
0
)
for
_
in
sl
])])
indices_target
=
dict
([(
rk
,
sl
)
for
rk
,
sl
in
TopoTools
.
gather_global_indices_overlap
(
self
.
_target
,
self
.
comm
,
self
.
domain
).
iteritems
()
if
not
all
([
_
==
slice
(
0
,
0
)
for
_
in
sl
])])
# From now on, we have indices_source[rk] = global indices (slice)
# From now on, we have indices_source[rk] = global indices (slice)
# of grid points of the source on process number rk in parent.
# of grid points of the source on process number rk in parent.
...
...
This diff is collapsed.
Click to expand it.
hysop/core/mpi/topo_tools.py
+
8
−
13
View file @
d6843871
...
@@ -74,9 +74,7 @@ class TopoTools(object):
...
@@ -74,9 +74,7 @@ class TopoTools(object):
if
root
is
None
:
if
root
is
None
:
comm
.
Allgather
([
iglob
[:,
rank
],
MPI
.
INT
],
[
iglob_res
,
MPI
.
INT
])
comm
.
Allgather
([
iglob
[:,
rank
],
MPI
.
INT
],
[
iglob_res
,
MPI
.
INT
])
else
:
else
:
comm
.
Gather
([
iglob
[:,
rank
],
MPI
.
INT
],
[
iglob_res
,
MPI
.
INT
],
comm
.
Gather
([
iglob
[:,
rank
],
MPI
.
INT
],
[
iglob_res
,
MPI
.
INT
],
root
=
root
)
root
=
root
)
if
toslice
:
if
toslice
:
return
Utils
.
array_to_dict
(
iglob_res
)
return
Utils
.
array_to_dict
(
iglob_res
)
else
:
else
:
...
@@ -133,19 +131,18 @@ class TopoTools(object):
...
@@ -133,19 +131,18 @@ class TopoTools(object):
size
=
comm
.
Get_size
()
size
=
comm
.
Get_size
()
rank
=
comm
.
Get_rank
()
rank
=
comm
.
Get_rank
()
dimension
=
dom
.
dim
dimension
=
dom
.
dim
iglob
=
npw
.
integer_zeros
((
size
,
dimension
*
2
))
iglob
=
npw
.
integer_zeros
((
dimension
*
2
,
size
),
order
=
'
F
'
)
iglob_res
=
npw
.
integer_zeros
((
size
,
dimension
*
2
))
iglob_res
=
npw
.
integer_zeros
((
dimension
*
2
,
size
),
order
=
'
F
'
)
iglob
[
0
::
2
,
rank
]
=
0
iglob
[
1
::
2
,
rank
]
=
-
1
iglob
[
1
::
2
,
rank
]
=
-
1
if
root
is
None
:
if
root
is
None
:
comm
.
Allgather
([
iglob
[
rank
,
:
],
MPI
.
INT
],
[
iglob_res
,
MPI
.
INT
])
comm
.
Allgather
([
iglob
[
:,
rank
],
MPI
.
INT
],
[
iglob_res
,
MPI
.
INT
])
else
:
else
:
comm
.
Gather
([
iglob
[
rank
,
:],
MPI
.
INT
],
[
iglob_res
,
MPI
.
INT
],
comm
.
Gather
([
iglob
[:,
rank
],
MPI
.
INT
],
[
iglob_res
,
MPI
.
INT
],
root
=
root
)
root
=
root
)
if
toslice
:
if
toslice
:
return
Utils
.
array_to_dict
(
iglob_res
.
T
)
return
Utils
.
array_to_dict
(
iglob_res
)
else
:
else
:
return
iglob_res
.
T
return
iglob_res
else
:
else
:
return
TopoTools
.
gather_global_indices
(
topo
,
toslice
,
root
,
comm
)
return
TopoTools
.
gather_global_indices
(
topo
,
toslice
,
root
,
comm
)
...
@@ -286,8 +283,6 @@ class TopoTools(object):
...
@@ -286,8 +283,6 @@ class TopoTools(object):
basetype
=
dtype_to_mpi_type
(
dtype
)
basetype
=
dtype_to_mpi_type
(
dtype
)
subtype
=
basetype
.
Create_subarray
(
shape
,
subshape
,
substart
,
order
=
order
)
subtype
=
basetype
.
Create_subarray
(
shape
,
subshape
,
substart
,
order
=
order
)
subtype
.
Commit
()
subtype
.
Commit
()
# print 'MPI_Create_subarray(shape={}, subshape={}, substart={}, order={})'.format(
# shape, subshape, substart, 'C' if order is MPI.ORDER_C else 'F')
return
subtype
return
subtype
@staticmethod
@staticmethod
...
...
This diff is collapsed.
Click to expand it.
hysop/problem.py
+
4
−
1
View file @
d6843871
...
@@ -100,7 +100,7 @@ class Problem(ComputationalGraph):
...
@@ -100,7 +100,7 @@ class Problem(ComputationalGraph):
msg
+=
'
\n
If this is required, override check_unique_clenv().
'
msg
+=
'
\n
If this is required, override check_unique_clenv().
'
raise
RuntimeError
(
msg
)
raise
RuntimeError
(
msg
)
def
initialize_field
(
self
,
field
,
**
kwds
):
def
initialize_field
(
self
,
field
,
mpi_params
=
None
,
**
kwds
):
"""
Initialize a field on all its input and output topologies.
"""
"""
Initialize a field on all its input and output topologies.
"""
initialized
=
set
()
initialized
=
set
()
for
op
in
self
.
nodes
:
for
op
in
self
.
nodes
:
...
@@ -113,6 +113,9 @@ class Problem(ComputationalGraph):
...
@@ -113,6 +113,9 @@ class Problem(ComputationalGraph):
if
all
((
df
in
initialized
)
for
df
in
dfield
.
discrete_fields
()):
if
all
((
df
in
initialized
)
for
df
in
dfield
.
discrete_fields
()):
# all contained scalar fields were already initialized
# all contained scalar fields were already initialized
continue
continue
elif
mpi_params
and
mpi_params
.
task_id
!=
dfield
.
topology
.
task_id
:
# Topology task does not matches given mpi_params task
continue
else
:
else
:
components
=
()
components
=
()
for
(
component
,
scalar_dfield
)
in
dfield
.
nd_iter
():
for
(
component
,
scalar_dfield
)
in
dfield
.
nd_iter
():
...
...
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