<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Fantastic, thank you for the pointers, Shintaro and Bruno!</p>
    <p>We'll follow this model and let you know if we have feedback.</p>
    <p>thanks,</p>
    <p>-Phil<br>
    </p>
    <div class="moz-cite-prefix">On 11/18/21 9:37 AM, Faccini, Bruno via
      discuss wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:1743BE5D-09BC-41CE-9F46-26723C06BF88@contoso.com">
      
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}span.apple-converted-space
        {mso-style-name:apple-converted-space;}.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}div.WordSection1
        {page:WordSection1;}</style>
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:black" lang="EN-US">Phil,
            Shintaro,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:black" lang="EN-US">Just
            in case, we have implemented it in DAOS, and it works just
            fine !<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:black" lang="EN-US">You
            can find the whole code for the feature at
            <a href="https://github.com/daos-stack/daos/pull/5111" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/daos-stack/daos/pull/5111</a>
            .<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:black" lang="EN-US">Cheers,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:black" lang="EN-US">Bruno.<o:p></o:p></span></p>
        <p class="MsoNormal"><b><span style="color:black" lang="EN-US"><o:p> </o:p></span></b></p>
        <p class="MsoNormal"><b><span style="color:black" lang="EN-US"><o:p> </o:p></span></b></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><b><span style="color:black" lang="EN-US">From:<span class="apple-converted-space"> </span></span></b><span style="color:black" lang="EN-US">Shintaro Iwasaki via
            discuss <</span><span style="color:black"><a href="mailto:discuss@lists.argobots.org" moz-do-not-send="true"><span lang="EN-US">discuss@lists.argobots.org</span></a></span><span style="color:black" lang="EN-US">><br>
            <b>Reply-To:<span class="apple-converted-space"> </span></b>"</span><span style="color:black"><a href="mailto:discuss@lists.argobots.org" moz-do-not-send="true"><span lang="EN-US">discuss@lists.argobots.org</span></a></span><span style="color:black" lang="EN-US">" <</span><span style="color:black"><a href="mailto:discuss@lists.argobots.org" moz-do-not-send="true"><span lang="EN-US">discuss@lists.argobots.org</span></a></span><span style="color:black" lang="EN-US">><br>
            <b>Date:<span class="apple-converted-space"> </span></b>Thursday
            18 November 2021 at 02:29<br>
            <b>To:<span class="apple-converted-space"> </span></b>"</span><span style="color:black"><a href="mailto:discuss@lists.argobots.org" title="mailto:discuss@lists.argobots.org" moz-do-not-send="true"><span lang="EN-US">discuss@lists.argobots.org</span></a></span><span style="color:black" lang="EN-US">" <</span><span style="color:black"><a href="mailto:discuss@lists.argobots.org" moz-do-not-send="true"><span lang="EN-US">discuss@lists.argobots.org</span></a></span><span style="color:black" lang="EN-US">><br>
            <b>Cc:<span class="apple-converted-space"> </span></b>Shintaro
            Iwasaki <</span><span style="color:black"><a href="mailto:shintaro.iwasaki.work@gmail.com" moz-do-not-send="true"><span lang="EN-US">shintaro.iwasaki.work@gmail.com</span></a></span><span style="color:black" lang="EN-US">><br>
            <b>Subject:<span class="apple-converted-space"> </span></b>Re:
            [argobots-discuss] externally allocated stacks and unnamed
            (detached) threads<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US"> <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US">Hi Phil,<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US"> <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US">Thanks for your question!<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US"> <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US">Calling a custom stack
            destructor for an unnamed ULT is possible within the current
            Argobots infrastructure. This is related to this issue:<span class="apple-converted-space"> </span></span><span style="color:black"><a href="https://github.com/pmodels/argobots/issues/16" target="_blank" title="https://github.com/pmodels/argobots/issues/16" moz-do-not-send="true"><span lang="EN-US">https://github.com/pmodels/argobots/issues/16</span></a></span><span style="color:black" lang="EN-US">. <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US"> <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US">For the detailed
            implementation, please find the complete code here
            (collapsed):<span class="apple-converted-space"> </span></span><span style="color:black"><a href="https://github.com/pmodels/argobots/issues/274#issuecomment-785221242" target="_blank" moz-do-not-send="true"><span lang="EN-US">https://github.com/pmodels/argobots/issues/274#issuecomment-785221242</span></a></span><span style="color:black" lang="EN-US">. Though you have to call
            init_stack_key() and finalize_stack_key() to use this, it
            should be simple enough: you just basically change
            allocate_stack() and free_stack() for your workload.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US"> <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US">I believe this is the quick
            path to implement your idea. But maybe a more intuitive
            stack-free-hook interface would be preferable (this request
            is not the first time). Please let me know if you need such
            a new interface (especially if your idea works well).<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US"> <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US">Thanks,<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US">Shintaro<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt;caret-color:
          rgb(0, 0, 0);font-variant-caps: normal;orphans:
          auto;text-align:start;widows: auto;-webkit-text-size-adjust:
          auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
          <span style="color:black" lang="EN-US"> <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US">On Wed, Nov 17, 2021 at
            2:15 PM Phil Carns via discuss <</span><span style="color:black"><a href="mailto:discuss@lists.argobots.org" target="_blank" moz-do-not-send="true"><span lang="EN-US">discuss@lists.argobots.org</span></a></span><span style="color:black" lang="EN-US">> wrote:<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:black" lang="EN-US">Hi all,<br>
            <br>
            We've been thinking about some memory optimizations for
            which it might<span class="apple-converted-space"> </span><br>
            be easier if our own code provided the stack memory for
            newly created<span class="apple-converted-space"> </span><br>
            ULTs so that we have full control over the allocation
            strategy.  This<span class="apple-converted-space"> </span><br>
            seems pretty straightforward with the
            ABT_thread_attr_set_stack() function:<br>
            <br>
          </span><span style="color:black"><a href="https://www.argobots.org/doxygen/latest/d2/df6/group__ULT__ATTR.html#gac8f39be20d677898c45293c5ce31eea0" target="_blank" moz-do-not-send="true"><span lang="EN-US">https://www.argobots.org/doxygen/latest/d2/df6/group__ULT__ATTR.html#gac8f39be20d677898c45293c5ce31eea0</span></a></span><span style="color:black" lang="EN-US"><br>
            <br>
            However, our use case often creates unnamed (detached)
            threads by<span class="apple-converted-space"> </span><br>
            setting the ABT_thread_create() newthread argument to NULL. 
            I can<span class="apple-converted-space"> </span><br>
            elaborate if needed, but the short story is that this is a
            really<span class="apple-converted-space"> </span><br>
            natural fit for RPC handlers in our model:<br>
            <br>
          </span><span style="color:black"><a href="https://www.argobots.org/doxygen/latest/d0/d6d/group__ULT.html#ga73bd1f04ce57def336cb20cdec9b14bd" target="_blank" moz-do-not-send="true"><span lang="EN-US">https://www.argobots.org/doxygen/latest/d0/d6d/group__ULT.html#ga73bd1f04ce57def336cb20cdec9b14bd</span></a></span><span style="color:black" lang="EN-US"><br>
            <br>
            Is it possible to do both (provide an externally managed
            stack pointer,<span class="apple-converted-space"> </span><br>
            and use unnamed ULTs)?  From the documentation it looks like
            the answer<span class="apple-converted-space"> </span><br>
            is probably no, because the caller who created the stack
            allocation<span class="apple-converted-space"> </span><br>
            doesn't explicitly free the ULT, and thus doesn't have a way
            to free the<span class="apple-converted-space"> </span><br>
            stack after the ULT is complete.<br>
            <br>
            I wanted to double check though before I start thinking
            about<span class="apple-converted-space"> </span><br>
            alternatives, though.<br>
            <br>
            thanks!<br>
            <br>
            -Phil<br>
            <br>
            _______________________________________________<br>
            discuss mailing list<br>
          </span><span style="color:black"><a href="mailto:discuss@lists.argobots.org" target="_blank" moz-do-not-send="true"><span lang="EN-US">discuss@lists.argobots.org</span></a></span><span style="color:black" lang="EN-US"><br>
          </span><span style="color:black"><a href="https://lists.argobots.org/mailman/listinfo/discuss" target="_blank" title="https://lists.argobots.org/mailman/listinfo/discuss" moz-do-not-send="true"><span lang="EN-US">https://lists.argobots.org/mailman/listinfo/discuss</span></a></span><span style="color:black" lang="EN-US"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US"><o:p> </o:p></span></p>
      </div>
      <p>---------------------------------------------------------------------<br>
        Intel Corporation SAS (French simplified joint stock company)<br>
        Registered headquarters: "Les Montalets"- 2, rue de Paris, <br>
        92196 Meudon Cedex, France<br>
        Registration Number:  302 456 199 R.C.S. NANTERRE<br>
        Capital: 4,572,000 Euros</p>
      <p>This e-mail and any attachments may contain confidential
        material for<br>
        the sole use of the intended recipient(s). Any review or
        distribution<br>
        by others is strictly prohibited. If you are not the intended<br>
        recipient, please contact the sender and delete all copies.</p>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
discuss mailing list
<a class="moz-txt-link-abbreviated" href="mailto:discuss@lists.argobots.org">discuss@lists.argobots.org</a>
<a class="moz-txt-link-freetext" href="https://lists.argobots.org/mailman/listinfo/discuss">https://lists.argobots.org/mailman/listinfo/discuss</a>
</pre>
    </blockquote>
  </body>
</html>