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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
fa153c4c
Commit
fa153c4c
authored
Nov 16, 2017
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Comments and formatting.
parent
4452cf5e
No related branches found
No related tags found
1 merge request
!456
Dopair vec mpi
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/runner_doiact_vec.c
+65
-56
65 additions, 56 deletions
src/runner_doiact_vec.c
with
65 additions
and
56 deletions
src/runner_doiact_vec.c
+
65
−
56
View file @
fa153c4c
...
@@ -273,6 +273,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
...
@@ -273,6 +273,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
int
first_pi
=
0
,
last_pj
=
cj
->
count
-
1
;
int
first_pi
=
0
,
last_pj
=
cj
->
count
-
1
;
int
temp
,
active_id
;
int
temp
,
active_id
;
/* Only populate max_index array for local actve cells. */
if
(
active_ci
)
{
if
(
active_ci
)
{
/* Find the leftmost active particle in cell i that interacts with any
/* Find the leftmost active particle in cell i that interacts with any
...
@@ -289,7 +290,8 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
...
@@ -289,7 +290,8 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
/* Set the first active pi in range of any particle in cell j. */
/* Set the first active pi in range of any particle in cell j. */
first_pi
=
active_id
;
first_pi
=
active_id
;
/* Find the maximum index into cell j for each particle in range in cell i. */
/* Find the maximum index into cell j for each particle in range in cell i.
*/
if
(
first_pi
<
ci
->
count
)
{
if
(
first_pi
<
ci
->
count
)
{
/* Start from the first particle in cell j. */
/* Start from the first particle in cell j. */
...
@@ -321,14 +323,15 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
...
@@ -321,14 +323,15 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
/* Make sure that max index is set to first particle in cj.*/
/* Make sure that max index is set to first particle in cj.*/
max_index_i
[
ci
->
count
-
1
]
=
0
;
max_index_i
[
ci
->
count
-
1
]
=
0
;
}
}
}
}
else
{
else
{
/* Make sure that foreign cells are only read into the cache if the local
/* Make sure that foreign cells are only read into the cache if the local
cell requires it.
*
cell requires it.
* Also ensure that it does not require any particles from cj. */
* Also ensure that it does not require any particles from cj. */
first_pi
=
ci
->
count
-
1
;
first_pi
=
ci
->
count
-
1
;
max_index_i
[
ci
->
count
-
1
]
=
0
;
max_index_i
[
ci
->
count
-
1
]
=
0
;
}
}
/* Only populate max_index array for local actve cells. */
if
(
active_cj
)
{
if
(
active_cj
)
{
/* Find the rightmost active particle in cell j that interacts with any
/* Find the rightmost active particle in cell j that interacts with any
* particle in cell i. */
* particle in cell i. */
...
@@ -345,7 +348,8 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
...
@@ -345,7 +348,8 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
/* Set the last active pj in range of any particle in cell i. */
/* Set the last active pj in range of any particle in cell i. */
last_pj
=
active_id
;
last_pj
=
active_id
;
/* Find the maximum index into cell i for each particle in range in cell j. */
/* Find the maximum index into cell i for each particle in range in cell j.
*/
if
(
last_pj
>=
0
)
{
if
(
last_pj
>=
0
)
{
/* Start from the last particle in cell i. */
/* Start from the last particle in cell i. */
...
@@ -374,9 +378,9 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
...
@@ -374,9 +378,9 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
/* Make sure that max index is set to last particle in ci.*/
/* Make sure that max index is set to last particle in ci.*/
max_index_j
[
0
]
=
ci
->
count
-
1
;
max_index_j
[
0
]
=
ci
->
count
-
1
;
}
}
}
}
else
{
else
{
/* Make sure that foreign cells are only read into the cache if the local
/* Make sure that foreign cells are only read into the cache if the local
cell requires it.
*
cell requires it.
* Also ensure that it does not require any particles from ci. */
* Also ensure that it does not require any particles from ci. */
last_pj
=
0
;
last_pj
=
0
;
max_index_j
[
0
]
=
ci
->
count
-
1
;
max_index_j
[
0
]
=
ci
->
count
-
1
;
...
@@ -414,14 +418,12 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
...
@@ -414,14 +418,12 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
* @param max_active_bin The largest time-bin active during this step.
* @param max_active_bin The largest time-bin active during this step.
*/
*/
__attribute__
((
always_inline
))
INLINE
static
void
__attribute__
((
always_inline
))
INLINE
static
void
populate_max_index_no_cache_force
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
populate_max_index_no_cache_force
(
const
struct
entry
*
restrict
sort_i
,
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
const
struct
entry
*
restrict
sort_j
,
const
struct
entry
*
restrict
sort_i
,
const
struct
entry
*
restrict
sort_j
,
const
float
dx_max
,
const
float
rshift
,
const
float
dx_max
,
const
float
rshift
,
const
double
hi_max_raw
,
const
double
hi_max_raw
,
const
double
hj_max_raw
,
const
double
hi_max
,
const
double
hj_max
,
const
double
hj_max_raw
,
const
double
hi_max
,
const
double
di_max
,
const
double
dj_min
,
int
*
max_index_i
,
const
double
hj_max
,
const
double
di_max
,
const
double
dj_min
,
int
*
max_index_i
,
int
*
max_index_j
,
int
*
init_pi
,
int
*
init_pj
,
int
*
max_index_j
,
int
*
init_pi
,
int
*
init_pj
,
const
timebin_t
max_active_bin
,
const
int
active_ci
,
const
int
active_cj
)
{
const
timebin_t
max_active_bin
,
const
int
active_ci
,
const
int
active_cj
)
{
...
@@ -431,6 +433,7 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
...
@@ -431,6 +433,7 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
int
first_pi
=
0
,
last_pj
=
cj
->
count
-
1
;
int
first_pi
=
0
,
last_pj
=
cj
->
count
-
1
;
int
temp
,
active_id
;
int
temp
,
active_id
;
/* Only populate max_index array for local actve cells. */
if
(
active_ci
)
{
if
(
active_ci
)
{
/* Find the leftmost active particle in cell i that interacts with any
/* Find the leftmost active particle in cell i that interacts with any
...
@@ -448,7 +451,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
...
@@ -448,7 +451,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
/* Set the first active pi in range of any particle in cell j. */
/* Set the first active pi in range of any particle in cell j. */
first_pi
=
active_id
;
first_pi
=
active_id
;
/* Find the maximum index into cell j for each particle in range in cell i. */
/* Find the maximum index into cell j for each particle in range in cell i.
*/
if
(
first_pi
<
ci
->
count
)
{
if
(
first_pi
<
ci
->
count
)
{
/* Start from the first particle in cell j. */
/* Start from the first particle in cell j. */
...
@@ -470,8 +474,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
...
@@ -470,8 +474,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
temp
=
max_index_i
[
i
-
1
];
temp
=
max_index_i
[
i
-
1
];
pi
=
&
parts_i
[
sort_i
[
i
].
i
];
pi
=
&
parts_i
[
sort_i
[
i
].
i
];
const
float
di
=
const
float
di
=
sort_i
[
i
].
d
+
max
(
pi
->
h
,
hj_max_raw
)
*
kernel_gamma
+
sort_i
[
i
].
d
+
max
(
pi
->
h
,
hj_max_raw
)
*
kernel_gamma
+
dx_max
-
rshift
;
dx_max
-
rshift
;
/* Make sure that temp stays between 0 and cj->count - 1.*/
/* Make sure that temp stays between 0 and cj->count - 1.*/
while
(
temp
<
cj
->
count
-
1
&&
di
>
sort_j
[
temp
].
d
)
temp
++
;
while
(
temp
<
cj
->
count
-
1
&&
di
>
sort_j
[
temp
].
d
)
temp
++
;
...
@@ -482,14 +486,15 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
...
@@ -482,14 +486,15 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
/* Make sure that max index is set to first particle in cj.*/
/* Make sure that max index is set to first particle in cj.*/
max_index_i
[
ci
->
count
-
1
]
=
0
;
max_index_i
[
ci
->
count
-
1
]
=
0
;
}
}
}
}
else
{
else
{
/* Make sure that foreign cells are only read into the cache if the local
/* Make sure that foreign cells are only read into the cache if the local
cell requires it.
*
cell requires it.
* Also ensure that it does not require any particles from cj. */
* Also ensure that it does not require any particles from cj. */
first_pi
=
ci
->
count
-
1
;
first_pi
=
ci
->
count
-
1
;
max_index_i
[
ci
->
count
-
1
]
=
0
;
max_index_i
[
ci
->
count
-
1
]
=
0
;
}
}
/* Only populate max_index array for local actve cells. */
if
(
active_cj
)
{
if
(
active_cj
)
{
/* Find the rightmost active particle in cell j that interacts with any
/* Find the rightmost active particle in cell j that interacts with any
* particle in cell i. */
* particle in cell i. */
...
@@ -506,7 +511,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
...
@@ -506,7 +511,8 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
/* Set the last active pj in range of any particle in cell i. */
/* Set the last active pj in range of any particle in cell i. */
last_pj
=
active_id
;
last_pj
=
active_id
;
/* Find the maximum index into cell i for each particle in range in cell j. */
/* Find the maximum index into cell i for each particle in range in cell j.
*/
if
(
last_pj
>=
0
)
{
if
(
last_pj
>=
0
)
{
/* Start from the last particle in cell i. */
/* Start from the last particle in cell i. */
...
@@ -537,9 +543,9 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
...
@@ -537,9 +543,9 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
/* Make sure that max index is set to last particle in ci.*/
/* Make sure that max index is set to last particle in ci.*/
max_index_j
[
0
]
=
ci
->
count
-
1
;
max_index_j
[
0
]
=
ci
->
count
-
1
;
}
}
}
}
else
{
else
{
/* Make sure that foreign cells are only read into the cache if the local
/* Make sure that foreign cells are only read into the cache if the local
cell requires it.
*
cell requires it.
* Also ensure that it does not require any particles from ci. */
* Also ensure that it does not require any particles from ci. */
last_pj
=
0
;
last_pj
=
0
;
max_index_j
[
0
]
=
ci
->
count
-
1
;
max_index_j
[
0
]
=
ci
->
count
-
1
;
...
@@ -1157,6 +1163,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
...
@@ -1157,6 +1163,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
TIMER_TIC
;
TIMER_TIC
;
/* Check whether cells are local to the node. */
#ifdef WITH_MPI
#ifdef WITH_MPI
const
int
ci_local
=
(
ci
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
ci_local
=
(
ci
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
cj_local
=
(
cj
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
cj_local
=
(
cj
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
...
@@ -1238,7 +1245,8 @@ const int cj_local = 1;
...
@@ -1238,7 +1245,8 @@ const int cj_local = 1;
* pj that interacts with any particle in ci. */
* pj that interacts with any particle in ci. */
populate_max_index_no_cache
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
hi_max
,
populate_max_index_no_cache
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
hi_max
,
hj_max
,
di_max
,
dj_min
,
max_index_i
,
max_index_j
,
hj_max
,
di_max
,
dj_min
,
max_index_i
,
max_index_j
,
&
first_pi
,
&
last_pj
,
max_active_bin
,
active_ci
,
active_cj
);
&
first_pi
,
&
last_pj
,
max_active_bin
,
active_ci
,
active_cj
);
/* Limits of the outer loops. */
/* Limits of the outer loops. */
int
first_pi_loop
=
first_pi
;
int
first_pi_loop
=
first_pi
;
...
@@ -1514,6 +1522,7 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
...
@@ -1514,6 +1522,7 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
TIMER_TIC
;
TIMER_TIC
;
/* Check whether cells are local to the node. */
#ifdef WITH_MPI
#ifdef WITH_MPI
const
int
ci_local
=
(
ci
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
ci_local
=
(
ci
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
cj_local
=
(
cj
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
const
int
cj_local
=
(
cj
->
nodeID
==
e
->
nodeID
)
?
1
:
0
;
...
@@ -1599,10 +1608,10 @@ const int cj_local = 1;
...
@@ -1599,10 +1608,10 @@ const int cj_local = 1;
/* Find particles maximum distance into cj, max_di[] and ci, max_dj[]. */
/* Find particles maximum distance into cj, max_di[] and ci, max_dj[]. */
/* Also find the first pi that interacts with any particle in cj and the last
/* Also find the first pi that interacts with any particle in cj and the last
* pj that interacts with any particle in ci. */
* pj that interacts with any particle in ci. */
populate_max_index_no_cache_force
(
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
populate_max_index_no_cache_force
(
hi_max_raw
,
hj_max_raw
,
hi_max
,
hj_max
,
ci
,
cj
,
sort_i
,
sort_j
,
dx_max
,
rshift
,
hi_max_raw
,
hj_max_raw
,
hi_max
,
di_max
,
dj_min
,
max_index_i
,
max_index_j
,
hj_max
,
di_max
,
dj_min
,
max_index_i
,
max_index_j
,
&
first_pi
,
&
last_pj
,
&
first_pi
,
&
last_pj
,
max_active_bin
,
active_ci
,
active_cj
);
max_active_bin
,
active_ci
,
active_cj
);
/* Limits of the outer loops. */
/* Limits of the outer loops. */
const
int
first_pi_loop
=
first_pi
;
const
int
first_pi_loop
=
first_pi
;
...
...
...
...
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
sign in
to comment