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
ecb48788
Commit
ecb48788
authored
8 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Pad reading of cache to multiples of the vector size.
parent
3529a060
No related branches found
No related tags found
1 merge request
!320
Dopair1 vectorisation merge
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cache.h
+18
-1
18 additions, 1 deletion
src/cache.h
with
18 additions
and
1 deletion
src/cache.h
+
18
−
1
View file @
ecb48788
...
...
@@ -379,11 +379,28 @@ __attribute__((always_inline)) INLINE void cache_read_two_cells_sorted(
}
__attribute__
((
always_inline
))
INLINE
void
cache_read_two_cells_sorted_2
(
const
struct
cell
*
const
ci
,
const
struct
cell
*
const
cj
,
struct
cache
*
const
ci_cache
,
struct
cache
*
const
cj_cache
,
const
struct
entry
*
restrict
sort_i
,
const
struct
entry
*
restrict
sort_j
,
const
double
*
const
shift
,
const
int
first_pi
,
const
int
last_pj
)
{
const
struct
cell
*
const
ci
,
const
struct
cell
*
const
cj
,
struct
cache
*
const
ci_cache
,
struct
cache
*
const
cj_cache
,
const
struct
entry
*
restrict
sort_i
,
const
struct
entry
*
restrict
sort_j
,
const
double
*
const
shift
,
int
first_pi
,
int
last_pj
,
const
int
num_vec_proc
)
{
int
idx
;
/* Shift the particles positions to a local frame (ci frame) so single precision can be
* used instead of double precision. Also shift the cell ci, particles positions due to BCs but leave cell cj. */
/* Pad number of particles read to the vector size. */
int
rem
=
(
ci
->
count
-
first_pi
)
%
(
num_vec_proc
*
VEC_SIZE
);
if
(
rem
!=
0
)
{
int
pad
=
(
num_vec_proc
*
VEC_SIZE
)
-
rem
;
if
(
first_pi
-
pad
>=
0
)
first_pi
-=
pad
;
}
rem
=
last_pj
%
(
num_vec_proc
*
VEC_SIZE
);
if
(
rem
!=
0
)
{
int
pad
=
(
num_vec_proc
*
VEC_SIZE
)
-
rem
;
if
(
last_pj
+
pad
<
cj
->
count
)
last_pj
+=
pad
;
}
#ifdef WITH_VECTORIZATION
#pragma simd
#endif
...
...
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