<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hello,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">fix has been upload here:
      <a class="moz-txt-link-freetext" href="https://gerrit.gromacs.org/c/gromacs/+/15059">https://gerrit.gromacs.org/c/gromacs/+/15059</a><br>
      <br>
      Cheers<br>
      <br>
      Paul<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 27/12/2019 11:18, Paul bauer wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:d6002e1d-20a2-19a1-74db-0019a4fdf1d3@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="moz-cite-prefix">Hello,<br>
        <br>
        I opened <a class="moz-txt-link-freetext"
          href="https://redmine.gromacs.org/issues/3269"
          moz-do-not-send="true">https://redmine.gromacs.org/issues/3269</a>
        for this and should have a fix for it soon.</div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">Cheers<br>
        <br>
        Paul<br>
      </div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">On 27/12/2019 10:12, Erik Lindahl
        wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:CAEJJM8HSF0ZqCuc9G63LZkrEM-Y4Nk0ctqYijtBhmVdaTvLANA@mail.gmail.com">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        <div dir="ltr">Hi Len &amp; Jonathan,
          <div><br>
          </div>
          <div>Paul found an issue related to
            different-endianness-reading that has apparently slipped
            through the Debian tests (since they didn't run the
            regression tests by default). We'll get a fix in for that
            before the release.</div>
          <div><br>
          </div>
          <div>The reason for the change is that the XDR I/IO layer is
            becoming very outdated. First, while it made a lot of sense
            to stick to the standard (big) "network endian" in the late
            90s, today the problem is that virtually every single
            architecture is little endian, so you incur all the overhead
            of swapping both on writing and reading. Second, the way
            this is implemented in XDR means it's very slow - we're
            basically doing byte-by-byte reading.</div>
          <div><br>
          </div>
          <div>This change will instead allow all architectures to use
            highly efficient buffered I/O in their default endian, and
            then we only have to bother about swapping endianness in the
            rare cases an actual big-endian machine is involved.</div>
          <div><br>
          </div>
          <div>We'll also look into the one-padding; for Gromacs it
            doesn't matter, but avoiding that might indeed make the life
            of other codes easier.</div>
          <div><br>
          </div>
          <div>Cheers,</div>
          <div><br>
          </div>
          <div>Erik</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Thu, Dec 26, 2019 at
            11:04 PM Jonathan Barnoud &lt;<a
              href="mailto:jonathan@barnoud.net" moz-do-not-send="true">jonathan@barnoud.net</a>&gt;
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
            <div>
              <div>Hello everyone,<br>
              </div>
              <div><br>
              </div>
              <div>I upgraded the code of MDAnalysis to read the latest
                TPR version. To add to Len's comments, it appears indeed
                that the new TPR body is 4 times as big as it use to be
                for the same content, and is not portable between
                architectures. gmx dump does fail at reading a file with
                a different byte order than native, and there is no
                obvious way to determine the endianness of the body.
                While the TPR format is not meant to really be portable,
                it seemed commonly agreed that it was a good file to
                share (<a
                  href="https://pubs.acs.org/doi/abs/10.1021/acs.jcim.9b00665"
                  target="_blank" moz-do-not-send="true">https://pubs.acs.org/doi/abs/10.1021/acs.jcim.9b00665</a>),
                it is for sure a good input file in MDAnalysis. TPR
                files are commonly produced on a local machine before
                being actually run on a cluster, that may use a
                different byte order.<br>
              </div>
              <div><br>
              </div>
              <div>&gt; Second the individual bytes of a value are
                padded to 4 bytes per original bytes (each byte is
                packed as `char`). <br>
              </div>
              <div><br>
              </div>
              <div>To be noted that the in-file XDR decoder in gromacs
                (used for the header and prior to gromacs 2020) uses 4
                bytes for "char", hence the padding. The in-memory one
                reads 1 padded byte (1 byte of information, 4 bytes in
                the file).</div>
              <div><br>
              </div>
              <div>As my use case for noticing these differences is
                fairly niche, I may be missing the reason for them. In
                such case, I would be curious to read about them.<br>
              </div>
              <div><br>
              </div>
              <div>Best regards,</div>
              <div>Jonathan<br>
              </div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div>On 12/26/19 7:39 PM, Len Kimms wrote:<br>
              </div>
              <blockquote type="cite">
                <pre>Hello everyone,

while fooling around with the new (i.e. version 2020 rc1) TPR file format I noticed some strange behaviors that I don’t understand. As far as I understand the body of the new format is written by the `gmx::InMemorySerializer`. My following questions are basically about this module.

First it seems that the memory serializer writes the values in native byte order. This means that the body of TPR files differ between big- and little-endian systems. The XDR standard used before requires big-endian data. For me, a novice user, the new implementation seems to be less portable and robust. Endian swapping seems to be implemented but not currently used for TPR files.
Is this intentional, if so, why?

Second the individual bytes of a value are padded to 4 bytes per original bytes (each byte is packed as `char`). Therefore the size increases accordingly.
Do those padding bytes serve a special purpose?
Also regarding the padding bytes: Some bytes are not, like most others, padded with zeros. In some places they are padded with ones. At first glance this seem to happen to the second byte (big-endian) of a float. From some initial testing my best guess is, that this is caused by the union conversion in `CharBuffer`. With an `unsigned char` in the private union `u` those values would be zero padded.

In the attachment one could find example files from a big- and little-endian system as well as a file created with GROMACS 2019.
I also brought this to the attention of the MDAnalysis devs here:
<a href="https://github.com/MDAnalysis/mdanalysis/issues/2428" target="_blank" moz-do-not-send="true">https://github.com/MDAnalysis/mdanalysis/issues/2428</a>

Best regards,
   Len</pre>
                <br>
                <fieldset></fieldset>
              </blockquote>
              <p><br>
              </p>
            </div>
            -- <br>
            Gromacs Developers mailing list<br>
            <br>
            * Please search the archive at <a
              href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a>
            before posting!<br>
            <br>
            * Can't post? Read <a
              href="http://www.gromacs.org/Support/Mailing_Lists"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://www.gromacs.org/Support/Mailing_Lists</a><br>
            <br>
            * For (un)subscribe requests visit<br>
            <a
href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers"
              rel="noreferrer" target="_blank" moz-do-not-send="true">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a>
            or send a mail to <a
              href="mailto:gmx-developers-request@gromacs.org"
              target="_blank" moz-do-not-send="true">gmx-developers-request@gromacs.org</a>.</blockquote>
        </div>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div dir="ltr" class="gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div>
                      <div dir="ltr">
                        <div>Erik Lindahl &lt;<a
                            href="mailto:erik.lindahl@dbb.su.se"
                            target="_blank" moz-do-not-send="true">erik.lindahl@dbb.su.se</a>&gt;</div>
                        <div>Professor of Biophysics, Dept. Biochemistry
                          &amp; Biophysics, Stockholm University</div>
                        <div>Science for Life Laboratory, Box 1031,
                          17121 Solna, Sweden</div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
      </blockquote>
      <p><br>
      </p>
      <pre class="moz-signature" cols="72">-- 
Paul Bauer, PhD
GROMACS Release Manager
KTH Stockholm, SciLifeLab
0046737308594</pre>
    </blockquote>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Paul Bauer, PhD
GROMACS Release Manager
KTH Stockholm, SciLifeLab
0046737308594</pre>
  </body>
</html>