[mpiwg-sessions] [EXTERNAL] Question on MPI_THREAD_FUNNELED

Martin Schulz schulzm at in.tum.de
Thu Feb 18 16:04:47 CST 2021

Hi Dan,


I agree – single has a good reason and I think would be fine – in this case the clause that the first init anywhere may dictate thread mode anymore else would indicate to other session inits later on that only single is now supported.


I am wondering about serialized and funneled, though: for funneled, it kind of leads to a requirement that session_init can only be called on the same thread again. If not, it should actually fail, as nothing else makes sense (if two session inits on different threads return funneled). For serialized, it requires threads know of each other so they can synchronize, which is against what we wanted to achieve.


I actually only see three options (perhaps there are more):
We actually deprecate funneled and serialized
We don’t deprecate, but state that they should no longer be returned in the session model
We isolate sessions against each other

In the latter case, returning thread funneled means that MPI calls associated with objects derived from that session have to be called from that thread. For serialized it would disallow two MPI calls at the same time from two threads, if they both use an object derived from the same session. Across sessions there would be no restrictions.


I kind of like the latter one, as it goes with the spirit of session, but I wonder what implementers say to that.







Prof. Dr. Martin Schulz, Chair of Computer Architecture and Parallel Systems
Department of Informatics, TU-Munich, Boltzmannstraße 3, D-85748 Garching
Member of the Board of Directors at the Leibniz Supercomputing Centre (LRZ)
Email: schulzm at in.tum.de




From: mpiwg-sessions <mpiwg-sessions-bounces at lists.mpi-forum.org> on behalf of Dan Holmes via mpiwg-sessions <mpiwg-sessions at lists.mpi-forum.org>
Reply-To: MPI Sessions working group <mpiwg-sessions at lists.mpi-forum.org>
Date: Thursday, 18. February 2021 at 21:07
To: mpiwg-sessions <mpiwg-sessions at lists.mpi-forum.org>
Cc: Dan Holmes <danholmes at chi.scot>
Subject: [mpiwg-sessions] [EXTERNAL] Question on MPI_THREAD_FUNNELED


Hi Martin, 


This is an interesting argument for disallowing use of MPI_THREAD_SINGLE and MPI_THREAD_FUNNELED with the sessions model (and with the world model in combination with the sessions model).


Modern MPI libraries effectively only have MPI_THREAD_SERIALIZED and MPI_THREAD_MULTIPLE anyway.


However, a single thread could create a bunch of sessions and initialise the world model and comply with MPI_THREAD_SINGLE and/or MPI_THREAD_FUNNELED.


Two libraries might be called by a single thread and thereby be thread compliant.


So, prohibiting these thread support levels seems too severe.

Library writers need to document the restrictions they place on the main application and all the other libraries that it uses. If a library tells MPI it will only use a particular thread then the caller into that library must comply, etc.

An MPI library is free to upgrade later (if it is capable of that) without telling already-initialised sessions (because superset) - except for MPI_THREAD_SINGLE (there can be only one). It is also free to return a lower provided than the requested.

The only problem occurs if two distinct threads ask for MPI_THREAD_FUNNELED concurrently and MPI provides MPI_THREAD_FUNNELED to one of them but is not able to upgrade internally - it is then stuck for when the second thread makes its request.

One of the main points of the isolation between threads was that no cross-session protection was needed. Thus, session S1 funnelled onto thread T1 and S2 funnelled onto T2 should be easy to implement, even though that scenario is not currently possible with MPI-3.1 and no-one has actually coded it yet.




Dr Daniel Holmes PhD

Executive Director
Chief Technology Officer


danholmes at chi.scot

Hi Howard,
>>    I recall we decided to leave the behavior of thread support level when using multiple sessions/world model up to the implementation.   However, in the case of MPI_THREAD_FUNNELED we should probably add a blurb about not doing this in the advice to users in the Session Creation and Destruction Methods.
I think the problem also appears if the original MPI_Init_thread uses FUNNELED. We probably need to add something there as well.
>>    My first guess based on the openmpi prototype is that if one session is initialized with funneled, then all subsequent created sessions or mpi init thread will be supported at funnel level.  
That kind of makes sense - but what happens if the second Session_Init is then on another thread? The funneled refers to a different thread.
>>    For your thread serialized question I would say the answer is no, unless under the covers the implementation is always working in effectively thread multiple mode.
Hmm, I understand the motivation and implementation implications, but this would kill the isolation then, which is also not good. Also, if two libraries have separate sessions, it is often not even possible to avoid this.
Almost seems like we should deprecate funneled and serialized.
Another item to cover next Monday __.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpiwg-sessions/attachments/20210218/f29cfa3c/attachment-0001.html>

More information about the mpiwg-sessions mailing list