<?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 Use numba in intel python environment, but get more running time and memory error in Intel® Distribution for Python*</title>
    <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144367#M1002</link>
    <description>&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;I am using Anaconda with python 3.6. Firstly, I have a code as below to create a 3d matrix. It is basically evaluate a phase term over the matrix, and the phase term is determined by location in the matrix.&lt;/P&gt;

&lt;PRE class="brush:python;" style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); color: rgb(57, 51, 24); word-wrap: normal;"&gt;g = lambda p,m,n: np.exp(2j*np.pi*(kz*p+kx*m+ky*n)).astype(np.complex64)
shift = np.fromfunction(g,(2*nz,2*nx,2*ny))
shift = np.roll(np.roll(np.roll(shift,nz,0),nx,1),ny,2)&lt;/PRE&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;kz,kx,ky are known parameters as float number. nz,nx,ny are the scale of the matrix.&lt;/P&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;Then I have a faster one doing same thing based on numba.jit.&lt;/P&gt;

&lt;PRE class="brush:python;" style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); color: rgb(57, 51, 24); word-wrap: normal;"&gt;x = np.arange(2*nx)
y = np.arange(2*ny)
z = np.arange(2*nz)
zv, yv, xv = np.meshgrid(z,y, x)
@jit(nopython=True, parallel=True)
def f(z,x,y):
    a = np.exp(2j*np.pi*(kx*x+ky*y)).astype(np.complex64)
    return a
a = f(zv,xv,yv)
a = a.swapaxes(0,1)
a = np.roll(np.roll(np.roll(a,nz,0),nx,1),ny,2)&lt;/PRE&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;This one is faster than the former one, but I am looking forward to an even faster one.&lt;/P&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;I installed intel python distribution. But I find that these two codes above don't work anymore. In IPD environment, the first code turns out to be "Memory Error", the second one costs super long time and finally kernel died.&lt;/P&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;Can anyone point out why?&lt;/P&gt;</description>
    <pubDate>Thu, 19 Oct 2017 02:21:07 GMT</pubDate>
    <dc:creator>Ruizhe_L_</dc:creator>
    <dc:date>2017-10-19T02:21:07Z</dc:date>
    <item>
      <title>Use numba in intel python environment, but get more running time and memory error</title>
      <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144367#M1002</link>
      <description>&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;I am using Anaconda with python 3.6. Firstly, I have a code as below to create a 3d matrix. It is basically evaluate a phase term over the matrix, and the phase term is determined by location in the matrix.&lt;/P&gt;

&lt;PRE class="brush:python;" style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); color: rgb(57, 51, 24); word-wrap: normal;"&gt;g = lambda p,m,n: np.exp(2j*np.pi*(kz*p+kx*m+ky*n)).astype(np.complex64)
shift = np.fromfunction(g,(2*nz,2*nx,2*ny))
shift = np.roll(np.roll(np.roll(shift,nz,0),nx,1),ny,2)&lt;/PRE&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;kz,kx,ky are known parameters as float number. nz,nx,ny are the scale of the matrix.&lt;/P&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;Then I have a faster one doing same thing based on numba.jit.&lt;/P&gt;

&lt;PRE class="brush:python;" style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); color: rgb(57, 51, 24); word-wrap: normal;"&gt;x = np.arange(2*nx)
y = np.arange(2*ny)
z = np.arange(2*nz)
zv, yv, xv = np.meshgrid(z,y, x)
@jit(nopython=True, parallel=True)
def f(z,x,y):
    a = np.exp(2j*np.pi*(kx*x+ky*y)).astype(np.complex64)
    return a
a = f(zv,xv,yv)
a = a.swapaxes(0,1)
a = np.roll(np.roll(np.roll(a,nz,0),nx,1),ny,2)&lt;/PRE&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;This one is faster than the former one, but I am looking forward to an even faster one.&lt;/P&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;I installed intel python distribution. But I find that these two codes above don't work anymore. In IPD environment, the first code turns out to be "Memory Error", the second one costs super long time and finally kernel died.&lt;/P&gt;

