Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
be5d3966
Commit
be5d3966
authored
7 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Also use the new mechanism when doing i/o with parallel-hdf5
parent
2e33483d
No related branches found
No related tags found
1 merge request
!460
Improvements to i/o and parallel-i/o
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/parallel_io.c
+47
-12
47 additions, 12 deletions
src/parallel_io.c
with
47 additions
and
12 deletions
src/parallel_io.c
+
47
−
12
View file @
be5d3966
...
@@ -254,6 +254,7 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
...
@@ -254,6 +254,7 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
const
size_t
typeSize
=
io_sizeof_type
(
props
.
type
);
const
size_t
typeSize
=
io_sizeof_type
(
props
.
type
);
const
size_t
copySize
=
typeSize
*
props
.
dimension
;
const
size_t
copySize
=
typeSize
*
props
.
dimension
;
const
size_t
num_elements
=
N
*
props
.
dimension
;
const
size_t
num_elements
=
N
*
props
.
dimension
;
const
size_t
dim
=
props
.
dimension
;
/* Can't handle writes of more than 2GB */
/* Can't handle writes of more than 2GB */
if
(
N
*
props
.
dimension
*
typeSize
>
HDF5_PARALLEL_IO_MAX_BYTES
)
if
(
N
*
props
.
dimension
*
typeSize
>
HDF5_PARALLEL_IO_MAX_BYTES
)
...
@@ -265,25 +266,59 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
...
@@ -265,25 +266,59 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
void
*
temp
=
malloc
(
num_elements
*
typeSize
);
void
*
temp
=
malloc
(
num_elements
*
typeSize
);
if
(
temp
==
NULL
)
error
(
"Unable to allocate memory for temporary buffer"
);
if
(
temp
==
NULL
)
error
(
"Unable to allocate memory for temporary buffer"
);
/* Copy particle data to temporary buffer */
/* Copy particle data to temporary buffer */
if
(
props
.
convert_part
==
NULL
&&
if
(
props
.
conversion
==
0
)
{
/* No conversion */
props
.
convert_gpart
==
NULL
)
{
/* No conversion */
char
*
temp_c
=
temp
;
char
*
temp_c
=
temp
;
for
(
size_t
i
=
0
;
i
<
N
;
++
i
)
for
(
size_t
i
=
0
;
i
<
N
;
++
i
)
memcpy
(
&
temp_c
[
i
*
copySize
],
props
.
field
+
i
*
props
.
partSize
,
copySize
);
memcpy
(
&
temp_c
[
i
*
copySize
],
props
.
field
+
i
*
props
.
partSize
,
copySize
);
}
else
if
(
props
.
convert_part
!=
NULL
)
{
/* conversion (for parts)
*/
}
else
{
/* Converting particle to data
*/
float
*
temp_f
=
temp
;
if
(
props
.
convert_part_f
!=
NULL
)
{
for
(
size_t
i
=
0
;
i
<
N
;
++
i
)
temp_f
[
i
]
=
props
.
convert_part
(
e
,
&
props
.
parts
[
i
]);
}
else
if
(
props
.
convert_gpart
!=
NULL
)
{
/* conversion (for gparts)*/
swift_declare_aligned_ptr
(
float
,
temp_f
,
temp
,
SWIFT_CACHE_ALIGNMENT
);
swift_declare_aligned_ptr
(
const
struct
part
,
parts
,
props
.
parts
,
SWIFT_STRUCT_ALIGNMENT
);
float
*
temp_f
=
temp
;
/* float conversion for parts */
for
(
size_t
i
=
0
;
i
<
N
;
++
i
)
for
(
size_t
i
=
0
;
i
<
N
;
i
++
)
temp_f
[
i
]
=
props
.
convert_gpart
(
e
,
&
props
.
gparts
[
i
]);
props
.
convert_part_f
(
e
,
&
parts
[
i
],
&
temp_f
[
i
*
dim
]);
}
else
if
(
props
.
convert_part_d
!=
NULL
)
{
swift_declare_aligned_ptr
(
double
,
temp_d
,
temp
,
SWIFT_CACHE_ALIGNMENT
);
swift_declare_aligned_ptr
(
const
struct
part
,
parts
,
props
.
parts
,
SWIFT_STRUCT_ALIGNMENT
);
/* double conversion for parts */
for
(
size_t
i
=
0
;
i
<
N
;
i
++
)
props
.
convert_part_d
(
e
,
&
parts
[
i
],
&
temp_d
[
i
*
dim
]);
}
else
if
(
props
.
convert_gpart_f
!=
NULL
)
{
swift_declare_aligned_ptr
(
float
,
temp_f
,
temp
,
SWIFT_CACHE_ALIGNMENT
);
swift_declare_aligned_ptr
(
const
struct
gpart
,
gparts
,
props
.
gparts
,
SWIFT_STRUCT_ALIGNMENT
);
/* float conversion for gparts */
for
(
size_t
i
=
0
;
i
<
N
;
i
++
)
props
.
convert_gpart_f
(
e
,
&
gparts
[
i
],
&
temp_f
[
i
*
dim
]);
}
else
if
(
props
.
convert_gpart_d
!=
NULL
)
{
swift_declare_aligned_ptr
(
double
,
temp_d
,
temp
,
SWIFT_CACHE_ALIGNMENT
);
swift_declare_aligned_ptr
(
const
struct
gpart
,
gparts
,
props
.
gparts
,
SWIFT_STRUCT_ALIGNMENT
);
/* double conversion for gparts */
for
(
size_t
i
=
0
;
i
<
N
;
i
++
)
props
.
convert_gpart_d
(
e
,
&
gparts
[
i
],
&
temp_d
[
i
*
dim
]);
}
else
{
error
(
"Missing conversion function"
);
}
}
}
/* Unit conversion if necessary */
/* Unit conversion if necessary */
...
@@ -294,10 +329,10 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
...
@@ -294,10 +329,10 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
/* message("Converting ! factor=%e", factor); */
/* message("Converting ! factor=%e", factor); */
if
(
io_is_double_precision
(
props
.
type
))
{
if
(
io_is_double_precision
(
props
.
type
))
{
double
*
temp_d
=
temp
;
swift_declare_aligned_ptr
(
double
,
temp_d
,
temp
,
SWIFT_CACHE_ALIGNMENT
)
;
for
(
size_t
i
=
0
;
i
<
num_elements
;
++
i
)
temp_d
[
i
]
*=
factor
;
for
(
size_t
i
=
0
;
i
<
num_elements
;
++
i
)
temp_d
[
i
]
*=
factor
;
}
else
{
}
else
{
float
*
temp_f
=
temp
;
swift_declare_aligned_ptr
(
float
,
temp_f
,
temp
,
SWIFT_CACHE_ALIGNMENT
)
;
for
(
size_t
i
=
0
;
i
<
num_elements
;
++
i
)
temp_f
[
i
]
*=
factor
;
for
(
size_t
i
=
0
;
i
<
num_elements
;
++
i
)
temp_f
[
i
]
*=
factor
;
}
}
}
}
...
...
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