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
08a7e2fd
Commit
08a7e2fd
authored
8 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Added max_di and max_dj arrays to the cache.
parent
f40c4d49
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!320
Dopair1 vectorisation merge
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cache.h
+11
-33
11 additions, 33 deletions
src/cache.h
src/runner_doiact_vec.c
+30
-4
30 additions, 4 deletions
src/runner_doiact_vec.c
with
41 additions
and
37 deletions
src/cache.h
+
11
−
33
View file @
08a7e2fd
...
...
@@ -84,35 +84,17 @@ struct cache {
/* Particle z velocity. */
float
*
restrict
vz
__attribute__
((
aligned
(
CACHE_ALIGN
)));
/* Maximum distance of pi particles into cj. */
float
*
restrict
max_di
__attribute__
((
aligned
(
CACHE_ALIGN
)));
/* Maximum distance of pj particles into ci. */
float
*
restrict
max_dj
__attribute__
((
aligned
(
CACHE_ALIGN
)));
/* Cache size. */
int
count
;
#endif
/* Particle x position. */
//float *restrict rho __attribute__((aligned(sizeof(float) * VEC_SIZE)));
///* Particle y position. */
//float *restrict rho_dh __attribute__((aligned(sizeof(float) * VEC_SIZE)));
///* Particle z position. */
//float *restrict wcount __attribute__((aligned(sizeof(float) * VEC_SIZE)));
///* Particle smoothing length. */
//float *restrict wcount_dh __attribute__((aligned(sizeof(float) * VEC_SIZE)));
///* Particle mass. */
//float *restrict div_v __attribute__((aligned(sizeof(float) * VEC_SIZE)));
///* Particle x velocity. */
//float *restrict curl_vx __attribute__((aligned(sizeof(float) * VEC_SIZE)));
///* Particle y velocity. */
//float *restrict curl_vy __attribute__((aligned(sizeof(float) * VEC_SIZE)));
///* Particle z velocity. */
//float *restrict curl_vz __attribute__((aligned(sizeof(float) * VEC_SIZE)));
};
#ifdef DOPAIR1_AUTO_VEC
...
...
@@ -175,6 +157,8 @@ __attribute__((always_inline)) INLINE void cache_init(struct cache *c,
free
(
c
->
vy
);
free
(
c
->
vz
);
free
(
c
->
h
);
free
(
c
->
max_di
);
free
(
c
->
max_dj
);
}
error
+=
posix_memalign
((
void
**
)
&
c
->
x
,
alignment
,
sizeBytes
);
...
...
@@ -185,15 +169,9 @@ __attribute__((always_inline)) INLINE void cache_init(struct cache *c,
error
+=
posix_memalign
((
void
**
)
&
c
->
vy
,
alignment
,
sizeBytes
);
error
+=
posix_memalign
((
void
**
)
&
c
->
vz
,
alignment
,
sizeBytes
);
error
+=
posix_memalign
((
void
**
)
&
c
->
h
,
alignment
,
sizeBytes
);
//error += posix_memalign((void **)&c->rho, alignment, sizeBytes);
//error += posix_memalign((void **)&c->rho_dh, alignment, sizeBytes);
//error += posix_memalign((void **)&c->wcount, alignment, sizeBytes);
//error += posix_memalign((void **)&c->wcount_dh, alignment, sizeBytes);
//error += posix_memalign((void **)&c->div_v, alignment, sizeBytes);
//error += posix_memalign((void **)&c->curl_vx, alignment, sizeBytes);
//error += posix_memalign((void **)&c->curl_vy, alignment, sizeBytes);
//error += posix_memalign((void **)&c->curl_vz, alignment, sizeBytes);
error
+=
posix_memalign
((
void
**
)
&
c
->
max_di
,
alignment
,
sizeBytes
);
error
+=
posix_memalign
((
void
**
)
&
c
->
max_dj
,
alignment
,
sizeBytes
);
if
(
error
!=
0
)
error
(
"Couldn't allocate cache, no. of particles: %d"
,
(
int
)
count
);
c
->
count
=
count
;
...
...
This diff is collapsed.
Click to expand it.
src/runner_doiact_vec.c
+
30
−
4
View file @
08a7e2fd
...
...
@@ -972,9 +972,6 @@ __attribute__((always_inline)) INLINE void runner_doself1_density_vec_2(
#endif
/* WITH_VECTORIZATION */
}
float
max_di
[
MAX_NO_OF_PARTS
]
__attribute__
((
aligned
(
sizeof
(
VEC_SIZE
*
sizeof
(
float
)))));
/* max distance into ci */
float
max_dj
[
MAX_NO_OF_PARTS
]
__attribute__
((
aligned
(
sizeof
(
VEC_SIZE
*
sizeof
(
float
)))));
/* max distance into cj */
void
runner_dopair1_density_vec
(
struct
runner
*
r
,
struct
cell
*
ci
,
struct
cell
*
cj
)
{
#ifdef WITH_VECTORIZATION
...
...
@@ -1029,7 +1026,12 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci, struct cell *
}
int
first_pi
,
last_pj
;
float
*
max_di
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
float
*
max_dj
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
max_di
=
r
->
par_cache
.
max_di
;
max_dj
=
r
->
par_cache
.
max_dj
;
/* Find particles maximum distance into cj, max_di[] and ci, max_dj[]. */
/* For particles in ci */
populate_max_d_no_cache
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
max_di
,
max_dj
,
&
first_pi
,
&
last_pj
);
...
...
@@ -1409,6 +1411,12 @@ void runner_dopair1_density_vec_1(struct runner *r, struct cell *ci, struct cell
cache_read_two_cells_sorted
(
ci
,
cj
,
ci_cache
,
&
cj_cache
,
sort_i
,
sort_j
,
shift
);
float
*
max_di
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
float
*
max_dj
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
max_di
=
r
->
par_cache
.
max_di
;
max_dj
=
r
->
par_cache
.
max_dj
;
/* Find particles maximum distance into cj, max_di[] and ci, max_dj[]. */
/* For particles in ci */
populate_max_d
(
ci
,
cj
,
sort_i
,
sort_j
,
ci_cache
,
&
cj_cache
,
dx_max
,
rshift
,
max_di
,
max_dj
);
...
...
@@ -1833,6 +1841,12 @@ void runner_dopair1_density_vec_2(struct runner *r, struct cell *ci, struct cell
cache_init
(
&
cj_cache
,
count_j
);
}
float
*
max_di
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
float
*
max_dj
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
max_di
=
r
->
par_cache
.
max_di
;
max_dj
=
r
->
par_cache
.
max_dj
;
int
first_pi
,
last_pj
;
/* Find particles maximum distance into cj, max_di[] and ci, max_dj[]. */
/* For particles in ci */
...
...
@@ -2401,6 +2415,12 @@ void runner_dopair1_density_vec_3(struct runner *r, struct cell *ci, struct cell
cache_read_two_cells
(
ci
,
cj
,
ci_cache
,
&
cj_cache
,
shift
);
//cache_read_two_cells_sorted(ci, cj, ci_cache, &cj_cache, sort_i, sort_j, shift);
float
*
max_di
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
float
*
max_dj
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
max_di
=
r
->
par_cache
.
max_di
;
max_dj
=
r
->
par_cache
.
max_dj
;
/* Find particles maximum distance into cj, max_di[] and ci, max_dj[]. */
/* For particles in ci */
populate_max_d
(
ci
,
cj
,
sort_i
,
sort_j
,
ci_cache
,
&
cj_cache
,
dx_max
,
rshift
,
max_di
,
max_dj
);
...
...
@@ -2898,6 +2918,12 @@ void runner_dopair1_density_vec_4(struct runner *r, struct cell *ci, struct cell
cache_read_cell_sorted
(
cj
,
ci_cache
,
sort_j
,
loc
,
shift_cj
);
float
*
max_di
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
float
*
max_dj
__attribute__
((
aligned
(
sizeof
(
float
)
*
VEC_SIZE
)));
max_di
=
r
->
par_cache
.
max_di
;
max_dj
=
r
->
par_cache
.
max_dj
;
/* Find particles maximum distance into cj, max_di[] and ci, max_dj[]. */
/* For particles in ci */
float
h
=
parts_i
[
sort_i
[
0
].
i
].
h
;
...
...
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