&lt;P style="margin-bottom: 1em; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);"&gt;Can anyone point out why?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 02:21:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144367#M1002</guid>
      <dc:creator>Ruizhe_L_</dc:creator>
      <dc:date>2017-10-19T02:21:07Z</dc:date>
    </item>
    <item>
      <title>Could you please indicate the</title>
      <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144368#M1003</link>
      <description>&lt;P&gt;Could you please indicate the amount of memory on the machine where you experience the issue in question, as well as ball-park values for nx, ny, nz.&lt;/P&gt;

&lt;P&gt;Essentially, we need to be able to reproduce the issue with a reasonable effort to provide an answer.&lt;/P&gt;

&lt;P&gt;Please also indicate which version of Intel Distribution for Python you are using. You can find this out by including the output of `conda list intelpython`.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 16:15:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144368#M1003</guid>
      <dc:creator>Oleksandr_P_Intel</dc:creator>
      <dc:date>2017-10-19T16:15:50Z</dc:date>
    </item>
    <item>
      <title>kx = -0.21445783132530122</title>
      <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144369#M1004</link>
      <description>&lt;PRE class="brush:python;"&gt;kx = -0.21445783132530122
ky = -0.21445783132530122
kz = 0

nx = 512
ny = 512
nz = 390&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am using &lt;STRONG&gt;Anaconda3-5.0.0-Windows-x86_64&lt;/STRONG&gt; and &lt;STRONG&gt;Intel w_python3_p_2018.0.018&lt;/STRONG&gt;, both are the latest version online.&lt;/P&gt;

&lt;P&gt;The computer has &lt;SPAN style="color: rgb(68, 68, 68); font-family: Roboto-Regular, Roboto-Light, &amp;quot;Cordia New&amp;quot;, &amp;quot;Microsoft Sans Serif&amp;quot;, Utsaah, &amp;quot;Devanagari MT&amp;quot;, &amp;quot;Nirmala UI&amp;quot;, Latha, InaiMathi, Gautami, &amp;quot;Telugu Sangam MN&amp;quot;, Tunga, &amp;quot;Kannada Sangam MN&amp;quot;, Kartika, &amp;quot;Malayalam Sangam MN&amp;quot;, Shruti, &amp;quot;Nirmala UI&amp;quot;, &amp;quot;Gujarati MT&amp;quot;, &amp;quot;Gujarati Sangam MN&amp;quot;, Vrinda, &amp;quot;Bangla Sangam MN&amp;quot;, &amp;quot;Meiryo UI Reg&amp;quot;, &amp;quot;メイリオ Reg&amp;quot;, &amp;quot;MS UI Gothic Reg&amp;quot;, &amp;quot;Hiragino Kaku Gothic Reg&amp;quot;, &amp;quot;ヒラギノ角ゴ Pro W3 Reg&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, 微软雅黑, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft JhengHei&amp;quot;, 微軟正黑體, &amp;quot;Malgun Gothic&amp;quot;, &amp;quot;맑은 고딕&amp;quot;, Gulim, AppleGothic, &amp;quot;Apple LiGothic&amp;quot;, &amp;quot;LiHei Pro&amp;quot;, Osaka, STHeiti, 华文黑体, STXihei, 华文细黑, SimHei, 黑体, &amp;quot;Arial Unicode MS&amp;quot;, Arial, sans-serif; font-size: 14px;"&gt;Intel Core i7-7700HQ Quad Core&amp;nbsp;&lt;/SPAN&gt;cpu and 16G ram.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 16:27:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144369#M1004</guid>
      <dc:creator>Ruizhe_L_</dc:creator>
      <dc:date>2017-10-19T16:27:12Z</dc:date>
    </item>
    <item>
      <title>Quote:Oleksandr P. (Intel)</title>
      <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144370#M1005</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Oleksandr P. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Could you please indicate the amount of memory on the machine where you experience the issue in question, as well as ball-park values for nx, ny, nz.&lt;/P&gt;

&lt;P&gt;Essentially, we need to be able to reproduce the issue with a reasonable effort to provide an answer.&lt;/P&gt;

