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
6fba1f29
Commit
6fba1f29
authored
3 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Integrate refactored support function with only caller.
parent
9983926d
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
+0
-45
0 additions, 45 deletions
src/xt_exchanger.c
src/xt_exchanger.h
+0
-13
0 additions, 13 deletions
src/xt_exchanger.h
src/xt_exchanger_simple_base.c
+47
-5
47 additions, 5 deletions
src/xt_exchanger_simple_base.c
with
47 additions
and
63 deletions
src/xt_exchanger.c
+
0
−
45
View file @
6fba1f29
...
...
@@ -80,51 +80,6 @@ void xt_exchanger_a_exchange(Xt_exchanger exchanger,
exchanger
->
vtable
->
a_exchange
(
exchanger
,
src_data
,
dst_data
,
request
);
}
static
inline
int
adjusted_rank
(
int
r
,
int
comm_rank
,
int
comm_size
)
{
return
r
+
(
r
<=
comm_rank
?
comm_size
:
0
);
}
#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
;
xt_mpi_call
(
MPI_Comm_rank
(
comm
,
&
comm_rank
),
comm
);
xt_mpi_call
(
MPI_Comm_test_inter
(
comm
,
&
is_inter
),
comm
);
int
(
*
get_comm_size
)(
MPI_Comm
,
int
*
)
=
is_inter
?
MPI_Comm_remote_size
:
MPI_Comm_size
;
xt_mpi_call
(
get_comm_size
(
comm
,
&
comm_size
),
comm
);
/* In order to avoid congestion of messages, the order of send and receive
* messages is changed. This is done by sorting the messages according to the
* rank of the respective message partner. Before the sorting to ranks that
* are smaller or equal to the local rank the size of the communicator is
* added.
* example: process 5 is supposed to communicate with processes: 9, 5, 2, 6, 1
* 1. add comm_size(10): 9, 15, 12, 6, 11
* 2. sort: 6, 9, 11, 12, 15 -> final order: 6, 9, 1, 2, 5
*/
xt_quicksort_redist_msg
(
msgs
,
n
,
comm_rank
,
comm_size
);
}
int
xt_exchanger_get_msg_ranks
(
Xt_exchanger
exchanger
,
enum
xt_msg_direction
direction
,
...
...
This diff is collapsed.
Click to expand it.
src/xt_exchanger.h
+
0
−
13
View file @
6fba1f29
...
...
@@ -116,19 +116,6 @@ xt_exchanger_copy(Xt_exchanger orig, MPI_Comm new_comm, int new_tag_offset);
PPM_DSO_INTERNAL
void
xt_exchanger_delete
(
Xt_exchanger
);
/**
* Support routine, that reorders a number of provided messages, such that
* network congestion is potentially reduced.
* @param[in] n number of messages
* @param[in,out] msgs messages to be reordered
* @param[in] comm communicator associated to the messages
* @remark The first data element in the messages needs to be an integer
* containing the rank.
*/
PPM_DSO_INTERNAL
void
xt_exchanger_internal_optimize
(
size_t
n
,
struct
Xt_redist_msg
*
msgs
,
MPI_Comm
comm
);
/**
* gets a copy of the MPI_Datatype used for a specificed message
* @param[in] exchanger exchanger object
...
...
This diff is collapsed.
Click to expand it.
src/xt_exchanger_simple_base.c
+
47
−
5
View file @
6fba1f29
...
...
@@ -117,6 +117,29 @@ xt_exchanger_simple_base_alloc(size_t nmsg)
return
exchanger
;
}
static
inline
int
adjusted_rank
(
int
r
,
int
comm_rank
,
int
comm_size
)
{
return
r
+
(
r
<=
comm_rank
?
comm_size
:
0
);
}
#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"
Xt_exchanger
xt_exchanger_simple_base_new
(
int
nsend
,
int
nrecv
,
const
struct
Xt_redist_msg
*
send_msgs
,
...
...
@@ -154,11 +177,30 @@ xt_exchanger_simple_base_new(int nsend, int nrecv,
exchanger
->
s_func
=
s_func
;
exchanger
->
a_func
=
a_func
;
xt_exchanger_internal_optimize
((
size_t
)
nsend
,
exchanger
->
msgs
,
comm
);
xt_exchanger_internal_optimize
((
size_t
)
nrecv
,
exchanger
->
msgs
+
nsend
,
comm
);
{
int
comm_size
,
comm_rank
,
is_inter
;
xt_mpi_call
(
MPI_Comm_rank
(
comm
,
&
comm_rank
),
comm
);
xt_mpi_call
(
MPI_Comm_test_inter
(
comm
,
&
is_inter
),
comm
);
int
(
*
get_comm_size
)(
MPI_Comm
,
int
*
)
=
is_inter
?
MPI_Comm_remote_size
:
MPI_Comm_size
;
xt_mpi_call
(
get_comm_size
(
comm
,
&
comm_size
),
comm
);
/* In order to avoid congestion of messages, the order of send and
* receive messages is changed. This is done by sorting the
* messages according to the rank of the respective message
* partner. Before the sorting to ranks that are smaller or equal
* to the local rank the size of the communicator is added.
*
* example: process 5 is supposed to communicate with
* processes: 9, 5, 2, 6, 1
* 1. add comm_size(10): 9, 15, 12, 6, 11
* 2. sort: 6, 9, 11, 12, 15
* 3. subtrace comm_size again -> final order: 6, 9, 1, 2, 5
*/
xt_quicksort_redist_msg
(
exchanger
->
msgs
,
(
size_t
)
nsend
,
comm_rank
,
comm_size
);
xt_quicksort_redist_msg
(
exchanger
->
msgs
+
(
size_t
)
nsend
,
(
size_t
)
nrecv
,
comm_rank
,
comm_size
);
}
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