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
355dbf6e
Commit
355dbf6e
authored
8 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Reset particle fields after each run and time runner_dopair2_force interactions.
parent
4f93e8c8
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!406
Doself2 vectorisation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test125cells.c
+57
-11
57 additions, 11 deletions
tests/test125cells.c
with
57 additions
and
11 deletions
tests/test125cells.c
+
57
−
11
View file @
355dbf6e
...
...
@@ -32,7 +32,7 @@
#include
"swift.h"
#if defined(WITH_VECTORIZATION)
#define DOSELF2 runner_doself2_force_vec_
2
#define DOSELF2 runner_doself2_force_vec_
3
#define DOPAIR2 runner_dopair2_density_vec
#define DOSELF2_NAME "runner_doself2_force_vec_3"
#define DOPAIR2_NAME "runner_dopair2_force_vec"
...
...
@@ -604,6 +604,9 @@ int main(int argc, char *argv[]) {
malloc
(
main_cell
->
count
*
sizeof
(
struct
solution_part
));
get_solution
(
main_cell
,
solution
,
rho
,
vel
,
press
,
size
);
ticks
timings
[
27
];
for
(
int
i
=
0
;
i
<
27
;
i
++
)
timings
[
i
]
=
0
;
/* Start the test */
ticks
time
=
0
;
ticks
self_force_time
=
0
;
...
...
@@ -615,6 +618,12 @@ int main(int argc, char *argv[]) {
for
(
int
j
=
0
;
j
<
125
;
++
j
)
runner_do_drift_particles
(
&
runner
,
cells
[
j
],
0
);
/* Reset particles. */
for
(
int
i
=
0
;
i
<
125
;
++
i
)
{
for
(
int
n
=
0
;
n
<
cells
[
i
]
->
count
;
++
n
)
hydro_init_part
(
&
cells
[
i
]
->
parts
[
n
],
&
space
.
hs
);
}
/* First, sort stuff */
for
(
int
j
=
0
;
j
<
125
;
++
j
)
runner_do_sort
(
&
runner
,
cells
[
j
],
0x1FFF
,
0
);
...
...
@@ -663,6 +672,7 @@ int main(int argc, char *argv[]) {
/* Do the force calculation */
#if !(defined(MINIMAL_SPH) && defined(WITH_VECTORIZATION))
int
ctr
=
0
;
/* Do the pairs (for the central 27 cells) */
for
(
int
i
=
1
;
i
<
4
;
i
++
)
{
for
(
int
j
=
1
;
j
<
4
;
j
++
)
{
...
...
@@ -670,14 +680,33 @@ int main(int argc, char *argv[]) {
struct
cell
*
cj
=
cells
[
i
*
25
+
j
*
5
+
k
];
if
(
main_cell
!=
cj
)
runner_dopair2_force
(
&
runner
,
main_cell
,
cj
);
if
(
main_cell
!=
cj
)
{
//double shift[3] = {0.0, 0.0, 0.0};
//struct cell *tempA = main_cell;
//struct cell *tempB = cj;
//const int sid = space_getsid(runner.e->s, &tempA, &tempB, shift);
//
//if(sort_is_face(sid)) message("Face interaction: %d", ctr);
//else if(sort_is_edge(sid)) message("Edge interaction: %d", ctr);
//else if(sort_is_corner(sid)) message("Corner interaction: %d", ctr);
const
ticks
sub_tic
=
getticks
();
runner_dopair2_force
(
&
runner
,
main_cell
,
cj
);
const
ticks
sub_toc
=
getticks
();
timings
[
ctr
++
]
+=
sub_toc
-
sub_tic
;
}
}
}
}
#ifdef WITH_VECTORIZATION
/* Initialise the cache. */
runner
.
ci_cache
.
count
=
0
;
cache_init
(
&
runner
.
ci_cache
,
512
);
#endif
/* And now the self-interaction for the main cell */
//runner_doself2_force(&runner, main_cell);
...
...
@@ -685,8 +714,8 @@ int main(int argc, char *argv[]) {
ticks
self_tic
=
getticks
();
DOSELF2
(
&
runner
,
main_cell
);
self_force_time
+=
getticks
()
-
self_tic
;
timings
[
26
]
+=
getticks
()
-
self_tic
;
#endif
/* Finally, give a gentle kick */
...
...
@@ -701,16 +730,33 @@ int main(int argc, char *argv[]) {
dump_particle_fields
(
outputFileName
,
main_cell
,
solution
,
0
);
}
/* Reset stuff */
for
(
int
i
=
0
;
i
<
125
;
++
i
)
{
for
(
int
n
=
0
;
n
<
cells
[
i
]
->
count
;
++
n
)
hydro_init_part
(
&
cells
[
i
]
->
parts
[
n
],
&
space
.
hs
);
}
}
for
(
size_t
n
=
0
;
n
<
100
*
runs
;
++
n
)
{
ticks
self_tic
=
getticks
();
DOSELF2
(
&
runner
,
main_cell
);
self_force_time
+=
getticks
()
-
self_tic
;
}
/* Output timing */
message
(
"Self calculations took : %15lli ticks."
,
self_force_time
/
runs
);
message
(
"SWIFT calculation took : %15lli ticks."
,
time
/
runs
);
ticks
corner_time
=
timings
[
0
]
+
timings
[
2
]
+
timings
[
6
]
+
timings
[
8
]
+
timings
[
17
]
+
timings
[
19
]
+
timings
[
23
]
+
timings
[
25
];
ticks
edge_time
=
timings
[
1
]
+
timings
[
3
]
+
timings
[
5
]
+
timings
[
7
]
+
timings
[
9
]
+
timings
[
11
]
+
timings
[
14
]
+
timings
[
16
]
+
timings
[
18
]
+
timings
[
20
]
+
timings
[
22
]
+
timings
[
24
];
ticks
face_time
=
timings
[
4
]
+
timings
[
10
]
+
timings
[
12
]
+
timings
[
13
]
+
timings
[
15
]
+
timings
[
21
];
message
(
"Corner calculations took : %15lli ticks."
,
corner_time
/
runs
);
message
(
"Edge calculations took : %15lli ticks."
,
edge_time
/
runs
);
message
(
"Face calculations took : %15lli ticks."
,
face_time
/
runs
);
message
(
"Self calculations took : %15lli ticks."
,
self_force_time
/
100
*
runs
);
message
(
"SWIFT calculation took : %15lli ticks."
,
time
/
runs
);
for
(
int
j
=
0
;
j
<
125
;
++
j
)
reset_particles
(
cells
[
j
],
&
space
.
hs
,
vel
,
press
,
size
,
rho
);
...
...
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