use paddle's profiler

This commit is contained in:
chenfeiyu 2021-06-16 13:43:13 +00:00
parent 8dbcc9bccb
commit 042e02d242
2 changed files with 5 additions and 3 deletions

View File

@ -171,8 +171,9 @@ def train_sp(args, config):
updater,
stop_trigger=(10, "iteration"), # PROFILING
out=output_dir, )
with paddle.fluid.profiler.cuda_profiler(
str(output_dir / "profiler.log")) as prof:
with paddle.fluid.profiler.profiler('All', 'total',
str(output_dir / "profiler.log"),
'Default') as prof:
trainer.run()

View File

@ -48,7 +48,8 @@ def read_hdf5(filename: Union[Path, str], dataset_name: str) -> Any:
f"There is no such a data in hdf5 file. ({dataset_name})")
sys.exit(1)
hdf5_data = hdf5_file[dataset_name][()] # a special syntax of h5py
# [()]: a special syntax of h5py to get the dataset as-is
hdf5_data = hdf5_file[dataset_name][()]
hdf5_file.close()
return hdf5_data