Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
b35e5126
Commit
b35e5126
authored
Sep 01, 2017
by
Matthieu Schaller
Browse files
Prevent floating point excetion involving the padded gravity caches
parent
33bbf9ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/gravity_cache.h
View file @
b35e5126
...
...
@@ -131,7 +131,7 @@ static INLINE void gravity_cache_init(struct gravity_cache *c, int count) {
*/
__attribute__
((
always_inline
))
INLINE
void
gravity_cache_populate
(
struct
gravity_cache
*
c
,
const
struct
gpart
*
restrict
gparts
,
int
gcount
,
int
gcount_padded
,
const
double
shift
[
3
])
{
int
gcount_padded
,
const
double
shift
[
3
]
,
const
struct
cell
*
cell
)
{
/* Make the compiler understand we are in happy vectorization land */
float
*
restrict
x
=
c
->
x
;
...
...
@@ -161,9 +161,9 @@ __attribute__((always_inline)) INLINE void gravity_cache_populate(
/* Pad the caches */
for
(
int
i
=
gcount
;
i
<
gcount_padded
;
++
i
)
{
x
[
i
]
=
0
.
f
;
y
[
i
]
=
0
.
f
;
z
[
i
]
=
0
.
f
;
x
[
i
]
=
-
3
.
f
*
cell
->
width
[
0
]
;
y
[
i
]
=
-
3
.
f
*
cell
->
width
[
0
]
;
z
[
i
]
=
-
3
.
f
*
cell
->
width
[
0
]
;
epsilon
[
i
]
=
0
.
f
;
m
[
i
]
=
0
.
f
;
}
...
...
src/runner_doiact_grav.h
View file @
b35e5126
...
...
@@ -194,9 +194,9 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
/* Fill the caches */
gravity_cache_populate
(
ci_cache
,
gparts_i
,
gcount_i
,
gcount_padded_i
,
loc_mean
);
loc_mean
,
ci
);
gravity_cache_populate
(
cj_cache
,
gparts_j
,
gcount_j
,
gcount_padded_j
,
loc_mean
);
loc_mean
,
cj
);
/* Ok... Here we go ! */
...
...
@@ -542,9 +542,9 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
/* Fill the caches */
gravity_cache_populate
(
ci_cache
,
gparts_i
,
gcount_i
,
gcount_padded_i
,
loc_mean
);
loc_mean
,
ci
);
gravity_cache_populate
(
cj_cache
,
gparts_j
,
gcount_j
,
gcount_padded_j
,
loc_mean
);
loc_mean
,
cj
);
/* Ok... Here we go ! */
...
...
@@ -941,7 +941,7 @@ void runner_doself_grav_pp_full(struct runner *r, struct cell *c) {
/* Computed the padded counts */
const
int
gcount_padded
=
gcount
-
(
gcount
%
VEC_SIZE
)
+
VEC_SIZE
;
gravity_cache_populate
(
ci_cache
,
gparts
,
gcount
,
gcount_padded
,
loc
);
gravity_cache_populate
(
ci_cache
,
gparts
,
gcount
,
gcount_padded
,
loc
,
c
);
/* Ok... Here we go ! */
...
...
@@ -1155,7 +1155,7 @@ void runner_doself_grav_pp_truncated(struct runner *r, struct cell *c) {
/* Computed the padded counts */
const
int
gcount_padded
=
gcount
-
(
gcount
%
VEC_SIZE
)
+
VEC_SIZE
;
gravity_cache_populate
(
ci_cache
,
gparts
,
gcount
,
gcount_padded
,
loc
);
gravity_cache_populate
(
ci_cache
,
gparts
,
gcount
,
gcount_padded
,
loc
,
c
);
/* Ok... Here we go ! */
...
...
Matthieu Schaller
@matthieu
mentioned in issue
#356 (closed)
·
Sep 01, 2017
mentioned in issue
#356 (closed)
mentioned in issue #356
Toggle commit list
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment