<div dir="ltr">In addition to what Sebastian said about memory fragmentation and OS limits about memory allocations, I do think it will be hard to work with an array that close to the memory limit in NumPy regardless. Almost any operation will need to make a temporary array and exceed your memory limit. You might want to look at Dask Array for a NumPy-like API for working with chunked arrays that can be staged in and out of memory:<div><br></div><div><a href="https://docs.dask.org/en/latest/array.html">https://docs.dask.org/en/latest/array.html</a><br></div><div><br></div><div>As a bonus, Dask will also let you make better use of the large number of CPU cores that you likely have in your 1.9 TB RAM system. :)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 24, 2020 at 1:00 PM Keyvis Damptey <<a href="mailto:quantkeyvis@gmail.com">quantkeyvis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hi Numpy dev community,<div dir="auto"><br></div><div dir="auto"><div style="font-family:sans-serif;font-size:12.8px" dir="auto"><div style="width:328px;margin:16px 0px"><div><div dir="ltr"><div>I'm keyvis, a statistical data scientist.</div><div><br></div><div>I'm currently using numpy in python 3.8.2 64-bit for a clustering problem, on a machine with 1.9 TB RAM. When I try using np.zeros to create a 600,000 by 600,000 matrix of dtype=np.float32 it says<br></div><div>"Unable to allocate 1.31 TiB for an array with shape (600000, 600000) and data type float32"</div><div><br></div><div>I used psutils to determine how much RAM python thinks it has access to and it return with 1.8 TB approx.<br></div><div><br></div><div>Is there some way I can fix numpy to create these large arrays?</div></div></div></div><div style="height:0px"></div></div>Thanks for your time and consideration</div></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>