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
bc72b5d2
Commit
bc72b5d2
authored
Mar 21, 2020
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Solve the dining philosopher problem in the locking of the cells' multipoles
parent
c0768afa
No related branches found
No related tags found
1 merge request
!1048
Atomic gravity and time-step limiter
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/runner_doiact_grav.c
+21
-9
21 additions, 9 deletions
src/runner_doiact_grav.c
with
21 additions
and
9 deletions
src/runner_doiact_grav.c
+
21
−
9
View file @
bc72b5d2
...
...
@@ -1357,9 +1357,15 @@ static INLINE void runner_dopair_grav_mm_symmetric(struct runner *r,
cj
->
grav
.
ti_old_multipole
,
cj
->
nodeID
,
ci
->
nodeID
,
e
->
ti_current
);
#endif
/* Lock the multipoles */
/* Lock the multipoles
* Note we impose a hierarchy to solve the dining philosopher problem */
if
(
ci
<
cj
)
{
lock_lock
(
&
ci
->
grav
.
mlock
);
lock_lock
(
&
cj
->
grav
.
mlock
);
}
else
{
lock_lock
(
&
cj
->
grav
.
mlock
);
lock_lock
(
&
ci
->
grav
.
mlock
);
}
/* Let's interact at this level */
gravity_M2L_symmetric
(
&
ci
->
grav
.
multipole
->
pot
,
&
cj
->
grav
.
multipole
->
pot
,
...
...
@@ -1381,8 +1387,8 @@ static INLINE void runner_dopair_grav_mm_symmetric(struct runner *r,
* @param ci The #cell with field tensor to interact.
* @param cj The #cell with the multipole.
*/
static
INLINE
void
runner_dopair_grav_mm_nonsym
(
struct
runner
*
r
,
struct
cell
*
restrict
ci
,
static
INLINE
void
runner_dopair_grav_mm_nonsym
(
struct
runner
*
r
,
struct
cell
*
restrict
ci
,
struct
cell
*
restrict
cj
)
{
/* Some constants */
...
...
@@ -1416,9 +1422,15 @@ static INLINE void runner_dopair_grav_mm_nonsym(
cj
->
grav
.
ti_old_multipole
,
cj
->
nodeID
,
ci
->
nodeID
,
e
->
ti_current
);
#endif
/* Lock the multipoles */
/* Lock the multipoles
* Note we impose a hierarchy to solve the dining philosopher problem */
if
(
ci
<
cj
)
{
lock_lock
(
&
ci
->
grav
.
mlock
);
lock_lock
(
&
cj
->
grav
.
mlock
);
}
else
{
lock_lock
(
&
cj
->
grav
.
mlock
);
lock_lock
(
&
ci
->
grav
.
mlock
);
}
/* Let's interact at this level */
gravity_M2L_nonsym
(
&
ci
->
grav
.
multipole
->
pot
,
multi_j
,
ci
->
grav
.
multipole
->
CoM
,
...
...
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