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
Rob Latham
MPICH-BlueGene
Commits
46d23b76
Commit
46d23b76
authored
Nov 29, 2012
by
Pavan Balaji
Browse files
[svn-r10689] Updated the comm_split_type test to respect MPI_UNDEFINED.
Reviewed by goodell.
parent
0ff102e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/mpi/comm/cmsplit_type.c
View file @
46d23b76
...
...
@@ -24,15 +24,35 @@ int main(int argc, char *argv[])
verbose
=
1
;
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
wrank
);
MPI_Comm_split_type
(
MPI_COMM_WORLD
,
MPI_COMM_TYPE_SHARED
,
0
,
MPI_INFO_NULL
,
&
comm
);
MPI_Comm_rank
(
comm
,
&
rank
);
MPI_Comm_size
(
comm
,
&
size
);
if
(
rank
==
0
&&
verbose
)
printf
(
"Created subcommunicator of size %d
\n
"
,
size
);
/* Check to see if MPI_COMM_TYPE_SHARED works correctly */
MPI_Comm_split_type
(
MPI_COMM_WORLD
,
MPI_COMM_TYPE_SHARED
,
0
,
MPI_INFO_NULL
,
&
comm
);
if
(
comm
==
MPI_COMM_NULL
)
printf
(
"Expected a non-null communicator, but got MPI_COMM_NULL
\n
"
);
else
{
MPI_Comm_rank
(
comm
,
&
rank
);
MPI_Comm_size
(
comm
,
&
size
);
if
(
rank
==
0
&&
verbose
)
printf
(
"Created subcommunicator of size %d
\n
"
,
size
);
MPI_Comm_free
(
&
comm
);
}
MPI_Comm_free
(
&
comm
);
/* Check to see if MPI_UNDEFINED is respected */
MPI_Comm_split_type
(
MPI_COMM_WORLD
,
(
wrank
%
2
==
0
)
?
MPI_COMM_TYPE_SHARED
:
MPI_UNDEFINED
,
0
,
MPI_INFO_NULL
,
&
comm
);
if
((
wrank
%
2
)
&&
(
comm
!=
MPI_COMM_NULL
))
printf
(
"Expected MPI_COMM_NULL, but did not get one
\n
"
);
if
(
wrank
%
2
==
0
)
{
if
(
comm
==
MPI_COMM_NULL
)
printf
(
"Expected a non-null communicator, but got MPI_COMM_NULL
\n
"
);
else
{
MPI_Comm_rank
(
comm
,
&
rank
);
MPI_Comm_size
(
comm
,
&
size
);
if
(
rank
==
0
&&
verbose
)
printf
(
"Created subcommunicator of size %d
\n
"
,
size
);
MPI_Comm_free
(
&
comm
);
}
}
/* Use wrank because Comm_split_type may return more than one communicator
across the job, and if so, each will have a rank 0 entry. Test
...
...
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