MemoryError: Unable to allocate 3.78 GiB for an array with shape (802, 842, 1502) and data type float32

Viewed 4427

I have results from a large simulation that I want to manipulate.

Now, it seems that it might be a bit too much for my computer to handle, as python stops and tells me:

MemoryError: Unable to allocate 3.78 GiB for an array with shape (802, 842, 1502)

and data type float32.

I do not manage to change /proc/sys/vm/overcommit_memory, as even with "sudo", the permission is denied.

So, I thought about reducing the precision of the numbers in the array, since the precision is important during the simulation to avoid accumulative errors, but less so afterwards.

Let's say the array is called A, I tried:

A = np.float16(A)

But obviously, to do that, you manipulate A, which is still in float32, and it raises the same error.

So...any better ideas?

0 Answers
Related