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
04e25d26
"...compcert-kvx.git" did not exist on "a74f6b45d72834b5b8417297017bd81424123d98"
Commit
04e25d26
authored
5 years ago
by
EXT Jean-Matthieu Etancelin
Browse files
Options
Downloads
Patches
Plain Diff
improve iterative simulation config
parent
8abd0860
No related branches found
No related tags found
1 merge request
!16
MPI operators
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hysop/iterative_method.py
+17
-7
17 additions, 7 deletions
hysop/iterative_method.py
with
17 additions
and
7 deletions
hysop/iterative_method.py
+
17
−
7
View file @
04e25d26
...
@@ -4,7 +4,7 @@ from hysop import Simulation, Problem
...
@@ -4,7 +4,7 @@ from hysop import Simulation, Problem
from
hysop.parameters.scalar_parameter
import
ScalarParameter
from
hysop.parameters.scalar_parameter
import
ScalarParameter
from
hysop.tools.contexts
import
Timer
from
hysop.tools.contexts
import
Timer
from
hysop
import
dprint
,
vprint
from
hysop
import
dprint
,
vprint
from
hysop.tools.decorators
import
debug
from
hysop.tools.decorators
import
debug
from
hysop.core.graph.graph
import
ready
from
hysop.core.graph.graph
import
ready
from
hysop.constants
import
HYSOP_REAL
,
HYSOP_INTEGER
from
hysop.constants
import
HYSOP_REAL
,
HYSOP_INTEGER
from
hysop.simulation
import
eps
from
hysop.simulation
import
eps
...
@@ -13,6 +13,7 @@ from hysop.core.mpi import main_rank, main_size, main_comm
...
@@ -13,6 +13,7 @@ from hysop.core.mpi import main_rank, main_size, main_comm
import
numpy
as
np
import
numpy
as
np
import
datetime
import
datetime
class
PseudoSimulation
(
Simulation
):
class
PseudoSimulation
(
Simulation
):
"""
Pseudo time-iterations for iterative method
"""
"""
Pseudo time-iterations for iterative method
"""
...
@@ -80,8 +81,9 @@ class IterativeMethod(Problem):
...
@@ -80,8 +81,9 @@ class IterativeMethod(Problem):
override Problem class in a proper way. Here only a pseudo-timestep is
override Problem class in a proper way. Here only a pseudo-timestep is
used together with a maximal number of iteration to compute a pseudo-final time.
used together with a maximal number of iteration to compute a pseudo-final time.
"""
"""
def
__init__
(
self
,
stop_criteria
,
tolerance
=
1e-8
,
state_print
=
100
,
max_iter
=
10000
,
def
__init__
(
self
,
stop_criteria
,
tolerance
=
1e-8
,
state_print
=
100
,
max_iter
=
10000
,
dt0
=
None
,
dt
=
None
,
**
kwargs
):
dt0
=
None
,
dt
=
None
,
configsimu
=
None
,
**
kwargs
):
super
(
IterativeMethod
,
self
).
__init__
(
**
kwargs
)
super
(
IterativeMethod
,
self
).
__init__
(
**
kwargs
)
self
.
stop_criteria
,
self
.
tolerance
=
stop_criteria
,
tolerance
self
.
stop_criteria
,
self
.
tolerance
=
stop_criteria
,
tolerance
...
@@ -104,9 +106,16 @@ class IterativeMethod(Problem):
...
@@ -104,9 +106,16 @@ class IterativeMethod(Problem):
dtype
=
self
.
stop_criteria
.
dtype
)
dtype
=
self
.
stop_criteria
.
dtype
)
self
.
_stop_criteria_reset
[...]
=
1e10
self
.
_stop_criteria_reset
[...]
=
1e10
self
.
configsimu
=
self
.
_default_configsimu
if
not
configsimu
is
None
:
self
.
configsimu
=
configsimu
def
_default_configsimu
(
self
,
l
,
s
):
pass
@debug
@debug
@ready
@ready
def
apply
(
self
,
simulation
,
configsimu
=
lambda
l
:
None
,
report_freq
=
10
0
,
**
kwds
):
def
apply
(
self
,
simulation
,
report_freq
=
0
,
**
kwds
):
vprint
(
'
=== Entering iterative method...
'
)
vprint
(
'
=== Entering iterative method...
'
)
self
.
stop_criteria
.
value
=
self
.
_stop_criteria_reset
self
.
stop_criteria
.
value
=
self
.
_stop_criteria_reset
...
@@ -119,8 +128,9 @@ class IterativeMethod(Problem):
...
@@ -119,8 +128,9 @@ class IterativeMethod(Problem):
dt0
=
self
.
dt0
,
dt
=
self
.
dt
,
dt0
=
self
.
dt0
,
dt
=
self
.
dt
,
t
=
ScalarParameter
(
name
=
'
dummy-t
'
,
t
=
ScalarParameter
(
name
=
'
dummy-t
'
,
dtype
=
HYSOP_REAL
,
dtype
=
HYSOP_REAL
,
quiet
=
True
))
quiet
=
True
),
configsimu
(
loop
)
mpi_params
=
self
.
mpi_params
)
self
.
configsimu
(
loop
,
simulation
)
# Usual initialize-loop-finalize sequence :
# Usual initialize-loop-finalize sequence :
loop
.
initialize
()
loop
.
initialize
()
with
Timer
()
as
tm
:
with
Timer
()
as
tm
:
...
@@ -140,8 +150,8 @@ class IterativeMethod(Problem):
...
@@ -140,8 +150,8 @@ class IterativeMethod(Problem):
formatter
=
{
'
float_kind
'
:
lambda
x
:
'
{:8.8f}
'
.
format
(
x
)}),
formatter
=
{
'
float_kind
'
:
lambda
x
:
'
{:8.8f}
'
.
format
(
x
)}),
datetime
.
timedelta
(
seconds
=
round
(
avg_time
)),
datetime
.
timedelta
(
seconds
=
round
(
avg_time
)),
avg_time
,
avg_time
,
''
if
main_size
==
1
else
'
, averaged over {} ranks.
'
.
format
(
main_size
)))
''
if
main_size
==
1
else
'
, averaged over {} ranks.
'
.
format
(
main_size
)))
self
.
it_num
.
value
=
loop
.
current_iteration
self
.
it_num
.
value
=
loop
.
current_iteration
loop
.
finalize
()
loop
.
finalize
()
self
.
final_report
()
self
.
final_report
()
...
...
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