import numpy as np
import h5py
import sys
Ns, N, L, Nz = (40, 80, 3240, 160)
largeArray = np.zeros((Ns,N, L, Nz), dtype=complex)
for ids in range(Ns):
for n in range(N):
for l in range(L):
#calling a bunch of numerical operations with pybind11
#and storing the results into a largeArray
largeArray[ids, n, l]=ids+n+l*1j
f = h5py.File('myFile.hdf5', 'w')
f.create_dataset('largeArray', data=largeArray)
print('content:', largeArray.nbytes)
print('size:', sys.getsizeof(largeArray))
大数据块必须分配26.5GB,系统报告内存使用量为148GB。我假设内存管理器正在用硬盘交换内存中的数据,对吗?。我正在使用
pybind11
为了包装数值运算,我开始在最外层的循环中将数据分解成块(
ids
mpi
和
h5py
在里面
parallel