Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
yaxt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
dkrz-sw
yaxt
Commits
4fc6dbec
Commit
4fc6dbec
authored
3 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Remove no longer needed flexibility.
parent
e78d4ccd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/xt_exchanger.c
+22
-19
22 additions, 19 deletions
src/xt_exchanger.c
src/xt_exchanger.h
+1
-2
1 addition, 2 deletions
src/xt_exchanger.h
src/xt_exchanger_simple_base.c
+0
-2
0 additions, 2 deletions
src/xt_exchanger_simple_base.c
with
23 additions
and
23 deletions
src/xt_exchanger.c
+
22
−
19
View file @
4fc6dbec
...
...
@@ -80,14 +80,30 @@ void xt_exchanger_a_exchange(Xt_exchanger exchanger,
exchanger
->
vtable
->
a_exchange
(
exchanger
,
src_data
,
dst_data
,
request
);
}
static
int
compare_exchange_messages
(
const
void
*
msg_a
,
const
void
*
msg_b
)
static
inline
int
adjusted_rank
(
int
r
,
int
comm_rank
,
int
comm_size
)
{
int
rank_a
=
*
(
const
int
*
)
msg_a
;
int
rank_b
=
*
(
const
int
*
)
msg_b
;
return
(
rank_a
-
rank_b
);
return
r
+
(
r
<=
comm_rank
?
comm_size
:
0
);
}
void
xt_exchanger_internal_optimize
(
size_t
n
,
void
*
msgs
,
size_t
msg_type_size
,
#define XT_SORTFUNC_DECL static
#define SORT_TYPE struct Xt_redist_msg
#define SORT_TYPE_SUFFIX redist_msg
#define SORT_TYPE_CMP_LT(u,v,i,j) \
(adjusted_rank((u).rank, comm_rank, comm_size) \
< adjusted_rank((v).rank, comm_rank, comm_size))
#define SORT_TYPE_CMP_LE(u,v,i,j) \
(adjusted_rank((u).rank, comm_rank, comm_size) \
<= adjusted_rank((v).rank, comm_rank, comm_size))
#define SORT_TYPE_CMP_EQ(u,v,i,j) (((u).rank) == ((v).rank))
#define XT_SORT_EXTRA_ARGS_DECL , int comm_rank, int comm_size
#define XT_SORT_EXTRA_ARGS_PASS , comm_rank, comm_size
#define XT_SORT_VECSWAP_EXTRA_ARGS_DECL
#define XT_SORT_VECSWAP_EXTRA_ARGS_PASS
#include
"xt_quicksort_base.h"
void
xt_exchanger_internal_optimize
(
size_t
n
,
struct
Xt_redist_msg
*
msgs
,
MPI_Comm
comm
)
{
int
comm_size
,
comm_rank
,
is_inter
;
...
...
@@ -105,20 +121,7 @@ void xt_exchanger_internal_optimize(size_t n, void * msgs, size_t msg_type_size,
* 1. add comm_size(10): 9, 15, 12, 6, 11
* 2. sort: 6, 9, 11, 12, 15 -> final order: 6, 9, 1, 2, 5
*/
unsigned
char
*
msgs_
=
(
unsigned
char
*
)
msgs
;
/* apply offset for ranks <= comm_rank */
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
int
*
p
=
(
int
*
)(
void
*
)(
msgs_
+
i
*
msg_type_size
),
r
=
*
p
;
if
(
r
<=
comm_rank
)
*
p
=
r
+
comm_size
;
}
qsort
(
msgs
,
n
,
msg_type_size
,
compare_exchange_messages
);
/* undo offset */
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
int
*
p
=
(
int
*
)(
void
*
)(
msgs_
+
i
*
msg_type_size
),
r
=
*
p
;
if
(
r
>=
comm_size
)
*
p
=
r
-
comm_size
;
}
xt_quicksort_redist_msg
(
msgs
,
n
,
comm_rank
,
comm_size
);
}
...
...
This diff is collapsed.
Click to expand it.
src/xt_exchanger.h
+
1
−
2
View file @
4fc6dbec
...
...
@@ -116,12 +116,11 @@ void xt_exchanger_delete(Xt_exchanger);
* network congestion is potentially reduced.
* @param[in] n number of messages
* @param[in,out] msgs messages to be reordered
* @param[in] msg_type_size size of the elements in msgs
* @param[in] comm communicator associated to the messages
* @remark The first data element in the messages needs to be an integer
* containing the rank.
*/
void
xt_exchanger_internal_optimize
(
size_t
n
,
void
*
msgs
,
size_t
msg_type_size
,
void
xt_exchanger_internal_optimize
(
size_t
n
,
struct
Xt_redist_msg
*
msgs
,
MPI_Comm
comm
);
/**
...
...
This diff is collapsed.
Click to expand it.
src/xt_exchanger_simple_base.c
+
0
−
2
View file @
4fc6dbec
...
...
@@ -155,11 +155,9 @@ xt_exchanger_simple_base_new(int nsend, int nrecv,
exchanger
->
a_func
=
a_func
;
xt_exchanger_internal_optimize
((
size_t
)
nsend
,
exchanger
->
msgs
,
sizeof
(
exchanger
->
msgs
[
0
]),
comm
);
xt_exchanger_internal_optimize
((
size_t
)
nrecv
,
exchanger
->
msgs
+
nsend
,
sizeof
(
exchanger
->
msgs
[
0
]),
comm
);
return
(
Xt_exchanger
)
exchanger
;
...
...
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