Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dkrz-sw
yaxt
Commits
436442ad
Commit
436442ad
authored
May 06, 2021
by
Thomas Jahns
🤸
Browse files
Combine allocations in xt_redist_agg_msg_count.
parent
da054436
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/xt_redist.c
View file @
436442ad
...
...
@@ -221,14 +221,28 @@ xt_redist_agg_msg_count(size_t num_redists, enum xt_msg_direction direction,
{
bool
ranks_left
=
false
;
/* get lists of ranks to send/receive message to/from */
size_t
num_ranks_total
=
0
;
for
(
size_t
j
=
0
;
j
<
num_redists
;
++
j
)
{
ranks
[
j
]
=
NULL
;
size_t
nranks
=
num_ranks
[
j
]
=
(
size_t
)
xt_redist_get_msg_ranks
(
redists
[
j
],
direction
,
ranks
+
j
);
ranks_left
|=
(
nranks
>
0
);
/* sort list */
xt_sort_int
(
ranks
[
j
],
nranks
);
size_t
redist_num_ranks
=
(
size_t
)(
redists
[
j
]
->
vtable
->
get_num_msg
(
redists
[
j
],
direction
));
num_ranks
[
j
]
=
redist_num_ranks
;
num_ranks_total
+=
redist_num_ranks
;
}
if
(
num_ranks_total
)
{
int
*
ranks_buf
=
xmalloc
(
num_ranks_total
*
sizeof
(
*
ranks_buf
));
size_t
ofs
=
0
;
for
(
size_t
j
=
0
;
j
<
num_redists
;
++
j
)
{
ranks
[
j
]
=
ranks_buf
+
ofs
;
size_t
nranks
=
(
size_t
)
xt_redist_get_msg_ranks
(
redists
[
j
],
direction
,
ranks
+
j
);
ranks_left
|=
(
nranks
>
0
);
/* sort list */
xt_sort_int
(
ranks
[
j
],
nranks
);
ofs
+=
nranks
;
}
}
else
for
(
size_t
j
=
0
;
j
<
num_redists
;
++
j
)
ranks
[
j
]
=
NULL
;
/* count number of different ranks to send/receive message to/from */
size_t
num_messages
=
ranks_left
?
xt_ranks_uniq_count
(
num_redists
,
num_ranks
,
(
const
int
*
const
*
)
ranks
)
...
...
src/xt_redist_collection.c
View file @
436442ad
...
...
@@ -182,8 +182,7 @@ static void align_component_dt(unsigned num_redists, unsigned nmsgs,
+=
(
rank_pos
[
j
]
<
num_ranks
[
j
]
&&
in_ranks
[
j
][
rank_pos
[
j
]]
==
min_rank
);
}
}
for
(
size_t
j
=
0
;
j
<
num_redists
;
++
j
)
free
(
in_ranks
[
j
]);
free
(
in_ranks
[
0
]);
}
/* not yet used cache entries are marked with -1 as first displacement,
...
...
src/xt_redist_collection_static.c
View file @
436442ad
...
...
@@ -113,8 +113,7 @@ generate_msg_infos(struct Xt_redist_msg ** msgs,
}
}
}
for
(
size_t
j
=
0
;
j
<
num_redists
;
++
j
)
free
(
ranks
[
j
]);
free
(
ranks
[
0
]);
*
msgs
=
p
;
return
num_messages
;
}
...
...
Write
Preview
Markdown
is supported
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