<?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 Python3 bug: numpy.percentile()  in Intel® Distribution for Python*</title>
    <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Python3-bug-numpy-percentile/m-p/1133807#M873</link>
    <description>&lt;P&gt;We work with camera images from CMOS sensors which often use 16Bit image formats (int16, uint16). For some image sizes the implementation of percentile() causes memory corruptions/segfaults. This not observed for other data types (8, 32 or 64Bit) and is present at least in numpy version 1.13 ... 1.17 (releases 2018-1 through 2019-5). Other python distributions than intel behave normal.&lt;/P&gt;&lt;P&gt;We could boil down the problem to the attached 3-liner 'minimal-iP.txt':&lt;/P&gt;&lt;P&gt;import numpy as np&lt;BR /&gt;test = np.array([np.arange(i, 44+i, dtype=np.int16) for i in range(56)])&lt;BR /&gt;np.percentile(test, (0.1, 0.99))&lt;/P&gt;&lt;P&gt;$: python3&amp;nbsp; minimal-iP.txt&lt;/P&gt;&lt;P&gt;The resulting crash log is also attached. Other image sizes might work, (43x47) is also known to trigger the crash.&lt;/P&gt;&lt;P&gt;With best regards,&lt;/P&gt;&lt;P&gt;Stephan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Nov 2019 14:29:51 GMT</pubDate>
    <dc:creator>Stephan_U</dc:creator>
    <dc:date>2019-11-01T14:29:51Z</dc:date>
    <item>
      <title>Python3 bug: numpy.percentile()</title>
      <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Python3-bug-numpy-percentile/m-p/1133807#M873</link>
      <description>&lt;P&gt;We work with camera images from CMOS sensors which often use 16Bit image formats (int16, uint16). For some image sizes the implementation of percentile() causes memory corruptions/segfaults. This not observed for other data types (8, 32 or 64Bit) and is present at least in numpy version 1.13 ... 1.17 (releases 2018-1 through 2019-5). Other python distributions than intel behave normal.&lt;/P&gt;&lt;P&gt;We could boil down the problem to the attached 3-liner 'minimal-iP.txt':&lt;/P&gt;&lt;P&gt;import numpy as np&lt;BR /&gt;test = np.array([np.arange(i, 44+i, dtype=np.int16) for i in range(56)])&lt;BR /&gt;np.percentile(test, (0.1, 0.99))&lt;/P&gt;&lt;P&gt;$: python3&amp;nbsp; minimal-iP.txt&lt;/P&gt;&lt;P&gt;The resulting crash log is also attached. Other image sizes might work, (43x47) is also known to trigger the crash.&lt;/P&gt;&lt;P&gt;With best regards,&lt;/P&gt;&lt;P&gt;Stephan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 14:29:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-for-Python/Python3-bug-numpy-percentile/m-p/1133807#M873</guid>
      <dc:creator>Stephan_U</dc:creator>
      <dc:date>2019-11-01T14:29:51Z</dc:date>
    </item>
    <item>
      <title>Hi Stephan, </title>
      <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Python3-bug-numpy-percentile/m-p/1133808#M874</link>
      <description>&lt;P&gt;Hi Stephan,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you for providing a clean reproducer. I was able to reproduce the crash. The crash is due to aggressive compiler optimization of&amp;nbsp; {{dumb_select_short}} routine in numpy/core/src/npymath/selection.c.src, which implements quadratic complexity selection.&lt;/P&gt;&lt;P&gt;The fix is suppress vectorization there for short integers, just like it is done for bytes already.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/IntelPython/numpy/blob/intel/1.17.3/numpy/core/src/npysort/selection.c.src#L258" target="_blank"&gt;https://github.com/IntelPython/numpy/blob/intel/1.17.3/numpy/core/src/npysort/selection.c.src#L258&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The issue will be brought up to the compiler's team attention. I will report here once the binary of numpy 1.17.3 with the fix is published.&lt;/P&gt;&lt;P&gt;Sorry for the inconvenience,&lt;BR /&gt;Oleksandr&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 16:26:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-for-Python/Python3-bug-numpy-percentile/m-p/1133808#M874</guid>
      <dc:creator>Oleksandr_P_Intel</dc:creator>
      <dc:date>2019-11-05T16:26:46Z</dc:date>
    </item>
  </channel>
</rss>

