pytorch / tutorials

PyTorch tutorials.
https://pytorch.org/tutorials/
BSD 3-Clause "New" or "Revised" License
8.19k stars 4.06k forks source link

OSError: Missing: valgrind, callgrind_control, callgrind_annotate #2175

Open ghost opened 1 year ago

ghost commented 1 year ago

The error occurs on below step:

  1. Collecting instruction counts with Callgrind:

Traceback (most recent call last): File "benchmark.py", line 805, in stats_v0 = t0.collect_callgrind() File "/usr/local/lib/python3.8/dist-packages/torch/utils/benchmark/utils/timer.py", line 486, in collect_callgrind result = valgrind_timer_interface.wrapper_singleton().collect_callgrind( File "/usr/local/lib/python3.8/dist-packages/torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py", line 526, in collect_callgrind self._validate() File "/usr/local/lib/python3.8/dist-packages/torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py", line 512, in _validate raise OSError("Missing: " + ", ".join(missing_cmds)) OSError: Missing: valgrind, callgrind_control, callgrind_annotate

svekars commented 1 year ago

Thank you for notifying us about this issue! Can you please provide the following information:

ghost commented 1 year ago

Thank you for notifying us about this issue! Can you please provide the following information:

  • Link to the tutorial on the website
  • Version of PyTorch used
  • Environment in which the error occurs (i.e. Colab, macOS, Linux, etc.)
  1. Link to the tutorial on the website https://pytorch.org/tutorials/recipes/recipes/benchmark.html

  2. Version of PyTorch used

    import torch print(torch.version) 1.14.0a0+410ce96

  3. Environment in which the error occurs (i.e. Colab, macOS, Linux, etc.) Linux-based Nvidia DGX OS with nvidia pytorch docker image (nvcr.io/nvidia/pytorch:22.12-py3 )

and we had below error also.

Traceback (most recent call last): File "test8.py", line 30, in os.path.join(os.getenv('CONDA_PREFIX'), "include") File "/usr/lib/python3.8/posixpath.py", line 76, in join a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType

svekars commented 1 year ago

cc: @robieta @malfet @albanD Can you take a look?

albanD commented 1 year ago

Hi,

I think the error just says that to be able to run this part of the tutorial you will need to install valgrind. You should be able to install it with your OS package manager.

svekars commented 1 year ago

I think the error is actually different:

TypeError                                 Traceback (most recent call last)
[<ipython-input-16-5ae88987f723>](https://localhost:8080/#) in <module>
     28     extra_include_paths=[
     29         # `load_inline` needs to know where to find Pybind11 headers.
---> 30         os.path.join(os.getenv('CONDA_PREFIX'), 'include')
     31     ],
     32     functions=['batched_dot_mul_sum_v0', 'batched_dot_mul_sum_v1']

[/usr/lib/python3.8/posixpath.py](https://localhost:8080/#) in join(a, *p)
     74     will be discarded.  An empty last part will result in a path that
     75     ends with a separator."""
---> 76     a = os.fspath(a)
     77     sep = _get_sep(a)
     78     path = a

TypeError: expected str, bytes or os.PathLike object, not NoneType
albanD commented 1 year ago

That is the a different error from the one at the top yes.

In this case, https://github.com/pytorch/tutorials/blob/b24c7c3465879ba531844e16fb05bcbc21314abf/recipes_source/recipes/benchmark.py#L727 does assume that the user is using conda. Which is most likely wrong (but a different problem from the one at the top).