Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Weinzierl
teaMPI
Commits
181d99f2
Commit
181d99f2
authored
Dec 04, 2019
by
Philipp Samfaß
Browse files
adapted rank mapping
parent
7b418034
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/Rank.cpp
View file @
181d99f2
...
...
@@ -180,6 +180,21 @@ int mapTeamToWorldRank(int rank, int r) {
return
rank
+
r
*
getTeamSize
();
}
int
translateRank
(
MPI_Comm
srcComm
,
int
srcRank
,
MPI_Comm
destComm
)
{
MPI_Group
srcCommGroup
,
destCommGroup
;
int
result
;
MPI_Comm_group
(
srcComm
,
&
srcCommGroup
);
MPI_Comm_group
(
destComm
,
&
destCommGroup
);
MPI_Group_translate_ranks
(
srcCommGroup
,
1
,
&
srcRank
,
destCommGroup
,
&
result
);
return
result
;
}
int
mapToWorldRank
(
int
rank
,
MPI_Comm
comm
)
{
return
translateRank
(
rank
,
comm
,
MPI_COMM_WORLD
);
}
void
remapStatus
(
MPI_Status
*
status
)
{
if
((
status
!=
MPI_STATUS_IGNORE
)
&&
(
status
!=
MPI_STATUSES_IGNORE
))
{
status
->
MPI_SOURCE
=
mapWorldToTeamRank
(
status
->
MPI_SOURCE
);
...
...
lib/Rank.h
View file @
181d99f2
...
...
@@ -84,6 +84,10 @@ int mapWorldToTeamRank(int rank);
int
mapTeamToWorldRank
(
int
rank
,
int
r
);
int
translateRank
(
int
srcRank
,
MPI_Comm
srcComm
,
MPI_Comm
destComm
);
int
mapToWorldRank
(
int
rank
,
MPI_Comm
comm
);
/* Alters the MPI_SOURCE member of MPI_Status to 0 <= r < team size */
void
remapStatus
(
MPI_Status
*
status
);
...
...
lib/Wrapper.cpp
View file @
181d99f2
...
...
@@ -43,6 +43,16 @@ int MPI_Is_thread_main(int* flag) {
return
MPI_SUCCESS
;
}
int
MPI_Comm_split
(
MPI_Comm
comm
,
int
color
,
int
key
,
MPI_Comm
*
newcomm
)
{
if
(
comm
==
MPI_COMM_WORLD
)
#ifdef USE_MPI_OFFLOADING
PMPI_Comm_split
(
_comm
,
color
,
key
,
newcomm
);
#else
PMPI_Comm_split
(
comm
,
color
,
key
,
newcomm
);
#endif
return
MPI_SUCCESS
;
}
int
MPI_Comm_rank
(
MPI_Comm
comm
,
int
*
rank
)
{
// todo: assert that a team comm is used
//assert(comm == MPI_COMM_WORLD);
...
...
@@ -221,17 +231,17 @@ int MPI_Iprobe_offload(int source, int tag, MPI_Comm comm, int *flag, MPI_Status
int
MPI_Send_offload
(
const
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
int
dest
,
int
tag
,
MPI_Comm
comm
)
{
#if COMMUNICATION_MODE==0
return
ompi_send_offload_p2p
(
buf
,
count
,
datatype
,
mapT
eamT
oWorldRank
(
dest
,
getTeam
()
),
tag
,
comm
);
return
ompi_send_offload_p2p
(
buf
,
count
,
datatype
,
mapToWorldRank
(
dest
,
comm
),
tag
,
comm
);
#elif COMMUNICATION_MODE==1
return
ompi_send_offload_rma
(
buf
,
count
,
datatype
,
mapT
eamT
oWorldRank
(
dest
,
getTeam
()
),
tag
,
comm
);
return
ompi_send_offload_rma
(
buf
,
count
,
datatype
,
mapToWorldRank
(
dest
,
comm
),
tag
,
comm
);
#endif
}
int
MPI_Recv_offload
(
void
*
buf
,
int
count
,
MPI_Datatype
datatype
,
int
source
,
int
tag
,
MPI_Comm
comm
,
MPI_Status_Offload
*
stat
)
{
#if COMMUNICATION_MODE==0
return
ompi_recv_offload_p2p
(
buf
,
count
,
datatype
,
mapT
eamT
oWorldRank
(
source
,
getTeam
()
),
tag
,
comm
,
stat
);
return
ompi_recv_offload_p2p
(
buf
,
count
,
datatype
,
mapToWorldRank
(
source
,
comm
),
tag
,
comm
,
stat
);
#elif COMMUNICATION_MODE==1
return
ompi_recv_offload_rma
(
buf
,
count
,
datatype
,
mapT
eamT
oWorldRank
(
source
,
getTeam
()
),
tag
,
comm
,
stat
);
return
ompi_recv_offload_rma
(
buf
,
count
,
datatype
,
mapToWorldRank
(
source
,
comm
),
tag
,
comm
,
stat
);
#endif
}
...
...
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