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
9e0d044a
Commit
9e0d044a
authored
Feb 11, 2020
by
Matthieu Schaller
Browse files
Applied code formatting tool
parent
11921d5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
9e0d044a
...
...
@@ -421,15 +421,15 @@ static void dumpCells_map(struct cell *c, void *data) {
for
(
int
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
if
(
tasks
[
k
].
cj
==
NULL
)
{
if
(
tasks
[
k
].
ci
!=
NULL
)
{
if
(
c
==
tasks
[
k
].
ci
||
c
==
tasks
[
k
].
ci
->
super
)
{
if
(
c
==
tasks
[
k
].
ci
||
c
==
tasks
[
k
].
ci
->
super
)
{
ntasks
=
ntasks
+
1
.
0
f
;
ticsum
+=
(
tasks
[
k
].
toc
-
tasks
[
k
].
tic
);
dsum
+=
tasks
[
k
].
ci
->
depth
;
}
}
}
else
{
if
(
c
==
tasks
[
k
].
ci
||
c
==
tasks
[
k
].
ci
->
super
||
c
==
tasks
[
k
].
cj
||
c
==
tasks
[
k
].
cj
->
super
)
{
if
(
c
==
tasks
[
k
].
ci
||
c
==
tasks
[
k
].
ci
->
super
||
c
==
tasks
[
k
].
cj
||
c
==
tasks
[
k
].
cj
->
super
)
{
ntasks
=
ntasks
+
0
.
5
f
;
ticsum
+=
0
.
5
*
(
tasks
[
k
].
toc
-
tasks
[
k
].
tic
);
if
(
tasks
[
k
].
ci
!=
NULL
)
dsum
+=
(
tasks
[
k
].
ci
->
depth
*
0
.
5
);
...
...
@@ -453,15 +453,16 @@ static void dumpCells_map(struct cell *c, void *data) {
if
(
spart_is_active
(
&
sparts
[
k
],
e
))
pactcount
++
;
}
fprintf
(
file
,
" %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6d %6d %6d %6d %6d %6d %6d "
"%6.1f %20lld %6d %6d %6d %6d %6d %6d %6d %f %f
\n
"
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
],
c
->
width
[
0
],
c
->
width
[
1
],
c
->
width
[
2
],
e
->
step
,
c
->
hydro
.
count
,
c
->
grav
.
count
,
c
->
stars
.
count
,
pactcount
,
c
->
depth
,
c
->
maxdepth
,
ntasks
,
c
->
hydro
.
ti_end_min
,
get_time_bin
(
c
->
hydro
.
ti_end_min
),
(
c
->
super
==
c
),
(
c
->
parent
==
NULL
),
cell_is_active_hydro
(
c
,
e
),
c
->
nodeID
,
c
->
nodeID
==
e
->
nodeID
,
ismpiactive
,
ticsum
,
dsum
);
fprintf
(
file
,
" %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6d %6d %6d %6d %6d %6d %6d "
"%6.1f %20lld %6d %6d %6d %6d %6d %6d %6d %f %f
\n
"
,
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
],
c
->
width
[
0
],
c
->
width
[
1
],
c
->
width
[
2
],
e
->
step
,
c
->
hydro
.
count
,
c
->
grav
.
count
,
c
->
stars
.
count
,
pactcount
,
c
->
depth
,
c
->
maxdepth
,
ntasks
,
c
->
hydro
.
ti_end_min
,
get_time_bin
(
c
->
hydro
.
ti_end_min
),
(
c
->
super
==
c
),
(
c
->
parent
==
NULL
),
cell_is_active_hydro
(
c
,
e
),
c
->
nodeID
,
c
->
nodeID
==
e
->
nodeID
,
ismpiactive
,
ticsum
,
dsum
);
}
}
}
...
...
@@ -496,8 +497,9 @@ void dumpCells(const char *prefix, int super, int active, int mpiactive,
"# %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s "
"%20s %6s %6s %6s %6s %6s %6s %6s %6s %6s
\n
"
,
"x"
,
"y"
,
"z"
,
"xw"
,
"yw"
,
"zw"
,
"step"
,
"count"
,
"gcount"
,
"scount"
,
"actcount"
,
"depth"
,
"maxdepth"
,
"tasks"
,
"ti_end_min"
,
"timebin"
,
"issuper"
,
"istop"
,
"active"
,
"rank"
,
"local"
,
"mpiactive"
,
"ticsum"
,
"avedepth"
);
"actcount"
,
"depth"
,
"maxdepth"
,
"tasks"
,
"ti_end_min"
,
"timebin"
,
"issuper"
,
"istop"
,
"active"
,
"rank"
,
"local"
,
"mpiactive"
,
"ticsum"
,
"avedepth"
);
size_t
data
[
6
];
data
[
0
]
=
(
size_t
)
file
;
...
...
src/partition.c
View file @
9e0d044a
...
...
@@ -439,9 +439,9 @@ static void accumulate_sizes(struct space *s, int verbose, double *counts) {
mapper_data
.
counts
=
gcounts
;
mapper_data
.
size
=
gsize
;
threadpool_map
(
&
s
->
e
->
threadpool
,
accumulate_sizes_mapper_gpart
,
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
space_splitsize
,
&
mapper_data
);
threadpool_map
(
&
s
->
e
->
threadpool
,
accumulate_sizes_mapper_gpart
,
s
->
gparts
,
s
->
nr_gparts
,
sizeof
(
struct
gpart
),
space_splitsize
,
&
mapper_data
);
/* Get all the counts from all the nodes. */
if
(
MPI_Allreduce
(
MPI_IN_PLACE
,
gcounts
,
s
->
nr_cells
,
MPI_DOUBLE
,
MPI_SUM
,
...
...
@@ -464,13 +464,12 @@ static void accumulate_sizes(struct space *s, int verbose, double *counts) {
/* And clip. */
int
nadj
=
0
;
double
clip
=
*
ptrs
[
cut
];
double
clip
=
*
ptrs
[
cut
];
for
(
int
k
=
cut
+
1
;
k
<
s
->
nr_cells
;
k
++
)
{
*
ptrs
[
k
]
=
clip
;
nadj
++
;
}
if
(
verbose
)
message
(
"clipped gravity part counts of %d cells"
,
nadj
);
if
(
verbose
)
message
(
"clipped gravity part counts of %d cells"
,
nadj
);
free
(
ptrs
);
}
...
...
@@ -1512,8 +1511,8 @@ static void partition_gather_weights(void *map_data, int num_elements,
}
else
{
/* Add weights from task costs to the edge. */
atomic_add_d
(
&
weights_e
[
ik
],
w
);
atomic_add_d
(
&
weights_e
[
jk
],
w
);
atomic_add_d
(
&
weights_e
[
ik
],
w
);
atomic_add_d
(
&
weights_e
[
jk
],
w
);
}
}
}
...
...
@@ -1961,7 +1960,8 @@ void partition_initial_partition(struct partition *initial_partition,
if
((
weights_v
=
(
double
*
)
malloc
(
sizeof
(
double
)
*
s
->
nr_cells
))
==
NULL
)
error
(
"Failed to allocate weights_v buffer."
);
if
((
weights_e
=
(
double
*
)
malloc
(
sizeof
(
double
)
*
s
->
nr_cells
*
26
))
==
NULL
)
if
((
weights_e
=
(
double
*
)
malloc
(
sizeof
(
double
)
*
s
->
nr_cells
*
26
))
==
NULL
)
error
(
"Failed to allocate weights_e buffer."
);
/* Check each particle and accumulate the sizes per cell. */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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