When I try to mesure only CPU consumption time in MNIST, but failed to get with following error on PyTorch 0.4.0.
Of course, without measurement works fine.
How to avoid this issue?
$ python main.py --no-cuda   (it works fine.)
$ python -m torch.utils.bottleneck main.py --no-cuda (it is failed with following error.)
bottleneck is a tool that can be used as an initial step for debugging
bottlenecks in your program.
It summarizes runs of your script with the Python profiler and PyTorch’s
autograd profiler. Because your script will be profiled, please ensure that it
exits in a finite amount of time.
For more complicated uses of the profilers, please see
https://docs.python.org/3/library/profile.html 9 and
http://pytorch.org/docs/master/autograd.html#profiler 3 for more information.
Running environment analysis…
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCTensorRandom.cu line=25 error=2 : out of memory
Traceback (most recent call last):
File “/opt/conda/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
“main”, mod_spec)
File “/opt/conda/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/opt/conda/lib/python3.6/site-packages/torch/utils/bottleneck/main.py”, line 280, in 
main()
File “/opt/conda/lib/python3.6/site-packages/torch/utils/bottleneck/main.py”, line 259, in main
torch.cuda.init()
File “/opt/conda/lib/python3.6/site-packages/torch/cuda/init.py”, line 143, in init
_lazy_init()
File “/opt/conda/lib/python3.6/site-packages/torch/cuda/init.py”, line 161, in _lazy_init
torch._C._cuda_init()
RuntimeError: cuda runtime error (2) : out of memory at /pytorch/aten/src/THC/THCTensorRandom.cu:25
References
MNIST source code
https://github.com/pytorch/examples/blob/master/mnist/main.py 3
Bottleneck description
https://pytorch.org/docs/stable/bottleneck.html 9
Related issue (source code is not attached.)
RuntimeError: cuda runtime error (2) : out of memory at /pytorch/aten/src/THC/THCTensorRandom.cu:25