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
733dbc51
Commit
733dbc51
authored
7 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Plain Diff
Merge branch 'runner_alignment' into 'master'
Align the runner structures on a memory bound. Closes
#395
See merge request
!481
parents
5c87444c
8f24ed26
No related branches found
No related tags found
1 merge request
!481
Align the runner structures on a memory bound.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
configure.ac
+27
-0
27 additions, 0 deletions
configure.ac
src/engine.c
+21
-14
21 additions, 14 deletions
src/engine.c
with
48 additions
and
14 deletions
configure.ac
+
27
−
0
View file @
733dbc51
...
...
@@ -369,6 +369,33 @@ if test "$enable_san" = "yes"; then
fi
fi
# Add the undefined sanitizer option to flags. Only useful for GCC
# version 4.9 and later and clang to detected undefined code behaviour
# such as integer overflow and memory alignment issues.
AC_ARG_ENABLE([undefined-sanitizer],
[AS_HELP_STRING([--enable-undefined-sanitizer],
[Enable detection of code that causes undefined behaviour @<:@no/yes@:>@]
)],
[enable_ubsan="$enableval"],
[enable_ubsan="no"]
)
if test "$enable_ubsan" = "yes"; then
if test "$ax_cv_c_compiler_vendor" = "gnu"; then
AX_COMPARE_VERSION( $ax_cv_c_compiler_version, [ge], [4.9.0],
[enable_ubsan="yes"], [enable_ubsan="no"] )
elif test "$ax_cv_c_compiler_vendor" = "clang"; then
AX_COMPARE_VERSION( $ax_cv_c_compiler_version, [ge], [3.7.0],
[enable_ubsan="yes"], [enable_ubsan="no"] )
fi
if test "$enable_ubsan" = "yes"; then
CFLAGS="$CFLAGS -fsanitize=undefined"
AC_MSG_RESULT([added undefined sanitizer support])
else
AC_MSG_WARN([Compiler does not support undefined sanitizer option])
fi
fi
# Autoconf stuff.
AC_PROG_INSTALL
AC_PROG_MAKE_SET
...
...
This diff is collapsed.
Click to expand it.
src/engine.c
+
21
−
14
View file @
733dbc51
...
...
@@ -1482,9 +1482,9 @@ void engine_exchange_cells(struct engine *e) {
}
/* Allocate the pcells. */
struct
pcell
*
pcells
;
if
(
(
pcells
=
(
struct
pcell
*
)
malloc
(
sizeof
(
struct
pcell
)
*
count_out
))
==
NULL
)
struct
pcell
*
pcells
=
NULL
;
if
(
posix_memalign
((
void
**
)
&
pcells
,
SWIFT_CACHE_ALIGNMENT
,
sizeof
(
struct
pcell
)
*
count_out
)
!=
0
)
error
(
"Failed to allocate pcell buffer."
);
/* Pack the cells. */
...
...
@@ -2048,11 +2048,14 @@ void engine_exchange_proxy_multipoles(struct engine *e) {
}
/* Allocate the buffers for the packed data */
struct
gravity_tensors
*
buffer_send
=
malloc
(
sizeof
(
struct
gravity_tensors
)
*
count_send
);
struct
gravity_tensors
*
buffer_recv
=
malloc
(
sizeof
(
struct
gravity_tensors
)
*
count_recv
);
if
(
buffer_send
==
NULL
||
buffer_recv
==
NULL
)
struct
gravity_tensors
*
buffer_send
=
NULL
;
if
(
posix_memalign
((
void
**
)
&
buffer_send
,
SWIFT_CACHE_ALIGNMENT
,
count_send
*
sizeof
(
struct
gravity_tensors
))
!=
0
)
error
(
"Unable to allocate memory for multipole transactions"
);
struct
gravity_tensors
*
buffer_recv
=
NULL
;
if
(
posix_memalign
((
void
**
)
&
buffer_recv
,
SWIFT_CACHE_ALIGNMENT
,
count_recv
*
sizeof
(
struct
gravity_tensors
))
!=
0
)
error
(
"Unable to allocate memory for multipole transactions"
);
/* Also allocate the MPI requests */
...
...
@@ -4893,8 +4896,10 @@ void engine_split(struct engine *e, struct partition *initial_partition) {
posix_memalign
((
void
**
)
&
xparts_new
,
xpart_align
,
sizeof
(
struct
xpart
)
*
s
->
size_parts
)
!=
0
)
error
(
"Failed to allocate new part data."
);
memcpy
(
parts_new
,
s
->
parts
,
sizeof
(
struct
part
)
*
s
->
nr_parts
);
memcpy
(
xparts_new
,
s
->
xparts
,
sizeof
(
struct
xpart
)
*
s
->
nr_parts
);
if
(
s
->
nr_parts
>
0
)
{
memcpy
(
parts_new
,
s
->
parts
,
sizeof
(
struct
part
)
*
s
->
nr_parts
);
memcpy
(
xparts_new
,
s
->
xparts
,
sizeof
(
struct
xpart
)
*
s
->
nr_parts
);
}
free
(
s
->
parts
);
free
(
s
->
xparts
);
s
->
parts
=
parts_new
;
...
...
@@ -4913,7 +4918,8 @@ void engine_split(struct engine *e, struct partition *initial_partition) {
if
(
posix_memalign
((
void
**
)
&
sparts_new
,
spart_align
,
sizeof
(
struct
spart
)
*
s
->
size_sparts
)
!=
0
)
error
(
"Failed to allocate new spart data."
);
memcpy
(
sparts_new
,
s
->
sparts
,
sizeof
(
struct
spart
)
*
s
->
nr_sparts
);
if
(
s
->
nr_sparts
>
0
)
memcpy
(
sparts_new
,
s
->
sparts
,
sizeof
(
struct
spart
)
*
s
->
nr_sparts
);
free
(
s
->
sparts
);
s
->
sparts
=
sparts_new
;
...
...
@@ -4930,7 +4936,8 @@ void engine_split(struct engine *e, struct partition *initial_partition) {
if
(
posix_memalign
((
void
**
)
&
gparts_new
,
gpart_align
,
sizeof
(
struct
gpart
)
*
s
->
size_gparts
)
!=
0
)
error
(
"Failed to allocate new gpart data."
);
memcpy
(
gparts_new
,
s
->
gparts
,
sizeof
(
struct
gpart
)
*
s
->
nr_gparts
);
if
(
s
->
nr_gparts
>
0
)
memcpy
(
gparts_new
,
s
->
gparts
,
sizeof
(
struct
gpart
)
*
s
->
nr_gparts
);
free
(
s
->
gparts
);
s
->
gparts
=
gparts_new
;
...
...
@@ -5450,8 +5457,8 @@ void engine_init(struct engine *e, struct space *s,
parser_get_opt_param_int
(
params
,
"Scheduler:mpi_message_limit"
,
4
)
*
1024
;
/* Allocate and init the threads. */
if
(
(
e
->
runners
=
(
struct
runner
*
)
malloc
(
sizeof
(
struct
runner
)
*
e
->
nr_threads
))
=
=
NULL
)
if
(
posix_memalign
((
void
**
)
&
e
->
runners
,
SWIFT_CACHE_ALIGNMENT
,
e
->
nr_threads
*
sizeof
(
struct
runner
))
!
=
0
)
error
(
"Failed to allocate threads array."
);
for
(
int
k
=
0
;
k
<
e
->
nr_threads
;
k
++
)
{
e
->
runners
[
k
].
id
=
k
;
...
...
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