<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello.</p>
    <p>In the past weeks I worked on the inclusion of experimental
      thread-safety support (mostly based on the work by Maxim Gaina) in
      the "devel" branch of the Parma Polyhedra Library.</p>
    A few relevant information:
    <p>- as said above, thread-safety support is only available in the
      git branch named "devel"<br>
    </p>
    <p>- in order to enable support for thread-safety, the library has
      to be configured using option "--enable-thread-safe"<br>
    </p>
    <p>- it assumes a compiler supporting C++11 threads (tested only
      with gcc on linux)<br>
    </p>
    <p>- currently thread-safety is only available when using the C++, C
      and Java language interfaces<br>
    </p>
    <p>- the timeout mechanism does NOT support thread safety (yet)<br>
    </p>
    <p>- a few examples of computations using multiple PPL threads can
      be found in:<br>
            * demos/ppl_lcdd (for the C++ interface)<br>
            * demos/ppl_lpsol (for the C interface)<br>
            * interfaces/Java/tests/Variable_Output_thread_safe1.java<br>
    </p>
    <p>- it is worth stressing (again) that the library is
      *conditionally* thread safe: if any two application threads share
      library objects, the application should manage to properly
      serialize all accesses to these objects (note: even when all these
      accesses are meant to be read-only, because many PPL operators are
      "logically const", but may actually modify the internal
      representation of objects, therefore leading to race conditions)</p>
    <p>- beware of inefficiencies coming from memory allocation; we
      suggest to replace the standard allocation mechanism with
      something that behaves better in a multi-threaded setting (e.g.,
      TCMalloc).</p>
    It would be nice if people interested in this extension could give
    it a try and provide us with some feedback.<br>
    <br>
    Enea.<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 08/10/2016 09:59 AM, Enea Zaffanella
      wrote:<br>
    </div>
    <blockquote
      cite="mid:d1939ec5-3807-396c-6d78-9baed181038e@cs.unipr.it"
      type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <p>Hello John.</p>
      <p>The library, as is, is not thread safe (the main reason is that
        it uses a bunch of static caches to speed up single-threaded
        computations).<br>
      </p>
      <p>Maxim Gaina, a student under my supervision, produced a version
        of the library which is conditionally thread safe: safety is
        achieved as long as each thread has exclusive access to the PPL
        objects it works on. That is, either the objects are not shared
        between threads or the application code makes sure that shared
        objects are accessed at different times (e.g., using mutexes).
        The thread-safe version uses C++11 constructs and it was
        considering the C++ and C language interfaces only. For testing
        purposes, Maxim produced multi-threaded variants of demo
        programs ppl_lcdd and ppl_lpsol. <br>
      </p>
      <p>Afaict, Roberto was considering whether or not the work of
        Maxim was to be added to the main PPL library.</p>
      <p>Cheers,<br>
        Enea<br>
      </p>
      <br>
      <div class="moz-cite-prefix">On 08/09/2016 11:23 PM, John Paulson
        wrote:<br>
      </div>
      <blockquote
cite="mid:CAGZnXMjo5K9QBfXDaoWAXwJJ=oDkqSyLkMuwDL5=Cv9R9V7e6g@mail.gmail.com"
        type="cite">
        <div dir="ltr">Hi Developers,
          <div><br>
          </div>
          <div>I have been using PPL for a couple of years, and I have
            just become interested in parallelizing an application I
            wrote that calls it. I tried to do this (using a
            parallel_for loop from TBB), but I ran into varied errors at
            run time.</div>
          <div><br>
          </div>
          <div>I noticed that in the TODO file of the PPL distribution
            that it has "Make the library thread-safe" on the list. Has
            this been done yet? Would the lack of thread safety lead to
            strange run time errors?</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>Best,</div>
          <div>John C. Paulson</div>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
PPL-devel mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:PPL-devel@cs.unipr.it">PPL-devel@cs.unipr.it</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.cs.unipr.it/mailman/listinfo/ppl-devel">http://www.cs.unipr.it/mailman/listinfo/ppl-devel</a>
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
PPL-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:PPL-devel@cs.unipr.it">PPL-devel@cs.unipr.it</a>
<a class="moz-txt-link-freetext" href="http://www.cs.unipr.it/mailman/listinfo/ppl-devel">http://www.cs.unipr.it/mailman/listinfo/ppl-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>