Skip to content
GitLab
Menu
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
9bc31c9a
Commit
9bc31c9a
authored
Feb 18, 2020
by
Peter W. Draper
Browse files
Merge branch 'threadpool_auto_chunk_size' into 'master'
Threadpool auto chunk size See merge request
!1018
parents
bb257efb
d58c4705
Changes
20
Hide whitespace changes
Inline
Side-by-side
src/common_io.c
View file @
9bc31c9a
...
...
@@ -1580,7 +1580,7 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_copy_mapper
,
temp_c
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
{
/* Converting particle to data */
...
...
@@ -1593,8 +1593,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_part_f_mapper
,
temp_f
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_part_f_mapper
,
temp_f
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_part_i
!=
NULL
)
{
...
...
@@ -1605,8 +1605,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_part_i_mapper
,
temp_i
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_part_i_mapper
,
temp_i
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_part_d
!=
NULL
)
{
...
...
@@ -1617,8 +1617,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_part_d_mapper
,
temp_d
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_part_d_mapper
,
temp_d
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_part_l
!=
NULL
)
{
...
...
@@ -1629,8 +1629,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_part_l_mapper
,
temp_l
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_part_l_mapper
,
temp_l
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_gpart_f
!=
NULL
)
{
...
...
@@ -1641,8 +1641,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_gpart_f_mapper
,
temp_f
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_gpart_f_mapper
,
temp_f
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_gpart_i
!=
NULL
)
{
...
...
@@ -1653,8 +1653,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_gpart_i_mapper
,
temp_i
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_gpart_i_mapper
,
temp_i
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_gpart_d
!=
NULL
)
{
...
...
@@ -1665,8 +1665,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_gpart_d_mapper
,
temp_d
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_gpart_d_mapper
,
temp_d
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_gpart_l
!=
NULL
)
{
...
...
@@ -1677,8 +1677,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_gpart_l_mapper
,
temp_l
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_gpart_l_mapper
,
temp_l
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_spart_f
!=
NULL
)
{
...
...
@@ -1689,8 +1689,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_spart_f_mapper
,
temp_f
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_spart_f_mapper
,
temp_f
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_spart_i
!=
NULL
)
{
...
...
@@ -1701,8 +1701,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_spart_i_mapper
,
temp_i
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_spart_i_mapper
,
temp_i
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_spart_d
!=
NULL
)
{
...
...
@@ -1713,8 +1713,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_spart_d_mapper
,
temp_d
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_spart_d_mapper
,
temp_d
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_spart_l
!=
NULL
)
{
...
...
@@ -1725,8 +1725,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_spart_l_mapper
,
temp_l
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_spart_l_mapper
,
temp_l
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_bpart_f
!=
NULL
)
{
...
...
@@ -1737,8 +1737,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_bpart_f_mapper
,
temp_f
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_bpart_f_mapper
,
temp_f
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_bpart_i
!=
NULL
)
{
...
...
@@ -1749,8 +1749,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_bpart_i_mapper
,
temp_i
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_bpart_i_mapper
,
temp_i
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_bpart_d
!=
NULL
)
{
...
...
@@ -1761,8 +1761,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_bpart_d_mapper
,
temp_d
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_bpart_d_mapper
,
temp_d
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
if
(
props
.
convert_bpart_l
!=
NULL
)
{
...
...
@@ -1773,8 +1773,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
io_convert_bpart_l_mapper
,
temp_l
,
N
,
copySize
,
0
,
(
void
*
)
&
props
);
io_convert_bpart_l_mapper
,
temp_l
,
N
,
copySize
,
threadpool_auto_chunk_size
,
(
void
*
)
&
props
);
}
else
{
error
(
"Missing conversion function"
);
...
...
@@ -1832,7 +1832,7 @@ void io_prepare_dm_gparts(struct threadpool* tp, struct gpart* const gparts,
size_t
Ndm
)
{
threadpool_map
(
tp
,
io_prepare_dm_gparts_mapper
,
gparts
,
Ndm
,
sizeof
(
struct
gpart
),
0
,
NULL
);
sizeof
(
struct
gpart
),
threadpool_auto_chunk_size
,
NULL
);
}
void
io_prepare_dm_background_gparts_mapper
(
void
*
restrict
data
,
int
Ndm
,
...
...
@@ -1868,7 +1868,7 @@ void io_prepare_dm_background_gparts(struct threadpool* tp,
struct
gpart
*
const
gparts
,
size_t
Ndm
)
{
threadpool_map
(
tp
,
io_prepare_dm_background_gparts_mapper
,
gparts
,
Ndm
,
sizeof
(
struct
gpart
),
0
,
NULL
);
sizeof
(
struct
gpart
),
threadpool_auto_chunk_size
,
NULL
);
}
size_t
io_count_dm_background_gparts
(
const
struct
gpart
*
const
gparts
,
...
...
@@ -1950,7 +1950,7 @@ void io_duplicate_hydro_gparts(struct threadpool* tp, struct part* const parts,
data
.
Ndm
=
Ndm
;
threadpool_map
(
tp
,
io_duplicate_hydro_gparts_mapper
,
parts
,
Ngas
,
sizeof
(
struct
part
),
0
,
&
data
);
sizeof
(
struct
part
),
threadpool_auto_chunk_size
,
&
data
);
}
void
io_duplicate_stars_gparts_mapper
(
void
*
restrict
data
,
int
Nstars
,
...
...
@@ -2008,7 +2008,7 @@ void io_duplicate_stars_gparts(struct threadpool* tp,
data
.
Ndm
=
Ndm
;
threadpool_map
(
tp
,
io_duplicate_stars_gparts_mapper
,
sparts
,
Nstars
,
sizeof
(
struct
spart
),
0
,
&
data
);
sizeof
(
struct
spart
),
threadpool_auto_chunk_size
,
&
data
);
}
void
io_duplicate_black_holes_gparts_mapper
(
void
*
restrict
data
,
...
...
@@ -2068,7 +2068,8 @@ void io_duplicate_black_holes_gparts(struct threadpool* tp,
data
.
Ndm
=
Ndm
;
threadpool_map
(
tp
,
io_duplicate_black_holes_gparts_mapper
,
bparts
,
Nblackholes
,
sizeof
(
struct
bpart
),
0
,
&
data
);
Nblackholes
,
sizeof
(
struct
bpart
),
threadpool_auto_chunk_size
,
&
data
);
}
/**
...
...
src/engine.c
View file @
9bc31c9a
...
...
@@ -1285,7 +1285,7 @@ void engine_print_task_counts(const struct engine *e) {
for
(
int
k
=
0
;
k
<=
task_type_count
;
k
++
)
counts
[
k
]
=
0
;
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
engine_do_tasks_count_mapper
,
(
void
*
)
tasks
,
nr_tasks
,
sizeof
(
struct
task
),
0
,
counts
);
sizeof
(
struct
task
),
threadpool_auto_chunk_size
,
counts
);
#ifdef WITH_MPI
printf
(
"[%04i] %s engine_print_task_counts: task counts are [ %s=%i"
,
...
...
@@ -2718,7 +2718,8 @@ void engine_reconstruct_multipoles(struct engine *e) {
#endif
threadpool_map
(
&
e
->
threadpool
,
engine_do_reconstruct_multipoles_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
0
,
e
);
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
threadpool_auto_chunk_size
,
e
);
if
(
e
->
verbose
)
message
(
"took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
...
...
src/engine_collect_end_of_step.c
View file @
9bc31c9a
...
...
@@ -465,7 +465,7 @@ void engine_collect_end_of_step(struct engine *e, int apply) {
/* Collect information from the local top-level cells */
threadpool_map
(
&
e
->
threadpool
,
engine_collect_end_of_step_mapper
,
s
->
local_cells_with_tasks_top
,
s
->
nr_local_cells_with_tasks
,
sizeof
(
int
),
0
,
&
data
);
sizeof
(
int
),
threadpool_auto_chunk_size
,
&
data
);
/* Get the number of inhibited particles from the space-wide counters
* since these have been updated atomically during the time-steps. */
...
...
src/engine_drift.c
View file @
9bc31c9a
...
...
@@ -293,28 +293,28 @@ void engine_drift_all(struct engine *e, const int drift_mpoles) {
if
(
e
->
s
->
nr_parts
>
0
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_part_mapper
,
e
->
s
->
local_cells_top
,
e
->
s
->
nr_local_cells
,
sizeof
(
int
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
if
(
e
->
s
->
nr_gparts
>
0
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_gpart_mapper
,
e
->
s
->
local_cells_top
,
e
->
s
->
nr_local_cells
,
sizeof
(
int
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
if
(
e
->
s
->
nr_sparts
>
0
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_spart_mapper
,
e
->
s
->
local_cells_top
,
e
->
s
->
nr_local_cells
,
sizeof
(
int
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
if
(
e
->
s
->
nr_bparts
>
0
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_bpart_mapper
,
e
->
s
->
local_cells_top
,
e
->
s
->
nr_local_cells
,
sizeof
(
int
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
if
(
drift_mpoles
&&
(
e
->
policy
&
engine_policy_self_gravity
))
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_multipole_mapper
,
e
->
s
->
local_cells_with_tasks_top
,
e
->
s
->
nr_local_cells_with_tasks
,
sizeof
(
int
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
}
else
{
...
...
@@ -325,27 +325,27 @@ void engine_drift_all(struct engine *e, const int drift_mpoles) {
if
(
e
->
s
->
nr_parts
>
0
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_part_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
if
(
e
->
s
->
nr_sparts
>
0
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_spart_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
if
(
e
->
s
->
nr_bparts
>
0
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_bpart_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
if
(
e
->
s
->
nr_gparts
>
0
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_gpart_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
if
(
e
->
policy
&
engine_policy_self_gravity
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_do_drift_all_multipole_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
/* default chunk */
0
,
e
);
threadpool_auto_chunk_size
,
e
);
}
}
...
...
@@ -401,7 +401,8 @@ 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
),
0
,
e
);
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
threadpool_auto_chunk_size
,
e
);
#ifdef SWIFT_DEBUG_CHECKS
/* Check that all cells have been drifted to the current time. */
...
...
src/engine_maketasks.c
View file @
9bc31c9a
...
...
@@ -3123,7 +3123,7 @@ void engine_make_fof_tasks(struct engine *e) {
/* Construct a FOF loop over neighbours */
if
(
e
->
policy
&
engine_policy_fof
)
threadpool_map
(
&
e
->
threadpool
,
engine_make_fofloop_tasks_mapper
,
NULL
,
s
->
nr_cells
,
1
,
0
,
e
);
s
->
nr_cells
,
1
,
threadpool_auto_chunk_size
,
e
);
if
(
e
->
verbose
)
message
(
"Making FOF tasks took %.3f %s."
,
...
...
@@ -3180,7 +3180,7 @@ void engine_maketasks(struct engine *e) {
/* Construct the first hydro loop over neighbours */
if
(
e
->
policy
&
engine_policy_hydro
)
threadpool_map
(
&
e
->
threadpool
,
engine_make_hydroloop_tasks_mapper
,
NULL
,
s
->
nr_cells
,
1
,
0
,
e
);
s
->
nr_cells
,
1
,
threadpool_auto_chunk_size
,
e
);
if
(
e
->
verbose
)
message
(
"Making hydro tasks took %.3f %s."
,
...
...
@@ -3191,7 +3191,7 @@ void engine_maketasks(struct engine *e) {
/* Add the self gravity tasks. */
if
(
e
->
policy
&
engine_policy_self_gravity
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_make_self_gravity_tasks_mapper
,
NULL
,
s
->
nr_cells
,
1
,
0
,
e
);
s
->
nr_cells
,
1
,
threadpool_auto_chunk_size
,
e
);
}
if
(
e
->
verbose
)
...
...
@@ -3242,7 +3242,8 @@ void engine_maketasks(struct engine *e) {
store the density tasks in each cell, and make each sort
depend on the sorts of its progeny. */
threadpool_map
(
&
e
->
threadpool
,
engine_count_and_link_tasks_mapper
,
sched
->
tasks
,
sched
->
nr_tasks
,
sizeof
(
struct
task
),
0
,
e
);
sched
->
tasks
,
sched
->
nr_tasks
,
sizeof
(
struct
task
),
threadpool_auto_chunk_size
,
e
);
if
(
e
->
verbose
)
message
(
"Counting and linking tasks took %.3f %s."
,
...
...
@@ -3259,7 +3260,7 @@ void engine_maketasks(struct engine *e) {
/* Now that the self/pair tasks are at the right level, set the super
* pointers. */
threadpool_map
(
&
e
->
threadpool
,
cell_set_super_mapper
,
cells
,
nr_cells
,
sizeof
(
struct
cell
),
0
,
e
);
sizeof
(
struct
cell
),
threadpool_auto_chunk_size
,
e
);
if
(
e
->
verbose
)
message
(
"Setting super-pointers took %.3f %s."
,
...
...
@@ -3267,7 +3268,7 @@ void engine_maketasks(struct engine *e) {
/* Append hierarchical tasks to each cell. */
threadpool_map
(
&
e
->
threadpool
,
engine_make_hierarchical_tasks_mapper
,
cells
,
nr_cells
,
sizeof
(
struct
cell
),
0
,
e
);
nr_cells
,
sizeof
(
struct
cell
),
threadpool_auto_chunk_size
,
e
);
tic2
=
getticks
();
...
...
@@ -3276,7 +3277,8 @@ void engine_maketasks(struct engine *e) {
of its super-cell. */
if
(
e
->
policy
&
engine_policy_hydro
)
threadpool_map
(
&
e
->
threadpool
,
engine_make_extra_hydroloop_tasks_mapper
,
sched
->
tasks
,
sched
->
nr_tasks
,
sizeof
(
struct
task
),
0
,
e
);
sched
->
tasks
,
sched
->
nr_tasks
,
sizeof
(
struct
task
),
threadpool_auto_chunk_size
,
e
);
if
(
e
->
verbose
)
message
(
"Making extra hydroloop tasks took %.3f %s."
,
...
...
@@ -3325,8 +3327,8 @@ void engine_maketasks(struct engine *e) {
threadpool_map
(
&
e
->
threadpool
,
engine_addtasks_send_mapper
,
send_cell_type_pairs
,
num_send_cells
,
sizeof
(
struct
cell_type_pair
),
/*chunk=*/
0
,
e
);
sizeof
(
struct
cell_type_pair
),
threadpool_auto_chunk_size
,
e
);
free
(
send_cell_type_pairs
);
...
...
@@ -3366,8 +3368,8 @@ void engine_maketasks(struct engine *e) {
}
threadpool_map
(
&
e
->
threadpool
,
engine_addtasks_recv_mapper
,
recv_cell_type_pairs
,
num_recv_cells
,
sizeof
(
struct
cell_type_pair
),
/*chunk=*/
0
,
e
);
sizeof
(
struct
cell_type_pair
),
threadpool_auto_chunk_size
,
e
);
free
(
recv_cell_type_pairs
);
if
(
e
->
verbose
)
...
...
src/engine_marktasks.c
View file @
9bc31c9a
...
...
@@ -1004,7 +1004,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
,
(
size_t
)
rebuild_space
,
(
size_t
)
&
e
->
sched
};
threadpool_map
(
&
e
->
threadpool
,
engine_marktasks_mapper
,
s
->
tasks
,
s
->
nr_tasks
,
sizeof
(
struct
task
),
0
,
extra_data
);
sizeof
(
struct
task
),
threadpool_auto_chunk_size
,
extra_data
);
rebuild_space
=
extra_data
[
1
];
if
(
e
->
verbose
)
...
...
src/engine_redistribute.c
View file @
9bc31c9a
...
...
@@ -664,7 +664,8 @@ void engine_redistribute(struct engine *e) {
redist_data
.
base
=
(
void
*
)
parts
;
threadpool_map
(
&
e
->
threadpool
,
engine_redistribute_dest_mapper_part
,
parts
,
nr_parts
,
sizeof
(
struct
part
),
0
,
&
redist_data
);
nr_parts
,
sizeof
(
struct
part
),
threadpool_auto_chunk_size
,
&
redist_data
);
/* Sort the particles according to their cell index. */
if
(
nr_parts
>
0
)
...
...
@@ -711,7 +712,8 @@ void engine_redistribute(struct engine *e) {
savelink_data
.
parts
=
(
void
*
)
parts
;
savelink_data
.
nodeID
=
nodeID
;
threadpool_map
(
&
e
->
threadpool
,
engine_redistribute_savelink_mapper_part
,
nodes
,
nr_nodes
,
sizeof
(
int
),
0
,
&
savelink_data
);
nodes
,
nr_nodes
,
sizeof
(
int
),
threadpool_auto_chunk_size
,
&
savelink_data
);
}
swift_free
(
"dest"
,
dest
);
...
...
@@ -729,7 +731,8 @@ void engine_redistribute(struct engine *e) {
redist_data
.
base
=
(
void
*
)
sparts
;
threadpool_map
(
&
e
->
threadpool
,
engine_redistribute_dest_mapper_spart
,
sparts
,
nr_sparts
,
sizeof
(
struct
spart
),
0
,
&
redist_data
);
nr_sparts
,
sizeof
(
struct
spart
),
threadpool_auto_chunk_size
,
&
redist_data
);
/* Sort the particles according to their cell index. */
if
(
nr_sparts
>
0
)
...
...
@@ -775,7 +778,8 @@ void engine_redistribute(struct engine *e) {
savelink_data
.
parts
=
(
void
*
)
sparts
;
savelink_data
.
nodeID
=
nodeID
;
threadpool_map
(
&
e
->
threadpool
,
engine_redistribute_savelink_mapper_spart
,
nodes
,
nr_nodes
,
sizeof
(
int
),
0
,
&
savelink_data
);
nodes
,
nr_nodes
,
sizeof
(
int
),
threadpool_auto_chunk_size
,
&
savelink_data
);
}
swift_free
(
"s_dest"
,
s_dest
);
...
...
@@ -793,7 +797,8 @@ void engine_redistribute(struct engine *e) {
redist_data
.
base
=
(
void
*
)
bparts
;
threadpool_map
(
&
e
->
threadpool
,
engine_redistribute_dest_mapper_bpart
,
bparts
,
nr_bparts
,
sizeof
(
struct
bpart
),
0
,
&
redist_data
);
nr_bparts
,
sizeof
(
struct
bpart
),
threadpool_auto_chunk_size
,
&
redist_data
);
/* Sort the particles according to their cell index. */
if
(
nr_bparts
>
0
)
...
...
@@ -839,7 +844,8 @@ void engine_redistribute(struct engine *e) {
savelink_data
.
parts
=
(
void
*
)
bparts
;
savelink_data
.
nodeID
=
nodeID
;
threadpool_map
(
&
e
->
threadpool
,
engine_redistribute_savelink_mapper_bpart
,
nodes
,
nr_nodes
,
sizeof
(
int
),
0
,
&
savelink_data
);
nodes
,
nr_nodes
,
sizeof
(
int
),
threadpool_auto_chunk_size
,
&
savelink_data
);
}
swift_free
(
"b_dest"
,
b_dest
);
...
...
@@ -857,7 +863,8 @@ void engine_redistribute(struct engine *e) {
redist_data
.
base
=
(
void
*
)
gparts
;
threadpool_map
(
&
e
->
threadpool
,
engine_redistribute_dest_mapper_gpart
,
gparts
,
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
&
redist_data
);
nr_gparts
,
sizeof
(
struct
gpart
),
threadpool_auto_chunk_size
,
&
redist_data
);
/* Sort the gparticles according to their cell index. */
if
(
nr_gparts
>
0
)
...
...
src/engine_unskip.c
View file @
9bc31c9a
...
...
@@ -383,7 +383,8 @@ void engine_unskip(struct engine *e) {
/* Activate all the regular tasks */
threadpool_map
(
&
e
->
threadpool
,
engine_do_unskip_mapper
,
local_active_cells
,
num_active_cells
*
multiplier
,
sizeof
(
int
),
1
,
&
data
);
num_active_cells
*
multiplier
,
sizeof
(
int
),
/*chunk=*/
1
,
&
data
);
#ifdef WITH_PROFILER
ProfilerStop
();
...
...
@@ -444,7 +445,8 @@ void engine_unskip_timestep_communications(struct engine *e) {
/* Activate all the part and gpart ti_end tasks */
threadpool_map
(
&
e
->
threadpool
,
engine_unskip_timestep_communications_mapper
,
tasks
,
nr_tasks
,
sizeof
(
struct
task
),
0
,
s
);
tasks
,
nr_tasks
,
sizeof
(
struct
task
),
threadpool_auto_chunk_size
,
s
);
if
(
e
->
verbose
)
message
(
"took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
...
...
src/fof.c
View file @
9bc31c9a
...
...
@@ -324,8 +324,8 @@ void fof_allocate(const struct space *s, const long long total_nr_DM_particles,
/* Set initial group index */
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_set_initial_group_index_mapper
,
props
->
group_index
,
s
->
nr_gparts
,
sizeof
(
size_t
),
0
,
props
->
group_index
);
props
->
group_index
,
s
->
nr_gparts
,
sizeof
(
size_t
),
threadpool_auto_chunk_size
,
props
->
group_index
);
if
(
verbose
)
message
(
"Setting initial group index took: %.3f %s."
,
...
...
@@ -335,7 +335,8 @@ void fof_allocate(const struct space *s, const long long total_nr_DM_particles,
/* Set initial group sizes */
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_set_initial_group_size_mapper
,
props
->
group_size
,
s
->
nr_gparts
,
sizeof
(
size_t
),
0
,
NULL
);
props
->
group_size
,
s
->
nr_gparts
,
sizeof
(
size_t
),
threadpool_auto_chunk_size
,
NULL
);
if
(
verbose
)
message
(
"Setting initial group sizes took: %.3f %s."
,
...
...
@@ -1759,7 +1760,8 @@ void fof_calc_group_mass(struct fof_props *props, const struct space *s,
/* Increment the group mass for groups above min_group_size. */
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_calc_group_mass_mapper
,
gparts
,
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
(
struct
space
*
)
s
);
nr_gparts
,
sizeof
(
struct
gpart
),
threadpool_auto_chunk_size
,
(
struct
space
*
)
s
);
/* Loop over particles and find the densest particle in each group. */
/* JSW TODO: Parallelise with threadpool*/
...
...
@@ -2278,7 +2280,8 @@ void fof_search_foreign_cells(struct fof_props *props, const struct space *s) {
data
.
nr_gparts
=
nr_gparts
;
data
.
space_gparts
=
s
->
gparts
;
threadpool_map
(
&
e
->
threadpool
,
fof_set_outgoing_root_mapper
,
local_cells
,
num_cells_out
,
sizeof
(
struct
cell
**
),
0
,
&
data
);
num_cells_out
,
sizeof
(
struct
cell
**
),
threadpool_auto_chunk_size
,
&
data
);
if
(
verbose
)
message
(
...
...
@@ -2636,7 +2639,8 @@ void fof_search_tree(struct fof_props *props,
ticks
tic_calc_group_size
=
getticks
();
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_calc_group_size_mapper
,
gparts
,
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
s
);
nr_gparts
,
sizeof
(
struct
gpart
),
threadpool_auto_chunk_size
,
s
);
if
(
verbose
)
message
(
"FOF calc group size took (FOF SCALING): %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic_calc_group_size
),
...
...
@@ -2778,7 +2782,7 @@ void fof_search_tree(struct fof_props *props,
/* Set default group ID for all particles */
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_set_initial_group_id_mapper
,
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
threadpool_auto_chunk_size
,
(
void
*
)
&
group_id_default
);
if
(
verbose
)
...
...
src/gravity.c
View file @
9bc31c9a
...
...
@@ -36,6 +36,7 @@
/* Local headers. */
#include "active.h"
#include "error.h"
#include "threadpool.h"
#include "version.h"
struct
exact_force_data
{
...
...
@@ -615,7 +616,8 @@ 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
),
0
,
&
data
);
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
threadpool_auto_chunk_size
,
&
data
);
message
(
"Computed exact gravity for %d gparts (took %.3f %s). "
,
data
.
counter_global
,
clocks_from_ticks
(
getticks
()
-
tic
),
...
...
src/logger_io.c
View file @
9bc31c9a
...
...
@@ -54,6 +54,7 @@
#include "serial_io.h"
#include "single_io.h"
#include "stars_io.h"
#include "threadpool.h"
#include "tracers_io.h"
#include "units.h"
#include "version.h"
...
...
@@ -128,7 +129,7 @@ void writeIndexArray(const struct engine* e, FILE* f, struct io_props* props,
/* Copy the whole thing into a buffer */
threadpool_map
((
struct
threadpool
*
)
&
e
->
threadpool
,
logger_io_copy_mapper
,
temp
,
N
,
typeSize
,
0
,
props
);
temp
,
N
,
typeSize
,
threadpool_auto_chunk_size
,
props
);
/* Write data to file */
fwrite
(
temp
,
typeSize
,
num_elements
,
f
);
...
...
src/mesh_gravity.c
View file @
9bc31c9a
...
...
@@ -37,6 +37,7 @@
#include "part.h"
#include "runner.h"
#include "space.h"
#include "threadpool.h"
#ifdef HAVE_FFTW