I'm trying to fill an array of size 2 ^ 32 and at a certain stage of filling it gives out that the process was killed
def MakeArr(n):
start_time = time.time()
arr = np.random.randint(1, 2**n, size=2**n, dtype=np.int64)
print(arr)
print("Time to create: %s sec" % (time.time() - start_time))
print("arr len:" str(len(arr)))
return arr
sys.setrecursionlimit(1500); n = 32; arr = MakeArr(n)
CodePudding user response:
An array of 2^32 may be too large for python or numpy to handle. You may be able to get a bigger array by changing the dtype to a lower one, like np.int8
.