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
e36ec96b
Commit
e36ec96b
authored
3 years ago
by
EXT Jean-Matthieu Etancelin
Browse files
Options
Downloads
Patches
Plain Diff
Fix problem when checkpoint_handler is none
parent
3c922011
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
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hysop/problem.py
+9
-7
9 additions, 7 deletions
hysop/problem.py
with
9 additions
and
7 deletions
hysop/problem.py
+
9
−
7
View file @
e36ec96b
import
sys
,
datetime
import
sys
import
datetime
from
hysop.constants
import
Backend
,
MemoryOrdering
from
hysop.tools.types
import
check_instance
,
first_not_None
,
to_tuple
,
to_list
...
...
@@ -15,7 +16,7 @@ class Problem(ComputationalGraph):
def
__init__
(
self
,
name
=
None
,
method
=
None
,
mpi_params
=
None
,
check_unique_clenv
=
True
,
**
kwds
):
mpi_params
=
first_not_None
(
mpi_params
,
MPIParams
())
# enforce mpi params for problems
mpi_params
=
first_not_None
(
mpi_params
,
MPIParams
())
# enforce mpi params for problems
super
(
Problem
,
self
).
__init__
(
name
=
name
,
method
=
method
,
mpi_params
=
mpi_params
,
**
kwds
)
self
.
_do_check_unique_clenv
=
check_unique_clenv
...
...
@@ -138,8 +139,9 @@ class Problem(ComputationalGraph):
simu
.
initialize
()
check_instance
(
checkpoint_handler
,
CheckpointHandler
,
allow_none
=
True
)
checkpoint_handler
.
create_checkpoint_template
(
self
,
simu
)
checkpoint_handler
.
load_checkpoint
(
self
,
simu
)
if
checkpoint_handler
:
checkpoint_handler
.
create_checkpoint_template
(
self
,
simu
)
checkpoint_handler
.
load_checkpoint
(
self
,
simu
)
vprint
(
'
\n
Solving problem...
'
)
with
Timer
()
as
tm
:
...
...
@@ -147,7 +149,7 @@ class Problem(ComputationalGraph):
vprint
()
simu
.
print_state
()
self
.
apply
(
simulation
=
simu
,
dbg
=
dbg
,
**
kwds
)
should_dump_checkpoint
=
checkpoint_handler
.
should_dump
(
simu
)
# determined before simu advance
should_dump_checkpoint
=
checkpoint_handler
and
checkpoint_handler
.
should_dump
(
simu
)
# determined before simu advance
simu
.
advance
(
dbg
=
dbg
,
plot_freq
=
plot_freq
)
if
should_dump_checkpoint
:
checkpoint_handler
.
save_checkpoint
(
self
,
simu
)
...
...
@@ -166,7 +168,8 @@ class Problem(ComputationalGraph):
vprint_banner
(
msg
,
spacing
=
True
,
at_border
=
2
)
simu
.
finalize
()
checkpoint_handler
.
finalize
(
self
.
mpi_params
)
if
checkpoint_handler
:
checkpoint_handler
.
finalize
(
self
.
mpi_params
)
self
.
final_report
()
if
(
dbg
is
not
None
):
...
...
@@ -179,4 +182,3 @@ class Problem(ComputationalGraph):
def
finalize
(
self
):
vprint
(
'
Finalizing problem...
'
)
super
(
Problem
,
self
).
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