Skip to content

[HIP] Add extra exception handling for non-ROCM builds#83009

Closed
Gamrix wants to merge 4 commits intogh/gamrix/86/basefrom
gh/gamrix/86/head
Closed

[HIP] Add extra exception handling for non-ROCM builds#83009
Gamrix wants to merge 4 commits intogh/gamrix/86/basefrom
gh/gamrix/86/head

Conversation

@Gamrix
Copy link
Contributor

@Gamrix Gamrix commented Aug 8, 2022

Stack from ghstack:

I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'

Differential Revision: D38766067

I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

```
Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'
```

[ghstack-poisoned]
@pytorch-bot pytorch-bot bot added the module: rocm AMD GPU support for Pytorch label Aug 8, 2022
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Aug 8, 2022

🔗 Helpful links

✅ No Failures (0 Pending)

As of commit ce3ff23 (more details on the Dr. CI page):

Expand to see more

💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

Gamrix added a commit that referenced this pull request Aug 8, 2022
I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

```
Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'
```

ghstack-source-id: 58eedd3
Pull Request resolved: #83009
@Gamrix Gamrix requested review from cpuhrsch, malfet and robieta August 8, 2022 20:27
I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

```
Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'
```

[ghstack-poisoned]
Gamrix added a commit that referenced this pull request Aug 10, 2022
I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

```
Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'
```

ghstack-source-id: f473615
Pull Request resolved: #83009
Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but why we even running this one on MacOS?

@Gamrix
Copy link
Contributor Author

Gamrix commented Aug 10, 2022

The thing that I find most suspect is the topline import of
from .hipify import hipify_python
in
torch/utils/cpp_extension.py

I don't see any need for that module to be imported by default, and I think people are just being not mindful about what they import.

The change was introduced in #35897 . @ezyang , as the reviewer of that diff, do you know of any reason why we should have HIP import be a top level import for this file?

@ezyang
Copy link
Contributor

ezyang commented Aug 11, 2022

If you want to hide it behind actual use when we notice we're compiling a hipify that's fine. But imports are supposed to be fine at the top level unless they result in an import cycle.

@malfet
Copy link
Contributor

malfet commented Aug 11, 2022

Since this subprocess call is only triggered when one imports torch.utils.cpp_extension this is probably fine, though still a bit ugly

@Gamrix
Copy link
Contributor Author

Gamrix commented Aug 11, 2022

Seems like the best solution should be to not do the call to check if HIP is available in the module scope, and instead call it when used and cache the result.

@Gamrix
Copy link
Contributor Author

Gamrix commented Aug 15, 2022

