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
6ddfd467
Commit
6ddfd467
authored
7 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Formatting and comments.
parent
d71aa3df
No related branches found
No related tags found
1 merge request
!440
Dopair2 vectorisation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cache.h
+14
-2
14 additions, 2 deletions
src/cache.h
src/runner_doiact_vec.c
+12
-4
12 additions, 4 deletions
src/runner_doiact_vec.c
with
26 additions
and
6 deletions
src/cache.h
+
14
−
2
View file @
6ddfd467
...
...
@@ -296,11 +296,16 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
const
struct
entry
*
restrict
sort_j
,
const
double
*
restrict
const
shift
,
int
*
first_pi
,
int
*
last_pj
)
{
/* Pad number of particles read to the vector size. */
/* Make the number of particles to be read a multiple of the vector size.
* This eliminates serial remainder loops where possible when populating the
* cache. */
/* Is the number of particles to read a multiple of the vector size? */
int
rem
=
(
ci
->
count
-
*
first_pi
)
%
VEC_SIZE
;
if
(
rem
!=
0
)
{
int
pad
=
VEC_SIZE
-
rem
;
/* Decrease first_pi if there are particles in the cell left to read. */
if
(
*
first_pi
-
pad
>=
0
)
*
first_pi
-=
pad
;
}
...
...
@@ -308,6 +313,7 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
if
(
rem
!=
0
)
{
int
pad
=
VEC_SIZE
-
rem
;
/* Increase last_pj if there are particles in the cell left to read. */
if
(
*
last_pj
+
pad
<
cj
->
count
)
*
last_pj
+=
pad
;
}
...
...
@@ -504,11 +510,16 @@ cache_read_two_partial_cells_sorted_force(
const
struct
entry
*
restrict
sort_i
,
const
struct
entry
*
restrict
sort_j
,
const
double
*
const
shift
,
int
*
first_pi
,
int
*
last_pj
)
{
/* Pad number of particles read to the vector size. */
/* Make the number of particles to be read a multiple of the vector size.
* This eliminates serial remainder loops where possible when populating the
* cache. */
/* Is the number of particles to read a multiple of the vector size? */
int
rem
=
(
ci
->
count
-
*
first_pi
)
%
VEC_SIZE
;
if
(
rem
!=
0
)
{
int
pad
=
VEC_SIZE
-
rem
;
/* Decrease first_pi if there are particles in the cell left to read. */
if
(
*
first_pi
-
pad
>=
0
)
*
first_pi
-=
pad
;
}
...
...
@@ -516,6 +527,7 @@ cache_read_two_partial_cells_sorted_force(
if
(
rem
!=
0
)
{
int
pad
=
VEC_SIZE
-
rem
;
/* Increase last_pj if there are particles in the cell left to read. */
if
(
*
last_pj
+
pad
<
cj
->
count
)
*
last_pj
+=
pad
;
}
...
...
This diff is collapsed.
Click to expand it.
src/runner_doiact_vec.c
+
12
−
4
View file @
6ddfd467
...
...
@@ -297,7 +297,8 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
const
float
first_di
=
sort_i
[
first_pi
].
d
+
pi
->
h
*
kernel_gamma
+
dx_max
-
rshift
;
/* Loop through particles in cell j until they are not in range of pi. */
/* Loop through particles in cell j until they are not in range of pi.
* Make sure that temp stays between 0 and cj->count - 1.*/
while
(
temp
<
cj
->
count
-
1
&&
first_di
>
sort_j
[
temp
].
d
)
temp
++
;
max_index_i
[
first_pi
]
=
temp
;
...
...
@@ -309,6 +310,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
const
float
di
=
sort_i
[
i
].
d
+
pi
->
h
*
kernel_gamma
+
dx_max
-
rshift
;
/* Make sure that temp stays between 0 and cj->count - 1.*/
while
(
temp
<
cj
->
count
-
1
&&
di
>
sort_j
[
temp
].
d
)
temp
++
;
max_index_i
[
i
]
=
temp
;
...
...
@@ -438,7 +440,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
max
(
pi
->
h
,
hj_max_raw
)
*
kernel_gamma
+
dx_max
-
rshift
;
/* Loop through particles in cell j until they are not in range of pi. */
/* Loop through particles in cell j until they are not in range of pi.
* Make sure that temp stays between 0 and cj->count - 1.*/
while
(
temp
<
cj
->
count
-
1
&&
first_di
>
sort_j
[
temp
].
d
)
temp
++
;
max_index_i
[
first_pi
]
=
temp
;
...
...
@@ -451,6 +454,7 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
const
float
di
=
sort_i
[
i
].
d
+
max
(
pi
->
h
,
hj_max_raw
)
*
kernel_gamma
+
dx_max
-
rshift
;
/* Make sure that temp stays between 0 and cj->count - 1.*/
while
(
temp
<
cj
->
count
-
1
&&
di
>
sort_j
[
temp
].
d
)
temp
++
;
max_index_i
[
i
]
=
temp
;
...
...
@@ -1092,7 +1096,9 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
exit_iteration_align
+=
pad
;
}
/* Loop over the parts in cj. */
/* Loop over the parts in cj. Making sure to perform an iteration of the
* loop even if exit_iteration_align is zero and there is only one
* particle to interact with.*/
for
(
int
pjd
=
0
;
pjd
<=
exit_iteration_align
;
pjd
+=
VEC_SIZE
)
{
/* Get the cache index to the jth particle. */
...
...
@@ -1473,7 +1479,9 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
exit_iteration_align
+=
pad
;
}
/* Loop over the parts in cj. */
/* Loop over the parts in cj. Making sure to perform an iteration of the
* loop even if exit_iteration_align is zero and there is only one
* particle to interact with.*/
for
(
int
pjd
=
0
;
pjd
<=
exit_iteration_align
;
pjd
+=
VEC_SIZE
)
{
/* Get the cache index to the jth particle. */
...
...
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