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
c8eaa44f
Commit
c8eaa44f
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added treatment of timers in the gravity interaction functions.
parent
50468e07
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!212
Gravity infrastructure
,
!172
[WIP] Self gravity (Barnes-Hut version)
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/runner.c
+3
-3
3 additions, 3 deletions
src/runner.c
src/runner_doiact_grav.h
+28
-10
28 additions, 10 deletions
src/runner_doiact_grav.h
src/timers.h
+3
-2
3 additions, 2 deletions
src/timers.h
with
34 additions
and
15 deletions
src/runner.c
+
3
−
3
View file @
c8eaa44f
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
/* Orientation of the cell pairs */
/* Orientation of the cell pairs */
const
double
runner_shift
[
13
][
3
]
=
{
const
double
runner_shift
[
13
][
3
]
=
{
{
5.773502691896258e-01
,
5.773502691896258e-01
,
5.773502691896258e-01
},
{
5.773502691896258e-01
,
5.773502691896258e-01
,
5.773502691896258e-01
},
{
7.0
7
1067811865475e-01
,
7.071067811865475e-01
,
0
.
0
},
{
7.01067811865475e-01
,
7.071067811865475e-01
,
0
.
0
},
{
5.773502691896258e-01
,
5.773502691896258e-01
,
-
5.773502691896258e-01
},
{
5.773502691896258e-01
,
5.773502691896258e-01
,
-
5.773502691896258e-01
},
{
7.071067811865475e-01
,
0
.
0
,
7.071067811865475e-01
},
{
7.071067811865475e-01
,
0
.
0
,
7.071067811865475e-01
},
{
1
.
0
,
0
.
0
,
0
.
0
},
{
1
.
0
,
0
.
0
,
0
.
0
},
...
@@ -1063,7 +1063,7 @@ void *runner_main(void *data) {
...
@@ -1063,7 +1063,7 @@ void *runner_main(void *data) {
else
if
(
t
->
subtype
==
task_subtype_force
)
else
if
(
t
->
subtype
==
task_subtype_force
)
runner_doself2_force
(
r
,
ci
);
runner_doself2_force
(
r
,
ci
);
else
if
(
t
->
subtype
==
task_subtype_grav
)
else
if
(
t
->
subtype
==
task_subtype_grav
)
runner_doself_grav
(
r
,
ci
);
runner_doself_grav
(
r
,
ci
,
1
);
else
else
error
(
"Unknown task subtype."
);
error
(
"Unknown task subtype."
);
break
;
break
;
...
@@ -1073,7 +1073,7 @@ void *runner_main(void *data) {
...
@@ -1073,7 +1073,7 @@ void *runner_main(void *data) {
else
if
(
t
->
subtype
==
task_subtype_force
)
else
if
(
t
->
subtype
==
task_subtype_force
)
runner_dopair2_force
(
r
,
ci
,
cj
);
runner_dopair2_force
(
r
,
ci
,
cj
);
else
if
(
t
->
subtype
==
task_subtype_grav
)
else
if
(
t
->
subtype
==
task_subtype_grav
)
runner_dopair_grav
(
r
,
ci
,
cj
);
runner_dopair_grav
(
r
,
ci
,
cj
,
1
);
else
else
error
(
"Unknown task subtype."
);
error
(
"Unknown task subtype."
);
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
src/runner_doiact_grav.h
+
28
−
10
View file @
c8eaa44f
...
@@ -117,7 +117,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm(
...
@@ -117,7 +117,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pm(
runner_iact_grav_pm
(
rlr_inv
,
r2
,
dx
,
gp
,
&
multi
);
runner_iact_grav_pm
(
rlr_inv
,
r2
,
dx
,
gp
,
&
multi
);
}
}
TIMER_TOC
(
TIMER_DOPAIR
);
// MATTHIEU
TIMER_TOC
(
timer_dopair_grav_pm
);
}
}
/**
/**
...
@@ -215,7 +215,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
...
@@ -215,7 +215,7 @@ __attribute__((always_inline)) INLINE static void runner_dopair_grav_pp(
}
}
}
}
TIMER_TOC
(
TIMER_DOPAIR
);
// MATTHIEU
TIMER_TOC
(
timer_dopair_grav_pp
);
}
}
/**
/**
...
@@ -298,7 +298,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
...
@@ -298,7 +298,7 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
}
}
}
}
TIMER_TOC
(
TIMER_DOSELF
);
// MATTHIEU
TIMER_TOC
(
timer_doself_grav_pp
);
}
}
/**
/**
...
@@ -308,11 +308,12 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
...
@@ -308,11 +308,12 @@ __attribute__((always_inline)) INLINE static void runner_doself_grav_pp(
* @param r The #runner.
* @param r The #runner.
* @param ci The first #cell.
* @param ci The first #cell.
* @param cj The other #cell.
* @param cj The other #cell.
* @param gettimer Are we timing this ?
*
*
* @todo Use a local cache for the particles.
* @todo Use a local cache for the particles.
*/
*/
static
void
runner_dopair_grav
(
struct
runner
*
r
,
struct
cell
*
ci
,
static
void
runner_dopair_grav
(
struct
runner
*
r
,
struct
cell
*
ci
,
struct
cell
*
cj
)
{
struct
cell
*
cj
,
int
gettimer
)
{
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
...
@@ -366,6 +367,8 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
...
@@ -366,6 +367,8 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
}
}
#endif
#endif
TIMER_TIC
;
/* Are both cells split ? */
/* Are both cells split ? */
if
(
ci
->
split
&&
cj
->
split
)
{
if
(
ci
->
split
&&
cj
->
split
)
{
...
@@ -378,7 +381,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
...
@@ -378,7 +381,7 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
if
(
cell_are_neighbours
(
ci
->
progeny
[
j
],
cj
->
progeny
[
k
]))
{
if
(
cell_are_neighbours
(
ci
->
progeny
[
j
],
cj
->
progeny
[
k
]))
{
/* Recurse */
/* Recurse */
runner_dopair_grav
(
r
,
ci
->
progeny
[
j
],
cj
->
progeny
[
k
]);
runner_dopair_grav
(
r
,
ci
->
progeny
[
j
],
cj
->
progeny
[
k
]
,
0
);
}
else
{
}
else
{
...
@@ -395,9 +398,20 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
...
@@ -395,9 +398,20 @@ static void runner_dopair_grav(struct runner *r, struct cell *ci,
/* Compute the interactions at this level directly. */
/* Compute the interactions at this level directly. */
runner_dopair_grav_pp
(
r
,
ci
,
cj
);
runner_dopair_grav_pp
(
r
,
ci
,
cj
);
}
}
if
(
gettimer
)
TIMER_TOC
(
timer_dosub_pair_grav
);
}
}
static
void
runner_doself_grav
(
struct
runner
*
r
,
struct
cell
*
c
)
{
/**
* @brief Computes the interaction of all the particles in a cell
*
* @param r The #runner.
* @param c The first #cell.
* @param gettimer Are we timing this ?
*
* @todo Use a local cache for the particles.
*/
static
void
runner_doself_grav
(
struct
runner
*
r
,
struct
cell
*
c
,
int
gettimer
)
{
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
...
@@ -405,6 +419,8 @@ static void runner_doself_grav(struct runner *r, struct cell *c) {
...
@@ -405,6 +419,8 @@ static void runner_doself_grav(struct runner *r, struct cell *c) {
if
(
c
->
gcount
==
0
)
error
(
"Empty cell !"
);
if
(
c
->
gcount
==
0
)
error
(
"Empty cell !"
);
#endif
#endif
TIMER_TIC
;
/* If the cell is split, interact each progeny with itself, and with
/* If the cell is split, interact each progeny with itself, and with
each of its siblings. */
each of its siblings. */
if
(
c
->
split
)
{
if
(
c
->
split
)
{
...
@@ -412,12 +428,12 @@ static void runner_doself_grav(struct runner *r, struct cell *c) {
...
@@ -412,12 +428,12 @@ static void runner_doself_grav(struct runner *r, struct cell *c) {
for
(
int
j
=
0
;
j
<
8
;
j
++
)
{
for
(
int
j
=
0
;
j
<
8
;
j
++
)
{
if
(
c
->
progeny
[
j
]
!=
NULL
)
{
if
(
c
->
progeny
[
j
]
!=
NULL
)
{
runner_doself_grav
(
r
,
c
->
progeny
[
j
]);
runner_doself_grav
(
r
,
c
->
progeny
[
j
]
,
0
);
for
(
int
k
=
j
+
1
;
k
<
8
;
k
++
)
{
for
(
int
k
=
j
+
1
;
k
<
8
;
k
++
)
{
if
(
c
->
progeny
[
k
]
!=
NULL
)
{
if
(
c
->
progeny
[
k
]
!=
NULL
)
{
runner_dopair_grav
(
r
,
c
->
progeny
[
j
],
c
->
progeny
[
k
]);
runner_dopair_grav
(
r
,
c
->
progeny
[
j
],
c
->
progeny
[
k
]
,
0
);
}
}
}
}
}
}
...
@@ -429,6 +445,8 @@ static void runner_doself_grav(struct runner *r, struct cell *c) {
...
@@ -429,6 +445,8 @@ static void runner_doself_grav(struct runner *r, struct cell *c) {
runner_doself_grav_pp
(
r
,
c
);
runner_doself_grav_pp
(
r
,
c
);
}
}
if
(
gettimer
)
TIMER_TOC
(
timer_dosub_self_grav
);
}
}
static
void
runner_dosub_grav
(
struct
runner
*
r
,
struct
cell
*
ci
,
static
void
runner_dosub_grav
(
struct
runner
*
r
,
struct
cell
*
ci
,
...
@@ -437,7 +455,7 @@ static void runner_dosub_grav(struct runner *r, struct cell *ci,
...
@@ -437,7 +455,7 @@ static void runner_dosub_grav(struct runner *r, struct cell *ci,
/* Is this a single cell? */
/* Is this a single cell? */
if
(
cj
==
NULL
)
{
if
(
cj
==
NULL
)
{
runner_doself_grav
(
r
,
ci
);
runner_doself_grav
(
r
,
ci
,
1
);
}
else
{
}
else
{
...
@@ -446,7 +464,7 @@ static void runner_dosub_grav(struct runner *r, struct cell *ci,
...
@@ -446,7 +464,7 @@ static void runner_dosub_grav(struct runner *r, struct cell *ci,
error
(
"Non-neighbouring cells in pair task !"
);
error
(
"Non-neighbouring cells in pair task !"
);
#endif
#endif
runner_dopair_grav
(
r
,
ci
,
cj
);
runner_dopair_grav
(
r
,
ci
,
cj
,
1
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/timers.h
+
3
−
2
View file @
c8eaa44f
...
@@ -37,10 +37,11 @@ enum {
...
@@ -37,10 +37,11 @@ enum {
timer_dosort
,
timer_dosort
,
timer_doself_density
,
timer_doself_density
,
timer_doself_force
,
timer_doself_force
,
timer_doself_grav
,
timer_doself_grav
_pp
,
timer_dopair_density
,
timer_dopair_density
,
timer_dopair_force
,
timer_dopair_force
,
timer_dopair_grav
,
timer_dopair_grav_pm
,
timer_dopair_grav_pp
,
timer_dograv_external
,
timer_dograv_external
,
timer_dosub_self_density
,
timer_dosub_self_density
,
timer_dosub_self_force
,
timer_dosub_self_force
,
...
...
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