<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Does ?copy guarantee overlapping regions ? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Does-copy-guarantee-overlapping-regions/m-p/872904#M8639</link>
    <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/406441"&gt;newton_particle&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;Does anyone know how if  ?copy  has guarantees for overlapping source/target regions?&lt;BR /&gt;&lt;BR /&gt;i.e. is it more memmove() than memcpy(), so that the direction of copying is factored in to prevent overruns ?&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
BLAS ?COPY has no protection against overlaps. You could build the netlib reference source code yourself, with compiler options which protect against overlap, such as ifort -assume dummy_aliases, but this is likely to be less efficient than memmove(), or copying first to a temporary region, then to the final target. It's possible to invoke memmove() directly from a Fortran compiler which supports ISO C interoperability (somewhat ugly).&lt;BR /&gt;Backwards copy is usually slow anyway (barring specially aligned cases) on Intel processors prior to Core i7, and AMD processors prior to Barcelona, so it's not safe to assume that an implementation of memmove() or equivalent is the most efficient one for your processor, unless you write/test it yourself. This may require fairly low level code, such as SSE intrinsics.&lt;BR /&gt;If you used ?COPY incorrectly, with overlapping data, it wouldn't necessarily be an over-run, but the source data would be over-written before use. memmove() likewise has no protection against over-run, should you exceed the target limits.&lt;BR /&gt;</description>
    <pubDate>Tue, 06 Jan 2009 23:54:28 GMT</pubDate>
    <dc:creator>TimP</dc:creator>
    <dc:date>2009-01-06T23:54:28Z</dc:date>
    <item>
      <title>Does ?copy guarantee overlapping regions ?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Does-copy-guarantee-overlapping-regions/m-p/872903#M8638</link>
      <description>Does anyone know how if  ?copy  has guarantees for overlapping source/target regions?&lt;BR /&gt;&lt;BR /&gt;i.e. is it more memmove() than memcpy(), so that the direction of copying is factored in to prevent overruns ?&lt;BR /&gt;&lt;BR /&gt;Newton&lt;BR /&gt;--------&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Jan 2009 19:39:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Does-copy-guarantee-overlapping-regions/m-p/872903#M8638</guid>
      <dc:creator>newton_particle</dc:creator>
      <dc:date>2009-01-06T19:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Does ?copy guarantee overlapping regions ?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Does-copy-guarantee-overlapping-regions/m-p/872904#M8639</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/406441"&gt;newton_particle&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;Does anyone know how if  ?copy  has guarantees for overlapping source/target regions?&lt;BR /&gt;&lt;BR /&gt;i.e. is it more memmove() than memcpy(), so that the direction of copying is factored in to prevent overruns ?&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
BLAS ?COPY has no protection against overlaps. You could build the netlib reference source code yourself, with compiler options which protect against overlap, such as ifort -assume dummy_aliases, but this is likely to be less efficient than memmove(), or copying first to a temporary region, then to the final target. It's possible to invoke memmove() directly from a Fortran compiler which supports ISO C interoperability (somewhat ugly).&lt;BR /&gt;Backwards copy is usually slow anyway (barring specially aligned cases) on Intel processors prior to Core i7, and AMD processors prior to Barcelona, so it's not safe to assume that an implementation of memmove() or equivalent is the most efficient one for your processor, unless you write/test it yourself. This may require fairly low level code, such as SSE intrinsics.&lt;BR /&gt;If you used ?COPY incorrectly, with overlapping data, it wouldn't necessarily be an over-run, but the source data would be over-written before use. memmove() likewise has no protection against over-run, should you exceed the target limits.&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Jan 2009 23:54:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Does-copy-guarantee-overlapping-regions/m-p/872904#M8639</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2009-01-06T23:54:28Z</dc:date>
    </item>
  </channel>
</rss>

