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
f05bd301
Commit
f05bd301
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Applied code formatting tool.
parent
fec911c1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fof.c
+31
-28
31 additions, 28 deletions
src/fof.c
with
31 additions
and
28 deletions
src/fof.c
+
31
−
28
View file @
f05bd301
...
@@ -297,9 +297,9 @@ void fof_allocate(const struct space *s, const long long total_nr_DM_particles,
...
@@ -297,9 +297,9 @@ void fof_allocate(const struct space *s, const long long total_nr_DM_particles,
props
->
group_index
,
s
->
nr_gparts
,
sizeof
(
size_t
),
0
,
props
->
group_index
,
s
->
nr_gparts
,
sizeof
(
size_t
),
0
,
props
->
group_index
);
props
->
group_index
);
if
(
verbose
)
if
(
verbose
)
message
(
"Setting initial group index took: %.3f %s."
,
message
(
"Setting initial group index took: %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
tic
=
getticks
();
tic
=
getticks
();
...
@@ -307,9 +307,9 @@ void fof_allocate(const struct space *s, const long long total_nr_DM_particles,
...
@@ -307,9 +307,9 @@ void fof_allocate(const struct space *s, const long long total_nr_DM_particles,
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_set_initial_group_size_mapper
,
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
),
0
,
NULL
);
if
(
verbose
)
if
(
verbose
)
message
(
"Setting initial group sizes took: %.3f %s."
,
message
(
"Setting initial group sizes took: %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
ti_current
=
s
->
e
->
ti_current
;
ti_current
=
s
->
e
->
ti_current
;
...
@@ -2233,7 +2233,7 @@ void fof_search_foreign_cells(struct fof_props *props, const struct space *s) {
...
@@ -2233,7 +2233,7 @@ void fof_search_foreign_cells(struct fof_props *props, const struct space *s) {
}
}
}
}
}
}
/* Now set the roots */
/* Now set the roots */
struct
mapper_data
data
;
struct
mapper_data
data
;
data
.
group_index
=
group_index
;
data
.
group_index
=
group_index
;
...
@@ -2581,7 +2581,7 @@ void fof_search_tree(struct fof_props *props,
...
@@ -2581,7 +2581,7 @@ void fof_search_tree(struct fof_props *props,
if
(
verbose
)
if
(
verbose
)
message
(
"MPI_Scan Imbalance took: %.3f %s."
,
message
(
"MPI_Scan Imbalance took: %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
comms_tic
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
comms_tic
),
clocks_getunit
());
node_offset
=
nr_gparts_cumulative
-
nr_gparts_local
;
node_offset
=
nr_gparts_cumulative
-
nr_gparts_local
;
...
@@ -2600,10 +2600,10 @@ void fof_search_tree(struct fof_props *props,
...
@@ -2600,10 +2600,10 @@ void fof_search_tree(struct fof_props *props,
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_calc_group_size_mapper
,
gparts
,
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_calc_group_size_mapper
,
gparts
,
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
s
);
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
s
);
if
(
verbose
)
if
(
verbose
)
message
(
"FOF calc group size took (FOF SCALING): %.3f %s."
,
message
(
"FOF calc group size took (FOF SCALING): %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic_calc_group_size
),
clocks_from_ticks
(
getticks
()
-
tic_calc_group_size
),
clocks_getunit
());
clocks_getunit
());
#ifdef WITH_MPI
#ifdef WITH_MPI
if
(
nr_nodes
>
1
)
{
if
(
nr_nodes
>
1
)
{
...
@@ -2613,12 +2613,13 @@ void fof_search_tree(struct fof_props *props,
...
@@ -2613,12 +2613,13 @@ void fof_search_tree(struct fof_props *props,
/* Search for group links across MPI domains. */
/* Search for group links across MPI domains. */
fof_search_foreign_cells
(
props
,
s
);
fof_search_foreign_cells
(
props
,
s
);
if
(
verbose
)
{
if
(
verbose
)
{
message
(
"fof_search_foreign_cells() took (FOF SCALING): %.3f %s."
,
message
(
"fof_search_foreign_cells() took (FOF SCALING): %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic_mpi
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
tic_mpi
),
clocks_getunit
());
message
(
message
(
"fof_search_foreign_cells() + calc_group_size took (FOF SCALING): %.3f "
"fof_search_foreign_cells() + calc_group_size took (FOF SCALING): "
"%.3f "
"%s."
,
"%s."
,
clocks_from_ticks
(
getticks
()
-
tic_total
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
tic_total
),
clocks_getunit
());
}
}
...
@@ -2656,13 +2657,14 @@ void fof_search_tree(struct fof_props *props,
...
@@ -2656,13 +2657,14 @@ void fof_search_tree(struct fof_props *props,
#endif
#endif
}
}
if
(
verbose
)
if
(
verbose
)
message
(
message
(
"Calculating the total no. of local groups took: (FOF SCALING): %.3f %s."
,
"Calculating the total no. of local groups took: (FOF SCALING): %.3f "
"%s."
,
clocks_from_ticks
(
getticks
()
-
tic_num_groups_calc
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
tic_num_groups_calc
),
clocks_getunit
());
/* Sort the groups in descending order based upon size and re-label their
IDs
/* Sort the groups in descending order based upon size and re-label their
*
0-num_groups. */
* IDs
0-num_groups. */
#ifndef WITHOUT_GROUP_PROPS
#ifndef WITHOUT_GROUP_PROPS
struct
group_length
*
high_group_sizes
=
NULL
;
struct
group_length
*
high_group_sizes
=
NULL
;
int
group_count
=
0
;
int
group_count
=
0
;
...
@@ -2695,10 +2697,10 @@ void fof_search_tree(struct fof_props *props,
...
@@ -2695,10 +2697,10 @@ void fof_search_tree(struct fof_props *props,
MPI_Allreduce
(
&
num_groups_local
,
&
num_groups
,
1
,
MPI_INT
,
MPI_SUM
,
MPI_Allreduce
(
&
num_groups_local
,
&
num_groups
,
1
,
MPI_INT
,
MPI_SUM
,
MPI_COMM_WORLD
);
MPI_COMM_WORLD
);
if
(
verbose
)
if
(
verbose
)
message
(
"Finding the total no. of groups took: (FOF SCALING): %.3f %s."
,
message
(
"Finding the total no. of groups took: (FOF SCALING): %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic_num_groups_calc
),
clocks_from_ticks
(
getticks
()
-
tic_num_groups_calc
),
clocks_getunit
());
clocks_getunit
());
#ifndef WITHOUT_GROUP_PROPS
#ifndef WITHOUT_GROUP_PROPS
MPI_Reduce
(
&
num_parts_in_groups_local
,
&
num_parts_in_groups
,
1
,
MPI_INT
,
MPI_Reduce
(
&
num_parts_in_groups_local
,
&
num_parts_in_groups
,
1
,
MPI_INT
,
...
@@ -2726,24 +2728,25 @@ void fof_search_tree(struct fof_props *props,
...
@@ -2726,24 +2728,25 @@ void fof_search_tree(struct fof_props *props,
const
size_t
num_groups_prev
=
(
size_t
)(
ngsum
-
nglocal
);
const
size_t
num_groups_prev
=
(
size_t
)(
ngsum
-
nglocal
);
#endif
/* WITH_MPI */
#endif
/* WITH_MPI */
if
(
verbose
)
if
(
verbose
)
message
(
"Finding the total no. of groups took: (FOF SCALING): %.3f %s."
,
message
(
"Finding the total no. of groups took: (FOF SCALING): %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic_num_groups_calc
),
clocks_from_ticks
(
getticks
()
-
tic_num_groups_calc
),
clocks_getunit
());
clocks_getunit
());
/* Sort local groups into descending order of size */
/* Sort local groups into descending order of size */
qsort
(
high_group_sizes
,
num_groups_local
,
sizeof
(
struct
group_length
),
qsort
(
high_group_sizes
,
num_groups_local
,
sizeof
(
struct
group_length
),
cmp_func_group_size
);
cmp_func_group_size
);
tic
=
getticks
();
tic
=
getticks
();
/* Set default group ID for all particles */
/* Set default group ID for all particles */
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_set_initial_group_id_mapper
,
s
->
gparts
,
threadpool_map
(
&
s
->
e
->
threadpool
,
fof_set_initial_group_id_mapper
,
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
(
void
*
)
&
group_id_default
);
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
0
,
(
void
*
)
&
group_id_default
);
if
(
verbose
)
if
(
verbose
)
message
(
"Setting default group ID took: %.3f %s."
,
message
(
"Setting default group ID took: %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
/* Assign final group IDs to local root particles where the global root is
/* Assign final group IDs to local root particles where the global root is
* on this node and the group is large enough. Within a node IDs are
* on this node and the group is large enough. Within a node IDs are
...
...
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