&lt;P&gt;Please also indicate which version of Intel Distribution for Python you are using. You can find this out by including the output of `conda list intelpython`.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:python;" style="font-size: 13.008px;"&gt;kx = -0.21445783132530122
ky = -0.21445783132530122
kz = 0

nx = 512
ny = 512
nz = 390&lt;/PRE&gt;

&lt;P style="font-size: 13.008px;"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;I am using&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;Anaconda3-5.0.0-Windows-x86_64&lt;/SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;Intel w_python3_p_2018.0.018&lt;/SPAN&gt;, both are the latest version online.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;The computer has&amp;nbsp;&lt;SPAN style="color: rgb(68, 68, 68); font-family: Roboto-Regular, Roboto-Light, &amp;quot;Cordia New&amp;quot;, &amp;quot;Microsoft Sans Serif&amp;quot;, Utsaah, &amp;quot;Devanagari MT&amp;quot;, &amp;quot;Nirmala UI&amp;quot;, Latha, InaiMathi, Gautami, &amp;quot;Telugu Sangam MN&amp;quot;, Tunga, &amp;quot;Kannada Sangam MN&amp;quot;, Kartika, &amp;quot;Malayalam Sangam MN&amp;quot;, Shruti, &amp;quot;Nirmala UI&amp;quot;, &amp;quot;Gujarati MT&amp;quot;, &amp;quot;Gujarati Sangam MN&amp;quot;, Vrinda, &amp;quot;Bangla Sangam MN&amp;quot;, &amp;quot;Meiryo UI Reg&amp;quot;, &amp;quot;メイリオ Reg&amp;quot;, &amp;quot;MS UI Gothic Reg&amp;quot;, &amp;quot;Hiragino Kaku Gothic Reg&amp;quot;, &amp;quot;ヒラギノ角ゴ Pro W3 Reg&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, 微软雅黑, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft JhengHei&amp;quot;, 微軟正黑體, &amp;quot;Malgun Gothic&amp;quot;, &amp;quot;맑은 고딕&amp;quot;, Gulim, AppleGothic, &amp;quot;Apple LiGothic&amp;quot;, &amp;quot;LiHei Pro&amp;quot;, Osaka, STHeiti, 华文黑体, STXihei, 华文细黑, SimHei, 黑体, &amp;quot;Arial Unicode MS&amp;quot;, Arial, sans-serif; font-size: 14px;"&gt;Intel Core i7-7700HQ Quad Core&amp;nbsp;&lt;/SPAN&gt;cpu and 16G ram.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 16:28:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144370#M1005</guid>
      <dc:creator>Ruizhe_L_</dc:creator>
      <dc:date>2017-10-19T16:28:36Z</dc:date>
    </item>
    <item>
      <title>OK, the array `shift` is 512</title>
      <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144371#M1006</link>
      <description>&lt;P&gt;OK, the array `shift` is 512*512*390 complex floats, which amounts to about 6GB of memory, so you should be able to fit it in, but any code that creates a lot of intermediate arrays may cause `MemoryError` exception.&lt;/P&gt;

&lt;P&gt;The `np.fromfunction` passes to function `g` three arrays of doubles, containing arrays `p`, `m`, `n` each of shape `(2*nz, 2*nx, 2*ny)`, hence each taking 6GB of memory each.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Computing `kz*p + kx*m + ky*n` verbatim creates multiple intermediate arrays for each sub-operation, then two calls to `np.multiply` generate more intermediate arrays, then a call to `np.exp` creates another intermediate array of complex doubles, which is then cast into a newly allocated array for compex singles.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Using Anaconda 5, and Intel Distribution for Python, on Intel(R) Xeon(R) CPU E5-2698 v3 @ 2.30GHz with 64GB of RAM, I get&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;# for Anaconda 5
In[3]: %time shift = np.fromfunction(g,(2*nz,2*nx,2*ny))
CPU times: user 1min 14s, sys: 31.6 s, total: 1min 46s
Wall time: 1min 48s

# for IDP 2018.0.0
In[3]: %time shift = np.fromfunction(g,(2*nz,2*nx,2*ny))
CPU times: user 2min, sys: 26.1 s, total: 2min 26s
Wall time: 1min 31s
&lt;/PRE&gt;

