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
80ed67ec
Commit
80ed67ec
authored
Aug 10, 2017
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Code formatting
parent
b9293cf9
No related branches found
No related tags found
1 merge request
!398
Use particle caches for the gravity P-P interactions. Ewald summation for the gravity force checks
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/align.h
+8
-7
8 additions, 7 deletions
src/align.h
src/gravity/Default/gravity_iact.h
+0
-1
0 additions, 1 deletion
src/gravity/Default/gravity_iact.h
src/runner.h
+1
-1
1 addition, 1 deletion
src/runner.h
src/runner_doiact_grav.h
+179
-184
179 additions, 184 deletions
src/runner_doiact_grav.h
with
188 additions
and
193 deletions
src/align.h
+
8
−
7
View file @
80ed67ec
...
@@ -40,7 +40,8 @@
...
@@ -40,7 +40,8 @@
#define SWIFT_CACHE_ALIGN __attribute__((aligned(SWIFT_CACHE_ALIGNMENT)))
#define SWIFT_CACHE_ALIGN __attribute__((aligned(SWIFT_CACHE_ALIGNMENT)))
/**
/**
* @brief Macro to tell the compiler that a given array has the specified alignment.
* @brief Macro to tell the compiler that a given array has the specified
* alignment.
*
*
* Note that this turns into a no-op but gives information to the compiler.
* Note that this turns into a no-op but gives information to the compiler.
*
*
...
@@ -56,7 +57,8 @@
...
@@ -56,7 +57,8 @@
#endif
#endif
/**
/**
* @brief Macro to tell the compiler that a given number is 0 modulo a given size.
* @brief Macro to tell the compiler that a given number is 0 modulo a given
* size.
*
*
* Note that this turns into a no-op but gives information to the compiler.
* Note that this turns into a no-op but gives information to the compiler.
* GCC does not have the equivalent built-in so defaults to nothing.
* GCC does not have the equivalent built-in so defaults to nothing.
...
@@ -65,8 +67,7 @@
...
@@ -65,8 +67,7 @@
* @param size The modulo of interest.
* @param size The modulo of interest.
*/
*/
#if defined(__ICC)
#if defined(__ICC)
#define swift_assume_size(var, size) \
#define swift_assume_size(var, size) __assume(var % size == 0);
__assume(var % size == 0);
#else
#else
#define swift_assume_size(var, size) ;
#define swift_assume_size(var, size) ;
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
src/gravity/Default/gravity_iact.h
+
0
−
1
View file @
80ed67ec
...
@@ -249,5 +249,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pp_nonsym(
...
@@ -249,5 +249,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pp_nonsym(
gpi
->
a_grav
[
2
]
-=
fdx
[
2
];
gpi
->
a_grav
[
2
]
-=
fdx
[
2
];
}
}
#endif
/* SWIFT_DEFAULT_GRAVITY_IACT_H */
#endif
/* SWIFT_DEFAULT_GRAVITY_IACT_H */
This diff is collapsed.
Click to expand it.
src/runner.h
+
1
−
1
View file @
80ed67ec
...
@@ -27,8 +27,8 @@
...
@@ -27,8 +27,8 @@
#include
"../config.h"
#include
"../config.h"
/* Includes. */
/* Includes. */
#include
"gravity_cache.h"
#include
"cache.h"
#include
"cache.h"
#include
"gravity_cache.h"
struct
cell
;
struct
cell
;
struct
engine
;
struct
engine
;
...
...
This diff is collapsed.
Click to expand it.
src/runner_doiact_grav.h
+
179
−
184
View file @
80ed67ec
...
@@ -180,16 +180,18 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
...
@@ -180,16 +180,18 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
/* Check that we fit in cache */
/* Check that we fit in cache */
if
(
gcount_i
>
ci_cache
->
count
||
gcount_j
>
cj_cache
->
count
)
if
(
gcount_i
>
ci_cache
->
count
||
gcount_j
>
cj_cache
->
count
)
error
(
"Not enough space in the caches! gcount_i=%d gcount_j=%d"
,
error
(
"Not enough space in the caches! gcount_i=%d gcount_j=%d"
,
gcount_i
,
gcount_i
,
gcount_j
);
gcount_j
);
/* Computed the padded counts */
/* Computed the padded counts */
const
int
gcount_padded_i
=
gcount_i
-
(
gcount_i
%
VEC_SIZE
)
+
VEC_SIZE
;
const
int
gcount_padded_i
=
gcount_i
-
(
gcount_i
%
VEC_SIZE
)
+
VEC_SIZE
;
const
int
gcount_padded_j
=
gcount_j
-
(
gcount_j
%
VEC_SIZE
)
+
VEC_SIZE
;
const
int
gcount_padded_j
=
gcount_j
-
(
gcount_j
%
VEC_SIZE
)
+
VEC_SIZE
;
/* Fill the caches */
/* Fill the caches */
gravity_cache_populate
(
ci_cache
,
gparts_i
,
gcount_i
,
gcount_padded_i
,
ci_active
,
shift
);
gravity_cache_populate
(
ci_cache
,
gparts_i
,
gcount_i
,
gcount_padded_i
,
gravity_cache_populate_no_shift
(
cj_cache
,
gparts_j
,
gcount_j
,
gcount_padded_j
,
cj_active
);
ci_active
,
shift
);
gravity_cache_populate_no_shift
(
cj_cache
,
gparts_j
,
gcount_j
,
gcount_padded_j
,
cj_active
);
/* Ok... Here we go ! */
/* Ok... Here we go ! */
...
@@ -272,7 +274,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
...
@@ -272,7 +274,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
gparts_i
[
pid
].
num_interacted
++
;
gparts_i
[
pid
].
num_interacted
++
;
#endif
#endif
}
}
/* Store everything back in cache */
/* Store everything back in cache */
...
@@ -362,7 +363,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
...
@@ -362,7 +363,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
gparts_j
[
pjd
].
num_interacted
++
;
gparts_j
[
pjd
].
num_interacted
++
;
#endif
#endif
}
}
/* Store everything back in cache */
/* Store everything back in cache */
...
@@ -373,10 +373,8 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
...
@@ -373,10 +373,8 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
}
}
/* Write back to the particles */
/* Write back to the particles */
if
(
ci_active
)
if
(
ci_active
)
gravity_cache_write_back
(
ci_cache
,
gparts_i
,
gcount_i
);
gravity_cache_write_back
(
ci_cache
,
gparts_i
,
gcount_i
);
if
(
cj_active
)
gravity_cache_write_back
(
cj_cache
,
gparts_j
,
gcount_j
);
if
(
cj_active
)
gravity_cache_write_back
(
cj_cache
,
gparts_j
,
gcount_j
);
#ifdef MATTHIEU_OLD_STUFF
#ifdef MATTHIEU_OLD_STUFF
...
@@ -492,7 +490,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
...
@@ -492,7 +490,6 @@ void runner_dopair_grav_pp_full(struct runner *r, struct cell *ci,
void
runner_dopair_grav_pp_truncated
(
struct
runner
*
r
,
struct
cell
*
ci
,
void
runner_dopair_grav_pp_truncated
(
struct
runner
*
r
,
struct
cell
*
ci
,
struct
cell
*
cj
,
double
shift
[
3
])
{
struct
cell
*
cj
,
double
shift
[
3
])
{
/* Some constants */
/* Some constants */
const
struct
engine
*
const
e
=
r
->
e
;
const
struct
engine
*
const
e
=
r
->
e
;
const
struct
space
*
s
=
e
->
s
;
const
struct
space
*
s
=
e
->
s
;
...
@@ -518,16 +515,18 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
...
@@ -518,16 +515,18 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
/* Check that we fit in cache */
/* Check that we fit in cache */
if
(
gcount_i
>
ci_cache
->
count
||
gcount_j
>
cj_cache
->
count
)
if
(
gcount_i
>
ci_cache
->
count
||
gcount_j
>
cj_cache
->
count
)
error
(
"Not enough space in the caches! gcount_i=%d gcount_j=%d"
,
error
(
"Not enough space in the caches! gcount_i=%d gcount_j=%d"
,
gcount_i
,
gcount_i
,
gcount_j
);
gcount_j
);
/* Computed the padded counts */
/* Computed the padded counts */
const
int
gcount_padded_i
=
gcount_i
-
(
gcount_i
%
VEC_SIZE
)
+
VEC_SIZE
;
const
int
gcount_padded_i
=
gcount_i
-
(
gcount_i
%
VEC_SIZE
)
+
VEC_SIZE
;
const
int
gcount_padded_j
=
gcount_j
-
(
gcount_j
%
VEC_SIZE
)
+
VEC_SIZE
;
const
int
gcount_padded_j
=
gcount_j
-
(
gcount_j
%
VEC_SIZE
)
+
VEC_SIZE
;
/* Fill the caches */
/* Fill the caches */
gravity_cache_populate
(
ci_cache
,
gparts_i
,
gcount_i
,
gcount_padded_i
,
ci_active
,
shift
);
gravity_cache_populate
(
ci_cache
,
gparts_i
,
gcount_i
,
gcount_padded_i
,
gravity_cache_populate_no_shift
(
cj_cache
,
gparts_j
,
gcount_j
,
gcount_padded_j
,
cj_active
);
ci_active
,
shift
);
gravity_cache_populate_no_shift
(
cj_cache
,
gparts_j
,
gcount_j
,
gcount_padded_j
,
cj_active
);
/* Ok... Here we go ! */
/* Ok... Here we go ! */
...
@@ -615,7 +614,6 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
...
@@ -615,7 +614,6 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
gparts_i
[
pid
].
num_interacted
++
;
gparts_i
[
pid
].
num_interacted
++
;
#endif
#endif
}
}
/* Store everything back in cache */
/* Store everything back in cache */
...
@@ -710,7 +708,6 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
...
@@ -710,7 +708,6 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
gparts_j
[
pjd
].
num_interacted
++
;
gparts_j
[
pjd
].
num_interacted
++
;
#endif
#endif
}
}
/* Store everything back in cache */
/* Store everything back in cache */
...
@@ -721,10 +718,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
...
@@ -721,10 +718,8 @@ void runner_dopair_grav_pp_truncated(struct runner *r, struct cell *ci,
}
}
/* Write back to the particles */
/* Write back to the particles */
if
(
ci_active
)
if
(
ci_active
)
gravity_cache_write_back
(
ci_cache
,
gparts_i
,
gcount_i
);
gravity_cache_write_back
(
ci_cache
,
gparts_i
,
gcount_i
);
if
(
cj_active
)
gravity_cache_write_back
(
cj_cache
,
gparts_j
,
gcount_j
);
if
(
cj_active
)
gravity_cache_write_back
(
cj_cache
,
gparts_j
,
gcount_j
);
#ifdef MATTHIEU_OLD_STUFF
#ifdef MATTHIEU_OLD_STUFF
/* Some constants */
/* Some constants */
...
...
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