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
46bcfd62
Commit
46bcfd62
authored
7 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Pad last_pj to a multiple of the vector length.
parent
ba3ff1cf
No related branches found
No related tags found
1 merge request
!480
Dopair subset vec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cache.h
+5
-5
5 additions, 5 deletions
src/cache.h
with
5 additions
and
5 deletions
src/cache.h
+
5
−
5
View file @
46bcfd62
...
...
@@ -218,7 +218,7 @@ __attribute__((always_inline)) INLINE void cache_read_particles(
__attribute__
((
always_inline
))
INLINE
void
cache_read_particles_subpair
(
const
struct
cell
*
restrict
const
ci
,
struct
cache
*
restrict
const
ci_cache
,
const
struct
entry
*
restrict
sort_i
,
int
*
first_pi
,
int
last_pi
,
const
int
flipped
)
{
struct
cache
*
restrict
const
ci_cache
,
const
struct
entry
*
restrict
sort_i
,
int
*
first_pi
,
int
*
last_pi
,
const
int
flipped
)
{
#if defined(GADGET2_SPH)
...
...
@@ -239,15 +239,15 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subpair(
/* Shift the particles positions to a local frame so single precision can be
* used instead of double precision. */
if
(
!
flipped
)
{
int
rem
=
(
last_pi
+
1
)
%
VEC_SIZE
;
int
rem
=
(
*
last_pi
+
1
)
%
VEC_SIZE
;
if
(
rem
!=
0
)
{
int
pad
=
VEC_SIZE
-
rem
;
/* Increase last_pj if there are particles in the cell left to read. */
if
(
last_pi
+
pad
<
ci
->
count
)
last_pi
+=
pad
;
if
(
*
last_pi
+
pad
<
ci
->
count
)
*
last_pi
+=
pad
;
}
for
(
int
i
=
0
;
i
<
last_pi
;
i
++
)
{
for
(
int
i
=
0
;
i
<
*
last_pi
;
i
++
)
{
const
int
idx
=
sort_i
[
i
].
i
;
x
[
i
]
=
(
float
)(
parts
[
idx
].
x
[
0
]
-
loc
[
0
]);
y
[
i
]
=
(
float
)(
parts
[
idx
].
x
[
1
]
-
loc
[
1
]);
...
...
@@ -266,7 +266,7 @@ __attribute__((always_inline)) INLINE void cache_read_particles_subpair(
const
float
pos_padded
[
3
]
=
{
-
(
2
.
*
ci
->
width
[
0
]
+
max_dx
),
-
(
2
.
*
ci
->
width
[
1
]
+
max_dx
),
-
(
2
.
*
ci
->
width
[
2
]
+
max_dx
)};
const
float
h_padded
=
ci
->
parts
[
0
].
h
;
for
(
int
i
=
last_pi
;
i
<
last_pi
+
VEC_SIZE
;
i
++
)
{
for
(
int
i
=
*
last_pi
;
i
<
*
last_pi
+
VEC_SIZE
;
i
++
)
{
x
[
i
]
=
pos_padded
[
0
];
y
[
i
]
=
pos_padded
[
1
];
z
[
i
]
=
pos_padded
[
2
];
...
...
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