&lt;P&gt;However, writing those steps individually, I am able to achieve better performance and use less memory:&lt;/P&gt;

&lt;PRE class="brush:python;"&gt;def g2(p,m,n):
    tmp = kz*p
    ph = tmp.copy()
    np.copyto(tmp, m)
    tmp *= kx
    ph += tmp
    np.copyto(tmp, n)
    tmp *= ky
    ph += tmp
    ph *= 2*np.pi
    np.cos(ph, out=tmp)
    r = np.empty(tmp.shape, np.singlecomplex)
    r.real[:] = tmp
    np.sin(ph, out=tmp)
    del ph
    r.imag[:] = tmp
    return r
&lt;/PRE&gt;

&lt;P&gt;Now, running&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;# Anaconda 5
In[4]: %time shift2 = np.fromfunction(g2,(2*nz,2*nx,2*ny))
CPU times: user 54.2 s, sys: 18.5 s, total: 1min 12s
Wall time: 1min 12s


# IDP 2018.0.0
In[4]: %time shift2 = np.fromfunction(g2,(2*nz,2*nx,2*ny))
CPU times: user 1min 24s, sys: 17.6 s, total: 1min 42s
Wall time: 16.3 s
&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	Similarly, in order to be mindful of intermediate expressions, you should perform `np.roll` on separate lines.&lt;BR /&gt;
	&lt;BR /&gt;
	Furthermore, it is probably best to create `shift` array in blocks, and combine result.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 18:15:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144371#M1006</guid>
      <dc:creator>Oleksandr_P_Intel</dc:creator>
      <dc:date>2017-10-19T18:15:03Z</dc:date>
    </item>
    <item>
      <title>I used a smaller machine and</title>
      <link>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144372#M1007</link>
      <description>&lt;P&gt;I used a smaller machine and got MemoryError even for your numpy code:&lt;/P&gt;

&lt;PRE class="brush:python;"&gt;In [1]: import numpy as np
   ...: (kx, ky, kz, nx, ny, nz) = (-0.21445783132530122, -0.21445783132530122, 0, 512, 512, 390)
   ...:

In [2]: g = lambda p,m,n: np.exp(2j*np.pi*(kz*p+kx*m+ky*n)).astype(np.complex64)

In [3]: %time shift = np.fromfunction(g,(2*nz,2*nx,2*ny))
---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
&amp;lt;timed exec&amp;gt; in &amp;lt;module&amp;gt;()

/home/miniconda3/envs/intel3/lib/python3.6/site-packages/numpy/core/numeric.py in fromfunction(function, shape, **kwargs)
   2130     dtype = kwargs.pop('dtype', float)
   2131     args = indices(shape, dtype=dtype)
-&amp;gt; 2132     return function(*args, **kwargs)
   2133
   2134

&amp;lt;ipython-input-2-89b938ec44bd&amp;gt; in &amp;lt;lambda&amp;gt;(p, m, n)
----&amp;gt; 1 g = lambda p,m,n: np.exp(2j*np.pi*(kz*p+kx*m+ky*n)).astype(np.complex64)

MemoryError:
&lt;/PRE&gt;

&lt;P&gt;then, I used Dask in order to split array in chunks:&lt;/P&gt;

&lt;PRE class="brush:python;"&gt;In [10]: import dask
    ...: import dask.array as da

In [11]: %time shift = da.fromfunction(g, shape=(2*nz,2*nx,2*ny), dtype=np.double, chunks=(32,32,32)).compute(get=dask.local.get_sync)
CPU times: user 1min 7s, sys: 24.1 s, total: 1min 31s
Wall time: 1min 34s&lt;/PRE&gt;

&lt;P&gt;It works!&lt;/P&gt;

&lt;P&gt;As for whether Numba in IDfP works slower, we cannot reproduce it having sufficient memory on the machine for the computation.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 22:19:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-for-Python/Use-numba-in-intel-python-environment-but-get-more-running-time/m-p/1144372#M1007</guid>
      <dc:creator>Anton_M_Intel</dc:creator>
      <dc:date>2017-10-19T22:19:00Z</dc:date>
    </item>
  </channel>
</rss>

