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
5ea2eb00
Commit
5ea2eb00
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Also time the FFT task
parent
69ed160c
No related branches found
No related tags found
1 merge request
!340
Split the drift into hydro and gravity drift tasks. Implement FFT task and dependencies
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/runner_doiact_fft.c
+17
-10
17 additions, 10 deletions
src/runner_doiact_fft.c
src/runner_doiact_fft.h
+1
-1
1 addition, 1 deletion
src/runner_doiact_fft.h
src/timers.c
+1
-0
1 addition, 0 deletions
src/timers.c
src/timers.h
+1
-0
1 addition, 0 deletions
src/timers.h
with
20 additions
and
11 deletions
src/runner_doiact_fft.c
+
17
−
10
View file @
5ea2eb00
...
...
@@ -35,8 +35,8 @@
#include
"error.h"
#include
"runner.h"
#include
"space.h"
#include
"timers.h"
//#define index(i, j, k, N) ((i % N) * N * N + (j % N) * N + (k % N))
__attribute__
((
always_inline
))
INLINE
int
id
(
int
i
,
int
j
,
int
k
,
int
N
)
{
return
((
i
%
N
)
*
N
*
N
+
(
j
%
N
)
*
N
+
(
k
%
N
));
}
...
...
@@ -143,17 +143,24 @@ void print_carray(fftw_complex* array, int N) {
}
}
void
runner_do_grav_fft
(
struct
runner
*
r
)
{
/**
* @brief Computes the potential on the top multipoles using a Fourier transform
*
* @param r The #runner task
* @param timer Are we timing this ?
*/
void
runner_do_grav_fft
(
struct
runner
*
r
,
int
timer
)
{
#ifdef HAVE_FFTW
const
struct
engine
*
e
=
r
->
e
;
const
struct
space
*
s
=
e
->
s
;
const
integertime_t
ti_current
=
e
->
ti_current
;
const
double
a_smooth
=
0
.
*
e
->
gravity_properties
->
a_smooth
;
const
double
a_smooth
=
e
->
gravity_properties
->
a_smooth
;
const
double
box_size
=
s
->
dim
[
0
];
const
int
cdim
[
3
]
=
{
s
->
cdim
[
0
],
s
->
cdim
[
1
],
s
->
cdim
[
2
]};
struct
clocks_time
time1
,
time2
;
clocks_gettime
(
&
time1
);
TIMER_TIC
;
if
(
cdim
[
0
]
!=
cdim
[
1
]
||
cdim
[
0
]
!=
cdim
[
2
])
error
(
"Non-square mesh"
);
...
...
@@ -204,8 +211,6 @@ void runner_do_grav_fft(struct runner* r) {
const
double
a_smooth2
=
4
.
*
M_PI
*
a_smooth
*
a_smooth
/
((
double
)(
N
*
N
));
const
double
k_fac
=
M_PI
/
(
double
)
N
;
message
(
"k_fac = %e N = %d"
,
k_fac
,
N
);
/* Now de-convolve the CIC kernel and apply the Green function */
for
(
int
i
=
0
;
i
<
N
;
++
i
)
{
...
...
@@ -277,7 +282,9 @@ void runner_do_grav_fft(struct runner* r) {
fftw_free
(
frho
);
/* Time the whole thing */
clocks_gettime
(
&
time2
);
message
(
"took %.3f %s."
,
(
float
)
clocks_diff
(
&
time1
,
&
time2
),
clocks_getunit
());
if
(
timer
)
TIMER_TOC
(
timer_dograv_top_level
);
#else
error
(
"No FFTW library found. Cannot compute periodic long-range forces."
);
#endif
}
This diff is collapsed.
Click to expand it.
src/runner_doiact_fft.h
+
1
−
1
View file @
5ea2eb00
...
...
@@ -21,6 +21,6 @@
struct
runner
;
void
runner_do_grav_fft
(
struct
runner
*
r
);
void
runner_do_grav_fft
(
struct
runner
*
r
,
int
timer
);
#endif
/* SWIFT_RUNNER_DOIACT_FFT_H */
This diff is collapsed.
Click to expand it.
src/timers.c
+
1
−
0
View file @
5ea2eb00
...
...
@@ -58,6 +58,7 @@ const char* timers_names[timer_count] = {
"dopair_grav_pp"
,
"dograv_external"
,
"dograv_down"
,
"dograv_top_level"
,
"dograv_long_range"
,
"dosource"
,
"dosub_self_density"
,
...
...
This diff is collapsed.
Click to expand it.
src/timers.h
+
1
−
0
View file @
5ea2eb00
...
...
@@ -59,6 +59,7 @@ enum {
timer_dopair_grav_pp
,
timer_dograv_external
,
timer_dograv_down
,
timer_dograv_top_level
,
timer_dograv_long_range
,
timer_dosource
,
timer_dosub_self_density
,
...
...
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