@pytorchmergebot merge

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge job. Check the current status here.
The merge job was triggered without a flag. This means that your change will be merged once all checks on your PR have passed (ETA: 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the wiki.
Please reach out to the PyTorch DevX Team with feedback or questions!

@pytorchmergebot
Copy link
Collaborator

Merge failed due to This PR is too stale; the last push date was more than 3 days ago. Please rebase and try again.
Raised by https://github.com/pytorch/pytorch/actions/runs/2862361816

I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

```
Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'
```

[ghstack-poisoned]
Gamrix added a commit that referenced this pull request Aug 15, 2022
I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

```
Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'
```

ghstack-source-id: 6f79e7f
Pull Request resolved: #83009
@Gamrix
Copy link
Contributor Author

Gamrix commented Aug 15, 2022

[Windows tests are failing due to unrelated changes https://github.com//issues/83433 ]

I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

```
Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'
```

[ghstack-poisoned]
Gamrix added a commit that referenced this pull request Aug 16, 2022
I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

```
Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'
```

ghstack-source-id: 86da32e
Pull Request resolved: #83009
@Gamrix
Copy link
Contributor Author

Gamrix commented Aug 16, 2022

@pytorchmergebot merge

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge job. Check the current status here.
The merge job was triggered without a flag. This means that your change will be merged once all checks on your PR have passed (ETA: 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the wiki.
Please reach out to the PyTorch DevX Team with feedback or questions!

@pytorchmergebot
Copy link
Collaborator

Merge failed
Reason: This PR has internal changes and must be landed via Phabricator
Raised by https://github.com/pytorch/pytorch/actions/runs/2871548579

@Gamrix
Copy link
Contributor Author

Gamrix commented Aug 16, 2022

@Gamrix has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@Gamrix
Copy link
Contributor Author

Gamrix commented Aug 16, 2022

@pytorchmergebot merge

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge job. Check the current status here.
The merge job was triggered without a flag. This means that your change will be merged once all checks on your PR have passed (ETA: 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the wiki.
Please reach out to the PyTorch DevX Team with feedback or questions!

@pytorchmergebot
Copy link
Collaborator

Merge failed
Reason: This PR has internal changes and must be landed via Phabricator
Raised by https://github.com/pytorch/pytorch/actions/runs/2871652067

@Gamrix
Copy link
Contributor Author

Gamrix commented Aug 17, 2022

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge job. Check the current status here.
The merge job was triggered without a flag. This means that your change will be merged once all checks on your PR have passed (ETA: 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the wiki.
Please reach out to the PyTorch DevX Team with feedback or questions!

@github-actions
Copy link
Contributor

Hey @Gamrix.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

facebook-github-bot pushed a commit that referenced this pull request Aug 19, 2022
Summary:
I got the following error on OSX, which doesn't have HIP.
As this file is supposed to compile with non-HIP builds,
I added this error to the errors to ignore.

```
Traceback (most recent call last):
  File "test/test_profiler.py", line 31, in <module>
    from torch.profiler._pattern_matcher import (Pattern, NamePattern,
  File "/Users/jclow/pytorch3/torch/profiler/_pattern_matcher.py", line 9, in <module>
    import torch.utils.benchmark as benchmark
  File "/Users/jclow/pytorch3/torch/utils/benchmark/__init__.py", line 2, in <module>
    from torch.utils.benchmark.utils.timer import *  # noqa: F403
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/timer.py", line 8, in <module>
    from torch.utils.benchmark.utils import common, cpp_jit
  File "/Users/jclow/pytorch3/torch/utils/benchmark/utils/cpp_jit.py", line 13, in <module>
    from torch.utils import cpp_extension
  File "/Users/jclow/pytorch3/torch/utils/cpp_extension.py", line 19, in <module>
    from .hipify import hipify_python
  File "/Users/jclow/pytorch3/torch/utils/hipify/hipify_python.py", line 34, in <module>
    from .cuda_to_hip_mappings import CUDA_TO_HIP_MAPPINGS
  File "/Users/jclow/pytorch3/torch/utils/hipify/cuda_to_hip_mappings.py", line 34, in <module>
    rocm_path = subprocess.check_output(["hipconfig", "--rocmpath"]).decode("utf-8")
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/jclow/opt/anaconda3/envs/pytorch3/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'hipconfig'
```

Pull Request resolved: #83009
Approved by: https://github.com/malfet

Test Plan:
contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/30af17cea7e983b9e60354e05f7dcc2688183073

Original Phabricator Test Plan:
Imported from OSS

Reviewed By: atalman

Differential Revision: D38766067

Pulled By: Gamrix

fbshipit-source-id: 6fbda8d0939d2eb9113627350856340a05fa0222
@facebook-github-bot facebook-github-bot deleted the gh/gamrix/86/head branch August 21, 2022 14:19
except subprocess.CalledProcessError:
print(f"Warning: hipconfig --rocmpath failed, assuming {rocm_path}")
except FileNotFoundError:
except (FileNotFoundError, PermissionError):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gamrix How this can change anything? PermissionError was already handled with pass in the next lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, I think multiple people were fixing this at the same time. That line below was not there when I originally hit the error :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed Merged module: rocm AMD GPU support for Pytorch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants