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
1cf3fdf1
Commit
1cf3fdf1
authored
11 years ago
by
Jean-Matthieu Etancelin
Browse files
Options
Downloads
Patches
Plain Diff
Fix analytic. start mpi testing
parent
4fea5a66
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
Examples/demo_mpi.py
+59
-0
59 additions, 0 deletions
Examples/demo_mpi.py
HySoP/hysop/operator/analytic.py
+8
-1
8 additions, 1 deletion
HySoP/hysop/operator/analytic.py
with
67 additions
and
1 deletion
Examples/demo_mpi.py
0 → 100644
+
59
−
0
View file @
1cf3fdf1
import
parmepy
as
pp
import
parmepy.tools.numpywrappers
as
npw
from
parmepy.fields.continuous
import
Field
from
parmepy.mpi.main_var
import
main_size
,
main_rank
from
parmepy.mpi.topology
import
Cartesian
from
parmepy.operator.analytic
import
Analytic
from
parmepy.operator.redistribute
import
Redistribute
assert
main_size
==
4
,
'
Use 4 process for this test
'
def
func
(
res
,
x
,
y
,
z
,
t
=
0.
):
res
[
0
]
=
x
res
[
1
]
=
y
**
2
res
[
2
]
=
x
+
y
return
res
b
=
pp
.
Box
()
f
=
Field
(
domain
=
b
,
name
=
"
Test_Vec
"
,
isVector
=
True
,
formula
=
func
)
nb_elem
=
[
17
,
]
*
3
topo_q
=
Cartesian
.
withResolutionFixed
(
b
,
shape
=
npw
.
integerarray
([
2
,
1
,
2
]),
globalMeshResolution
=
npw
.
integerarray
(
nb_elem
),
)
topo_p
=
Cartesian
.
withResolutionFixed
(
b
,
shape
=
npw
.
integerarray
([
1
,
4
,
1
]),
globalMeshResolution
=
npw
.
integerarray
(
nb_elem
),
)
topo_q
.
setUp
()
topo_p
.
setUp
()
op_p
=
Analytic
([
f
],
{
f
:
nb_elem
},
topo
=
topo_p
)
op_q
=
Analytic
([
f
],
{
f
:
nb_elem
},
topo
=
topo_q
)
op_p
.
discretize
()
op_q
.
discretize
()
op_p
.
setUp
()
op_q
.
setUp
()
op_p2q
=
Redistribute
([
f
],
op_p
,
op_q
)
op_p2q
.
discretize
()
op_p2q
.
setUp
()
# print main_rank, 'topo_p', repr(topo_p)
# print main_rank, 'topo_q', repr(topo_q)
# print main_rank, 'topo_q', f.discreteFields.keys()
print
main_rank
,
'
topo_p
'
,
topo_p
print
main_rank
,
'
topo_q
'
,
topo_q
f
.
setTopoInit
(
topo_p
)
f
.
initialize
()
op_p2q
.
apply
()
op_p2q
.
wait
()
print
main_rank
,
'
norm, topo_p
'
,
f
.
norm
(
topo_p
)
print
main_rank
,
'
norm, topo_q
'
,
f
.
norm
(
topo_q
)
print
main_rank
,
'
norm, topo_p - topo_q
'
,
f
.
norm
(
topo_p
)
-
f
.
norm
(
topo_q
)
This diff is collapsed.
Click to expand it.
HySoP/hysop/operator/analytic.py
+
8
−
1
View file @
1cf3fdf1
...
@@ -45,7 +45,7 @@ class Analytic(Operator):
...
@@ -45,7 +45,7 @@ class Analytic(Operator):
## Dict of resolutions (one per variable)
## Dict of resolutions (one per variable)
self
.
resolutions
=
resolutions
self
.
resolutions
=
resolutions
self
.
output
=
self
.
variables
self
.
output
=
self
.
variables
self
.
_
requirement
=
[]
self
.
requirement
s
=
[]
def
discretize
(
self
):
def
discretize
(
self
):
if
self
.
_predefinedTopo
is
not
None
:
if
self
.
_predefinedTopo
is
not
None
:
...
@@ -67,6 +67,13 @@ class Analytic(Operator):
...
@@ -67,6 +67,13 @@ class Analytic(Operator):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
_isUpToDate
=
True
self
.
_isUpToDate
=
True
def
addRedistributeRequirement
(
self
,
red
):
self
.
requirements
.
append
(
red
)
def
getRedistributeRequirement
(
self
):
return
self
.
requirements
@debug
@debug
def
apply
(
self
,
simulation
=
None
):
def
apply
(
self
,
simulation
=
None
):
assert
simulation
is
not
None
,
\
assert
simulation
is
not
None
,
\
...
...
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