Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pySDC
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
atml-ati
pySDC
Commits
9dc9f344
Commit
9dc9f344
authored
3 months ago
by
Thibaut Lunet
Browse files
Options
Downloads
Patches
Plain Diff
TL: better implementation
parent
9bcb6f08
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pySDC/helpers/fieldsIO.py
+4
-6
4 additions, 6 deletions
pySDC/helpers/fieldsIO.py
with
4 additions
and
6 deletions
pySDC/helpers/fieldsIO.py
+
4
−
6
View file @
9dc9f344
...
...
@@ -439,7 +439,7 @@ class Rectilinear(Scalar):
coords
=
[
np
.
fromfile
(
f
,
dtype
=
np
.
float64
,
count
=
n
)
for
n
in
gridSizes
]
self
.
setHeader
(
nVar
,
coords
)
if
self
.
MPI_ON
:
self
.
MPI_SETUP
()
self
.
MPI_SETUP
_FILETYPE
()
def
reshape
(
self
,
fields
:
np
.
ndarray
):
"""
Reshape the fields to a N-d array (inplace operation)
"""
...
...
@@ -537,7 +537,7 @@ class Rectilinear(Scalar):
return
True
return
self
.
comm
.
Get_rank
()
==
0
def
MPI_SETUP
(
self
):
def
MPI_SETUP
_FILETYPE
(
self
):
"""
Setup subarray masks for each processes
"""
self
.
mpiType
=
MPI_DTYPE
(
self
.
dtype
)
self
.
mpiFileType
=
self
.
mpiType
.
Create_subarray
(
...
...
@@ -554,6 +554,8 @@ class Rectilinear(Scalar):
"
a
"
:
MPI
.
MODE_WRONLY
|
MPI
.
MODE_APPEND
,
}[
mode
]
self
.
mpiFile
=
MPI
.
File
.
Open
(
self
.
comm
,
self
.
fileName
,
amode
)
if
self
.
mpiType
is
None
:
self
.
MPI_SETUP_FILETYPE
()
def
MPI_WRITE
(
self
,
data
):
"""
Write data (np.ndarray) in the binary file in MPI mode, at the current file cursor position.
"""
...
...
@@ -571,8 +573,6 @@ class Rectilinear(Scalar):
data : np.ndarray
Data to be written in the binary file.
"""
if
self
.
mpiType
is
None
:
self
.
MPI_SETUP
()
self
.
mpiFile
.
Set_view
(
disp
=
offset
,
etype
=
self
.
mpiType
,
filetype
=
self
.
mpiFileType
)
self
.
mpiFile
.
Write_all
(
data
)
...
...
@@ -588,8 +588,6 @@ class Rectilinear(Scalar):
data : np.ndarray
Array on which to read the data from the binary file.
"""
if
self
.
mpiType
is
None
:
self
.
MPI_SETUP
()
self
.
mpiFile
.
Set_view
(
disp
=
offset
,
etype
=
self
.
mpiType
,
filetype
=
self
.
mpiFileType
)
self
.
mpiFile
.
Read_all
(
data
)
...
...
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