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
ac2448b1
Commit
ac2448b1
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Apply the same change to the max operation taking place in the timestep limiter task
parent
449346aa
No related branches found
No related tags found
1 merge request
!1048
Atomic gravity and time-step limiter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/accumulate.h
+61
-0
61 additions, 0 deletions
src/accumulate.h
src/timestep_limiter_iact.h
+2
-6
2 additions, 6 deletions
src/timestep_limiter_iact.h
with
63 additions
and
6 deletions
src/accumulate.h
+
61
−
0
View file @
ac2448b1
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
/* Local includes */
/* Local includes */
#include
"atomic.h"
#include
"atomic.h"
#include
"minmax.h"
/**
/**
* @file accumulate.h
* @file accumulate.h
...
@@ -144,4 +145,64 @@ __attribute__((always_inline)) INLINE static void accumulate_inc_ll(
...
@@ -144,4 +145,64 @@ __attribute__((always_inline)) INLINE static void accumulate_inc_ll(
#endif
#endif
}
}
/**
* @brief Compute the max of x and the value storedd at the location address
* and store the value at the address (int8_t version).
*
* When SWIFT_TASKS_WITHOUT_ATOMICS is *not* defined this function uses an
* atomic operation.
*
* @param address The address to update.
* @param x The value to max against *address.
*/
__attribute__
((
always_inline
))
INLINE
static
void
accumulate_max_c
(
volatile
int8_t
*
const
address
,
const
int8_t
x
)
{
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
*
address
=
max
(
*
address
,
x
);
#else
atomic_max_c
(
address
,
x
);
#endif
}
/**
* @brief Compute the max of x and the value storedd at the location address
* and store the value at the address (int version).
*
* When SWIFT_TASKS_WITHOUT_ATOMICS is *not* defined this function uses an
* atomic operation.
*
* @param address The address to update.
* @param x The value to max against *address.
*/
__attribute__
((
always_inline
))
INLINE
static
void
accumulate_max_i
(
volatile
int
*
const
address
,
const
int
x
)
{
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
*
address
=
max
(
*
address
,
x
);
#else
atomic_max
(
address
,
x
);
#endif
}
/**
* @brief Compute the max of x and the value storedd at the location address
* and store the value at the address (float version).
*
* When SWIFT_TASKS_WITHOUT_ATOMICS is *not* defined this function uses an
* atomic operation.
*
* @param address The address to update.
* @param x The value to max against *address.
*/
__attribute__
((
always_inline
))
INLINE
static
void
accumulate_max_f
(
volatile
float
*
const
address
,
const
float
x
)
{
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
*
address
=
max
(
*
address
,
x
);
#else
atomic_max_f
(
address
,
x
);
#endif
}
#endif
/* SWIFT_ACCUMULATE_H */
#endif
/* SWIFT_ACCUMULATE_H */
This diff is collapsed.
Click to expand it.
src/timestep_limiter_iact.h
+
2
−
6
View file @
ac2448b1
...
@@ -87,12 +87,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
...
@@ -87,12 +87,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
/* Wake up the neighbour? */
/* Wake up the neighbour? */
if
(
pj
->
time_bin
>
pi
->
time_bin
+
time_bin_neighbour_max_delta_bin
)
{
if
(
pj
->
time_bin
>
pi
->
time_bin
+
time_bin_neighbour_max_delta_bin
)
{
/* Store the smallest time bin that woke up this particle */
/* Store the smallest time bin that woke up this particle */
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
accumulate_max_c
(
&
pj
->
limiter_data
.
wakeup
,
-
pi
->
time_bin
);
pj
->
limiter_data
.
wakeup
=
max
(
pj
->
limiter_data
.
wakeup
,
-
pi
->
time_bin
);
#else
atomic_max_c
(
&
pj
->
limiter_data
.
wakeup
,
-
pi
->
time_bin
);
#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