100 likes | 198 Views
Problems with M things. Review: NULL MPI handles. All MPI_*_NULL are handles to invalid MPI objects MPI_REQUEST_NULL is an exception Calling MPI_TEST/MPI_WAIT with REQUEST_NULL results in the “empty” status status.MPI_SOURCE = MPI_ANY_SOURCE s tatus.MPI_TAG = MPI_ANY_TAG
E N D
Review: NULL MPI handles • All MPI_*_NULL are handles to invalid MPI objects • MPI_REQUEST_NULL is an exception • Calling MPI_TEST/MPI_WAIT with REQUEST_NULL results in the “empty” status • status.MPI_SOURCE = MPI_ANY_SOURCE • status.MPI_TAG = MPI_ANY_TAG • status count = zero • …otherwise the ANY/SOME array-based TEST/WAIT functions would be kind of a disaster
Review: PROC_NULL behavior • Call MPI_RECV with MPI_PROC_NULL • Get “PROC_NULL status” • Same as “empty status”, but with MPI_SOURCE=MPI_PROC_NULL • Call MPI_IRECV with MPI_PROC_NULL • Get “PROC_NULL” status • (…as expected)
MPI_MESSAGE_NULL: MRECV • Defining PROC_NULL behavior with MPROBE • MPI-3 allows calling MPI_[I]MRECV with MPI_MESSAGE_NULL • You get “PROC_NULL” status back MPI_MPROBE(MPI_PROC_NULL, …, &msg, …) Get msg=MPI_MESSAGE_NULL MPI_MRECV(…, &msg, &status) Get status=“PROC_NULL” status
MPI_MESSAGE_NULL: MRECV ✔ • Defining PROC_NULL behavior with MPROBE • MPI-3 allows calling MPI_[I]MRECV with MPI_MESSAGE_NULL • You get “PROC_NULL” status back MPI_MPROBE(MPI_PROC_NULL, …, &msg, …) Get msg=MPI_MESSAGE_NULL ✖ MPI_MRECV(…, &msg, &status) We’re calling MPI_MRECV with an invalid message! ✔ Get status=“PROC_NULL” status
MPI_MESSAGE_NULL: IMRECV • Defining PROC_NULL behavior with MPROBE • MPI-3 allows calling MPI_[I]MRECV with MPI_MESSAGE_NULL • You get “PROC_NULL” status back MPI_MPROBE(MPI_PROC_NULL, …, &msg, …) Get msg=MPI_MESSAGE_NULL MPI_IMRECV(…, &msg, &req) MPI_WAIT(&req, &status) Get status=“PROC_NULL” status
MPI_MESSAGE_NULL: IMRECV ✔ • Defining PROC_NULL behavior with MPROBE • MPI-3 allows calling MPI_[I]MRECV with MPI_MESSAGE_NULL • You get “PROC_NULL” status back MPI_MPROBE(MPI_PROC_NULL, …, &msg, …) Get msg=MPI_MESSAGE_NULL ✖ MPI_IMRECV(…, &msg, &req) MPI_WAIT(&req, &status) We’re calling MPI_IMRECV with an invalid message! ✔ Get status=“PROC_NULL” status
The Problem • Overloading MPI_MESSAGE_NULL: • Invalid message, and • MPI_PROC_NULL message • FAIL
Solution: MPI_MESSAGE_NO_PROC • When [I]MPROBE with PROC_NULL • Get msg = MPI_MESSAGE_NO_PROC MPI_MPROBE(MPI_PROC_NULL, …, &msg, …) Get msg=MPI_MESSAGE_NO_PROC MPI_MRECV(…, &msg, &status) Set msg=MPI_MESSAGE_NULL Get status=“PROC_NULL” status
Rationale • Consistency: MPI_*_NULL are invalid handles • Can avoid calling MPI_MRECV (or MPI_IMRECV) if desired • Same solution applies to both MRECV and IMRECV • Alternate names: • MPI_MESSAGE_PROC_NULL (BAD) MPI_MPROBE(MPI_PROC_NULL, …, &msg, …) Get msg=MPI_MESSAGE_NO_PROC MPI_MRECV(…, &msg, &status) Set msg=MPI_MESSAGE_NULL Get status=“PROC_NULL” status