-
Notifications
You must be signed in to change notification settings - Fork 14
Description
hi, i got a problem when running the example code, it comes out the error:
RuntimeError: CUDA out of memory :Tried to allocate 183.75 GiB (GPU 0; 12.00 GiB total capacity; 4.98 GiB already allocated; 0 bytes free; 23.62 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
CODE HERE:
file_path = 'E:/seismic/'
file_name = "Eureka-DT1087-2m-P5kHz-fs250Hz_2022-06-18T112221Z.h5"
normalize = lambda x: (x - np.mean(x, axis=-1, keepdims=True)) / np.std(x, axis=-1, keepdims=True)
with h5py.File(file_path+file_name, "r") as fp:
dx = fp["Acquisition"].attrs["SpatialSamplingInterval"]
fs = fp['Acquisition/Raw[0]'].attrs["OutputDataRate"]
dt = 1.0 / fs
data = fp["Acquisition/Raw[0]/RawData"][...]
data = np.gradient(data, axis=-1) / dt
nx, nt = data.shape
x = np.arange(nx) * dx
t = np.arange(nt) * dt
ngpu = torch.cuda.device_count()
format=h5 --batch_size 1 --workers 0"
base_cmd = (
"EQNet/predict.py "
"--model phasenet_das "
"--data_list=D:/AnacondaProject/3d/files.txt " #
"--data_path=E:/seismic " #
"--result_path=E:/seismic " #
"--format=h5 "
"--batch_size=1 "
"--workers=0"
)
if ngpu == 0:
cmd = f"python {base_cmd} --device cpu --system optasense"
elif ngpu == 1:
cmd = f"python {base_cmd} --system optasense"
else:
cmd = f"torchrun --nproc_per_node {ngpu} {base_cmd} --system optasense"
print(cmd)
os.system(cmd)