Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fluidsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
This instance will be upgraded to Heptapod 17.11.0rc1 on 2025-04-24 between 17:00 and 18:00 UTC+2
Show more breadcrumbs
fluiddyn
fluidsim
Commits
3cc17153
Commit
3cc17153
authored
6 years ago
by
Pierre Augier
Browse files
Options
Downloads
Patches
Plain Diff
load_params_simul with MPI
parent
4b18bb52
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fluidsim/base/params.py
+36
-27
36 additions, 27 deletions
fluidsim/base/params.py
fluidsim/base/test/test_base_solver_ps.py
+2
-2
2 additions, 2 deletions
fluidsim/base/test/test_base_solver_ps.py
with
38 additions
and
29 deletions
fluidsim/base/params.py
+
36
−
27
View file @
3cc17153
...
...
@@ -189,6 +189,10 @@
def
load_params_simul
(
path
=
None
):
"""
Load the parameters and return a Parameters instance.
"""
if
path
is
None
:
path
=
os
.
getcwd
()
if
mpi
.
rank
>
0
:
params
=
None
params
=
mpi
.
comm
.
bcast
(
params
,
root
=
0
)
else
:
if
path
is
None
:
path
=
os
.
getcwd
()
...
...
@@ -194,12 +198,9 @@
path_xml
=
None
if
os
.
path
.
isdir
(
path
):
path_xml
=
os
.
path
.
join
(
path
,
"
params_simul.xml
"
)
elif
path
.
endswith
(
"
.xml
"
):
if
not
os
.
path
.
exists
(
path
):
raise
ValueError
(
"
The file
"
+
path
+
"
does not exists.
"
)
path_xml
=
path
if
path_xml
is
not
None
and
os
.
path
.
exists
(
path_xml
):
return
Parameters
(
path_file
=
path_xml
)
path_xml
=
None
if
os
.
path
.
isdir
(
path
):
path_xml
=
os
.
path
.
join
(
path
,
"
params_simul.xml
"
)
elif
path
.
endswith
(
"
.xml
"
):
if
not
os
.
path
.
exists
(
path
):
raise
ValueError
(
"
The file
"
+
path
+
"
does not exists.
"
)
path_xml
=
path
...
...
@@ -205,8 +206,11 @@
if
os
.
path
.
isfile
(
path
):
paths
=
[
path
]
else
:
paths
=
glob
(
os
.
path
.
join
(
path
,
"
state_*
"
))
if
paths
:
path
=
sorted
(
paths
)[
0
]
if
path_xml
is
not
None
and
os
.
path
.
exists
(
path_xml
):
params
=
Parameters
(
path_file
=
path_xml
)
else
:
if
os
.
path
.
isfile
(
path
):
paths
=
[
path
]
else
:
paths
=
glob
(
os
.
path
.
join
(
path
,
"
state_*
"
))
if
paths
:
path
=
sorted
(
paths
)[
0
]
...
...
@@ -212,6 +216,6 @@
if
len
(
path
)
>
100
:
str_path
=
"
[...]
"
+
path
[
-
100
:]
else
:
str_path
=
path
if
len
(
path
)
>
100
:
str_path
=
"
[...]
"
+
path
[
-
100
:]
else
:
str_path
=
path
...
...
@@ -217,9 +221,14 @@
print
(
"
load params from file
\n
"
+
str_path
)
with
h5py
.
File
(
path
)
as
h5file
:
return
Parameters
(
hdf5_object
=
h5file
[
"
/info_simul/params
"
])
else
:
return
ValueError
print
(
"
load params from file
\n
"
+
str_path
)
with
h5py
.
File
(
path
)
as
h5file
:
params
=
Parameters
(
hdf5_object
=
h5file
[
"
/info_simul/params
"
])
else
:
raise
ValueError
if
mpi
.
nb_proc
>
1
:
params
=
mpi
.
comm
.
bcast
(
params
,
root
=
0
)
return
params
def
load_info_solver
(
path_dir
=
None
):
...
...
This diff is collapsed.
Click to expand it.
fluidsim/base/test/test_base_solver_ps.py
+
2
−
2
View file @
3cc17153
...
...
@@ -64,6 +64,7 @@
"""
Should be able to run a base experiment.
"""
with
stdout_redirected
():
self
.
sim
.
time_stepping
.
start
()
load_params_simul
(
self
.
sim
.
output
.
path_run
+
"
/params_simul.xml
"
)
fld
.
show
()
...
...
@@ -72,5 +73,5 @@
with
stdout_redirected
():
modif_resolution_from_dir
(
self
.
sim
.
output
.
path_run
,
coef_modif_resol
=
3
/
2
,
PLOT
=
False
self
.
sim
.
output
.
path_run
,
coef_modif_resol
=
3
.
/
2
,
PLOT
=
False
)
...
...
@@ -76,5 +77,4 @@
)
load_params_simul
(
self
.
sim
.
output
.
path_run
+
"
/params_simul.xml
"
)
path_new
=
os
.
path
.
join
(
self
.
sim
.
output
.
path_run
,
"
State_phys_12x12
"
)
os
.
chdir
(
path_new
)
load_params_simul
()
...
...
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