<html> 
 <head></head> 
 <body> <span style="font-family:sans-serif">Hi Martin,</span> 
  <br> 
  <br> <span style="font-family:sans-serif">Your third option, isolation, is (and has been for years) the intent of sessions.</span> 
  <br> 
  <br> <span style="font-family:sans-serif">Cheers,</span> 
  <br> <span style="font-family:sans-serif">Dan.</span> 
  <br> 
  <div> 
   <br> 
   <p>18 Feb 2021 22:04:51 Martin Schulz <schulzm@in.tum.de>:</p> 
   <blockquote lang="en-DE" link="blue" vlink="purple" style="word-wrap:break-word"> 
    <div class="WordSection1" style="page: WordSection1"> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style="">Hi Dan,</span></p> 
     <p style=""></p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style="">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.</span></p> 
     <p style=""></p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style="">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.</span></p> 
     <p style=""></p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style="">I actually only see three options (perhaps there are more):</span></p> 
     <p style=""></p> 
     <p></p> 
     <ul style="margin-top:0cm;margin-bottom: 0cm" type="disc"> 
      <li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1; font-size: 11pt; margin-top: 0cm; font-family: "Calibri", sans-serif; margin-bottom: 0cm;mso-style-priority: 34; margin-right: 0cm"><span lang="EN-US" style="">We actually deprecate funneled and serialized<p style=""></p></span></li> 
      <li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1; font-size: 11pt; margin-top: 0cm; font-family: "Calibri", sans-serif; margin-bottom: 0cm;mso-style-priority: 34; margin-right: 0cm"><span lang="EN-US" style="">We don’t deprecate, but state that they should no longer be returned in the session model<p style=""></p></span></li> 
      <li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1; font-size: 11pt; margin-top: 0cm; font-family: "Calibri", sans-serif; margin-bottom: 0cm;mso-style-priority: 34; margin-right: 0cm"><span lang="EN-US" style="">We isolate sessions against each other<p style=""></p></span></li> 
     </ul> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style="">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.</span></p> 
     <p style=""></p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style="">I kind of like the latter one, as it goes with the spirit of session, but I wonder what implementers say to that.</span></p> 
     <p style=""></p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style="">Martin</span></p> 
     <p style=""></p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
     <p style=""> </p> 
     <p></p> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style="">-- </span><span lang="EN-US" style="color:black;font-size:10.5pt;font-family:Helvetica"><br style="">Prof. Dr. Martin Schulz, Chair of Computer Architecture and Parallel Systems<br style="">Department of Informatics, TU-Munich, Boltzmannstraße 3, D-85748 Garching<br style="">Member of the Board of Directors at the Leibniz Supercomputing Centre (LRZ)<br style="">Email: schulzm@in.tum.de</span><span lang="EN-US" style=""></span></p> 
      <p style=""></p> 
      <p></p> 
      <div style=""> 
       <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span lang="EN-US" style=""></span></p> 
       <p style=""> </p> 
       <p></p> 
      </div> 
     </div> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
     <p style=""> </p> 
     <p></p> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
     <p style=""> </p> 
     <p></p> 
     <div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><b style=""><span style="color:black;font-size:12.0pt">From: </span></b><span style="color:black;font-size:12.0pt">mpiwg-sessions <mpiwg-sessions-bounces@lists.mpi-forum.org> on behalf of Dan Holmes via mpiwg-sessions <mpiwg-sessions@lists.mpi-forum.org><br style=""><b style="">Reply-To: </b>MPI Sessions working group <mpiwg-sessions@lists.mpi-forum.org><br style=""><b style="">Date: </b>Thursday, 18. February 2021 at 21:07<br style=""><b style="">To: </b>mpiwg-sessions <mpiwg-sessions@lists.mpi-forum.org><br style=""><b style="">Cc: </b>Dan Holmes <danholmes@chi.scot><br style=""><b style="">Subject: </b>[mpiwg-sessions] [EXTERNAL] Question on MPI_THREAD_FUNNELED</span></p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
      <p style=""> </p> 
      <p></p> 
     </div> 
     <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif">Hi Martin, </p> 
     <p style=""></p> 
     <p></p> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
      <p style=""> </p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif">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).</p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
      <p style=""> </p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif">Modern MPI libraries effectively only have MPI_THREAD_SERIALIZED and MPI_THREAD_MULTIPLE anyway.</p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
      <p style=""> </p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif">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.</p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
      <p style=""> </p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif">Two libraries might be called by a single thread and thereby be thread compliant.</p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
      <p style=""> </p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black">So, prohibiting these thread support levels seems too severe.</span></p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black"><br style=""><br style=""></span></p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black">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.</span></p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black"><br style=""><br style=""></span></p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black">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.</span></p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black"><br style=""><br style=""></span></p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black">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.</span></p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black"><br style=""><br style=""></span></p> 
      <p style=""></p> 
      <p></p> 
     </div> 
     <div style=""> 
      <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black">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.</span></p> 
      <p style=""></p> 
      <p></p> 
      <div style=""> 
       <div style=""> 
        <div style=""> 
         <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black;font-size:9.0pt;font-family:Helvetica"><br style="">Cheers,</span></p> 
         <p style=""></p> 
         <p></p> 
        </div> 
        <div style=""> 
         <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black;font-size:9.0pt;font-family:Helvetica">Dan.</span></p> 
         <p style=""></p> 
         <p></p> 
        </div> 
        <div style=""> 
         <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black;font-size:9.0pt;font-family:Helvetica">—</span></p> 
         <p style=""></p> 
         <p></p> 
        </div> 
        <div style=""> 
         <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black;font-size:9.0pt;font-family:Helvetica">Dr Daniel Holmes PhD</span></p> 
         <p style=""></p> 
         <p></p> 
        </div> 
        <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black">Executive Director<br style="">Chief Technology Officer</span></p> 
        <p style=""></p> 
        <p></p> 
        <div style=""> 
         <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black;font-size:9.0pt;font-family:Helvetica">CHI Ltd</span></p> 
         <p style=""></p> 
         <p></p> 
        </div> 
        <div style=""> 
         <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black;font-size:9.0pt;font-family:Helvetica"><a href="mailto:danholmes@chi.scot" style="">danholmes@chi.scot</a></span></p> 
         <p style=""></p> 
         <p></p> 
        </div> 
        <div style=""> 
         <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"><span style="color:black;font-size:9.0pt;font-family:Helvetica"></span></p> 
         <p style=""> </p> 
         <p></p> 
        </div> 
       </div> 
      </div> 
      <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm;white-space:pre-wrap; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;orphans: 2;mso-style-priority: 99;font-variant-ligatures: normal;widows: 2;text-decoration-thickness: initial"><span style="color:black">Hi Howard,<p style=""></p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black"><p style=""> </p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black">>><i style="">    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.<p style=""></p></i></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black"><p style=""> </p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black">I think the problem also appears if the original MPI_Init_thread uses FUNNELED. We probably need to add something there as well.<p style=""></p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black"><p style=""> </p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black">>><i style="">    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.  <p style=""></p></i></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black"><p style=""> </p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black">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.<p style=""></p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black"><p style=""> </p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black">>><i style="">    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.<p style=""></p></i></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black"><p style=""> </p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black">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.<p style=""></p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black"><p style=""> </p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black">Almost seems like we should deprecate funneled and serialized.<p style=""></p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black"><p style=""> </p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black">Another item to cover next Monday __.<p style=""></p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black"><p style=""> </p></span></pre> 
       <pre style=" mso-style-link: "HTML Preformatted Char"; margin: 0cm; font-size: 10pt; font-family: "Courier New"; margin-bottom: 0.0001pt;mso-style-priority: 99"><span style="color:black">Martin<p style=""></p></span></pre> 
      </blockquote> 
      <div style=""> 
       <p class="MsoNormal" style="margin: 0cm; font-size: 11pt; font-family: "Calibri", sans-serif"></p> 
       <p style=""> </p> 
       <p></p> 
      </div> 
     </div> 
    </div> 
   </blockquote> 
  </div>  
 </body>
</html>