Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
63098d78
Commit
63098d78
authored
Jul 26, 2017
by
Pedro Gonnet
Browse files
switch to automatic chunk size selection.
parent
c13c0a3f
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
63098d78
...
...
@@ -2792,7 +2792,7 @@ int engine_marktasks(struct engine *e) {
/* Run through the tasks and mark as skip or not. */
size_t
extra_data
[
3
]
=
{(
size_t
)
e
,
rebuild_space
,
(
size_t
)
&
e
->
sched
};
threadpool_map
(
&
e
->
threadpool
,
engine_marktasks_mapper
,
s
->
tasks
,
s
->
nr_tasks
,
sizeof
(
struct
task
),
1000
0
,
extra_data
);
sizeof
(
struct
task
),
0
,
extra_data
);
rebuild_space
=
extra_data
[
1
];
if
(
e
->
verbose
)
...
...
@@ -3640,7 +3640,7 @@ void engine_unskip(struct engine *e) {
/* Activate all the regular tasks */
threadpool_map
(
&
e
->
threadpool
,
runner_do_unskip_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
e
);
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
0
,
e
);
/* And the top level gravity FFT one */
if
(
e
->
s
->
periodic
&&
(
e
->
policy
&
engine_policy_self_gravity
))
...
...
@@ -3696,7 +3696,7 @@ void engine_drift_all(struct engine *e) {
#endif
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
e
);
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
0
,
e
);
/* Synchronize particle positions */
space_synchronize_particle_positions
(
e
->
s
);
...
...
@@ -3748,7 +3748,7 @@ void engine_drift_top_multipoles(struct engine *e) {
const
ticks
tic
=
getticks
();
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_top_multipoles_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
0
,
e
);
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
0
,
e
);
#ifdef SWIFT_DEBUG_CHECKS
/* Check that all cells have been drifted to the current time. */
...
...
@@ -3786,7 +3786,7 @@ void engine_reconstruct_multipoles(struct engine *e) {
const
ticks
tic
=
getticks
();
threadpool_map
(
&
e
->
threadpool
,
engine_do_reconstruct_multipoles_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
0
,
e
);
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
0
,
e
);
if
(
e
->
verbose
)
message
(
"took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
...
...
src/gravity.c
View file @
63098d78
...
...
@@ -207,7 +207,7 @@ void gravity_exact_force_compute(struct space *s, const struct engine *e) {
data
.
const_G
=
e
->
physical_constants
->
const_newton_G
;
threadpool_map
(
&
s
->
e
->
threadpool
,
gravity_exact_force_compute_mapper
,
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
100
0
,
&
data
);
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
&
data
);
message
(
"Computed exact gravity for %d gparts (took %.3f %s). "
,
data
.
counter_global
,
clocks_from_ticks
(
getticks
()
-
tic
),
...
...
src/scheduler.c
View file @
63098d78
...
...
@@ -759,7 +759,7 @@ void scheduler_splittasks(struct scheduler *s) {
/* Call the mapper on each current task. */
threadpool_map
(
s
->
threadpool
,
scheduler_splittasks_mapper
,
s
->
tasks
,
s
->
nr_tasks
,
sizeof
(
struct
task
),
100
0
,
s
);
s
->
nr_tasks
,
sizeof
(
struct
task
),
0
,
s
);
}
/**
...
...
@@ -1174,7 +1174,7 @@ void scheduler_start(struct scheduler *s) {
/* Re-wait the tasks. */
if
(
s
->
active_count
>
1000
)
{
threadpool_map
(
s
->
threadpool
,
scheduler_rewait_mapper
,
s
->
tid_active
,
s
->
active_count
,
sizeof
(
int
),
100
0
,
s
);
s
->
active_count
,
sizeof
(
int
),
0
,
s
);
}
else
{
scheduler_rewait_mapper
(
s
->
tid_active
,
s
->
active_count
,
s
);
}
...
...
@@ -1250,7 +1250,7 @@ void scheduler_start(struct scheduler *s) {
/* Loop over the tasks and enqueue whoever is ready. */
if
(
s
->
active_count
>
1000
)
{
threadpool_map
(
s
->
threadpool
,
scheduler_enqueue_mapper
,
s
->
tid_active
,
s
->
active_count
,
sizeof
(
int
),
100
0
,
s
);
s
->
active_count
,
sizeof
(
int
),
0
,
s
);
}
else
{
scheduler_enqueue_mapper
(
s
->
tid_active
,
s
->
active_count
,
s
);
}
...
...
src/space.c
View file @
63098d78
...
...
@@ -378,7 +378,7 @@ void space_regrid(struct space *s, int verbose) {
/* Free the old cells, if they were allocated. */
if
(
s
->
cells_top
!=
NULL
)
{
threadpool_map
(
&
s
->
e
->
threadpool
,
space_rebuild_recycle_mapper
,
s
->
cells_top
,
s
->
nr_cells
,
sizeof
(
struct
cell
),
10
0
,
s
);
s
->
cells_top
,
s
->
nr_cells
,
sizeof
(
struct
cell
),
0
,
s
);
free
(
s
->
cells_top
);
free
(
s
->
multipoles_top
);
s
->
maxdepth
=
0
;
...
...
@@ -491,7 +491,7 @@ void space_regrid(struct space *s, int verbose) {
/* Free the old cells, if they were allocated. */
threadpool_map
(
&
s
->
e
->
threadpool
,
space_rebuild_recycle_mapper
,
s
->
cells_top
,
s
->
nr_cells
,
sizeof
(
struct
cell
),
10
0
,
s
);
s
->
cells_top
,
s
->
nr_cells
,
sizeof
(
struct
cell
),
0
,
s
);
s
->
maxdepth
=
0
;
}
...
...
@@ -1004,7 +1004,7 @@ void space_sanitize(struct space *s) {
if
(
s
->
e
->
nodeID
==
0
)
message
(
"Cleaning up unreasonable values of h"
);
threadpool_map
(
&
s
->
e
->
threadpool
,
space_sanitize_mapper
,
s
->
cells_top
,
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
NULL
);
s
->
nr_cells
,
sizeof
(
struct
cell
),
0
,
NULL
);
}
/**
...
...
@@ -1214,7 +1214,7 @@ void space_gparts_get_cell_index(struct space *s, int *gind, struct cell *cells,
data
.
ind
=
gind
;
threadpool_map
(
&
s
->
e
->
threadpool
,
space_gparts_get_cell_index_mapper
,
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
100
0
,
&
data
);
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
&
data
);
if
(
verbose
)
message
(
"took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
...
...
@@ -1241,7 +1241,7 @@ void space_sparts_get_cell_index(struct space *s, int *sind, struct cell *cells,
data
.
ind
=
sind
;
threadpool_map
(
&
s
->
e
->
threadpool
,
space_sparts_get_cell_index_mapper
,
s
->
sparts
,
s
->
nr_sparts
,
sizeof
(
struct
spart
),
100
0
,
&
data
);
s
->
sparts
,
s
->
nr_sparts
,
sizeof
(
struct
spart
),
0
,
&
data
);
if
(
verbose
)
message
(
"took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
...
...
@@ -2501,7 +2501,7 @@ void space_synchronize_particle_positions(struct space *s) {
(
s
->
nr_gparts
>
0
&&
s
->
nr_sparts
>
0
))
threadpool_map
(
&
s
->
e
->
threadpool
,
space_synchronize_particle_positions_mapper
,
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
100
0
,
(
void
*
)
s
);
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
(
void
*
)
s
);
}
/**
...
...
src/statistics.c
View file @
63098d78
...
...
@@ -271,12 +271,12 @@ void stats_collect(const struct space *s, struct statistics *stats) {
/* Run parallel collection of statistics for parts */
if
(
s
->
nr_parts
>
0
)
threadpool_map
(
&
s
->
e
->
threadpool
,
stats_collect_part_mapper
,
s
->
parts
,
s
->
nr_parts
,
sizeof
(
struct
part
),
1000
0
,
&
extra_data
);
s
->
nr_parts
,
sizeof
(
struct
part
),
0
,
&
extra_data
);
/* Run parallel collection of statistics for gparts */
if
(
s
->
nr_gparts
>
0
)
threadpool_map
(
&
s
->
e
->
threadpool
,
stats_collect_gpart_mapper
,
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
1000
0
,
&
extra_data
);
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
&
extra_data
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment