[mpich-discuss] MPI_Waitsome and MPI_Getcount incorrect

Tamás Faragó fafarago at gmail.com
Mon Dec 28 03:55:51 CST 2009


Sorry for the late reply but I was out of the country for a week. I am
using MPICH2 1.2.1 on a WinXP SP3 machine running an Intel Core i5
CPU. This is the output I get when running the application (mpiexec -n
2 -l test3.exe)

[1]client before: a 0, b 0
[0]host: a 1, b 2
[0]done, waiting....
[1]received count: 1
[1]MPI_Waitsome index 0
[1]MPI_GET_COUNT 1
[1]received count: 1
[1]MPI_Waitsome index 1
[1]MPI_GET_COUNT -32766
[1]client after: a 1, b 2
[1]done, waiting....
[0]finalize
[1]finalize

On 22/12/2009, Rajeev Thakur <thakur at mcs.anl.gov> wrote:
> I am not able to reproduce this problem when running MPICH2 1.2.1 with 2
> processes on a single machine.
>
> Rajeev
>
>> -----Original Message-----
>> From: mpich-discuss-bounces at mcs.anl.gov
>> [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of Tamás Faragó
>> Sent: Wednesday, December 16, 2009 7:48 AM
>> To: mpich-discuss at mcs.anl.gov
>> Subject: [mpich-discuss] MPI_Waitsome and MPI_Getcount incorrect
>>
>> My actual problem, why I initiated the previous post at
>> http://lists.mcs.anl.gov/pipermail/mpich-discuss/2009-December
>> /006187.html
>> ([mpich-discuss] MPI_GET_COUNT behaviour unclear).
>>
>> See the very simple source code below. I initialise two
>> persistent requests, then run a Waitsome on both of them and
>> getting the top-level datatypes received. With Waitsome the
>> second one returns MPI_UNDEFINED, no idea why. Waitall
>> correctly returns 1 in both cases.
>> What is going on, is it my fault and can it be solved?
>>
>> I have also uploaded the source code to
>> http://www.liacs.nl/~tfarago/test.cpp
>> NOTE: right now the tags are all the same, but even if
>> different tags are given to the sending and receiving side
>> (eg 0 and 1), the outcoume is the same. From the output it
>> can be seen that even if MPI_GET_COUNT returns some kind of
>> an error the program's behaviour is still correct.
>> NOTE: also, strangely I cannot get Waitsome to return both
>> completed requests, not even if I let the client sleep/idle
>> for several seconds.
>>
>> ---CODE--
>> #include <stdarg.h>
>> #include <stdio.h>
>> #include <mpi.h>
>>
>> #pragma comment(lib, "cxx.lib")
>> #pragma comment(lib, "mpi.lib")
>>
>> void __cdecl debug(const char* msg, ...) {
>> 	va_list va;
>> 	va_start(va, msg);
>> 	vfprintf(stderr, msg, va);
>> 	fputs("\n", stderr);
>> 	fflush(stderr);
>> }
>>
>> int main() {
>> 	MPI::Init();
>> 	int my_node = MPI::COMM_WORLD.Get_rank();
>>
>> 	int a, b;
>> 	MPI::Prequest req[2];
>> 	a = 0; b = 0;
>> 	if (my_node == 0) {
>> 		a = 1; b = 2;
>> 		req[0] = MPI::COMM_WORLD.Send_init(&a, 1,
>> MPI::INT, 1, 0);
>> 		req[1] = MPI::COMM_WORLD.Send_init(&b, 1,
>> MPI::INT, 1, 0);
>> 	} else {
>> 		size_t size = MPI::INT.Pack_size(1, MPI::COMM_WORLD);
>>
>> 		req[0] = MPI::COMM_WORLD.Recv_init(&a, size,
>> MPI::INT, 0, MPI::ANY_TAG);
>> 		req[1] = MPI::COMM_WORLD.Recv_init(&b, size,
>> MPI::INT, 0, MPI::ANY_TAG);	
>> 	}
>>
>> 	MPI::Prequest::Startall(2, req);
>>
>> 	if (my_node == 0) {
>> 		debug("host: a %d, b %d", a, b);
>> 	} else {
>> 		debug("client before: a %d, b %d", a, b);
>> 		int array_of_indeces[2];
>> 		MPI::Status array_of_statuses[2];
>> 		MPI::Datatype array_of_types[2];
>> 		array_of_types[0] = MPI::INT;
>> 		array_of_types[1] = MPI::INT;
>> #if 1
>> 		for (;;) {
>> 			/* wait for one, or multiple requests
>> to finish */
>> 			int outcount =
>> MPI::Request::Waitsome(2, req, array_of_indeces, array_of_statuses);
>> 			if (outcount == MPI_UNDEFINED) break;
>> /* no active handles */
>>
>> 			debug("received count: %d", outcount);
>> 			for (outcount--; outcount >= 0; --outcount) {
>> 				size_t index =
>> array_of_indeces[outcount];
>>
>> 				debug("MPI_Waitsome index %d", index);
>> 				int recv_count =
>> array_of_statuses[index].Get_count(array_of_types[index]);
>> 				debug("MPI_GET_COUNT %d", recv_count);
>> 			}
>> 		}
>> #else
>> 		MPI::Prequest::Waitall(2, req, array_of_statuses);
>>
>> 		for (int outcount = 2; outcount > 0; --outcount) {
>> 			int recv_count =
>> array_of_statuses[outcount-1].Get_count(array_of_types[outcount-1]);
>> 			debug("MPI_GET_COUNT %d", recv_count);
>> 		}
>> #endif
>> 		debug("client after: a %d, b %d", a, b);
>> 	}
>>
>> 	debug("done, waiting....");
>> 	MPI::COMM_WORLD.Barrier();
>> 	debug("finalize");
>> 	MPI::Finalize();
>> 	return 0;
>> }
>> ---CODE---
>
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>


More information about the mpich-discuss mailing list