We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
ROCm: `cupy.show_config()` not working
```
$ python -c "import cupy; cupy.show_config()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/leofang/dev/cupy_rocm3.5.0/cupy/__init__.py", line 874, in show_config
    _sys.stdout.write(str(_cupyx.get_runtime_info()))
  File "/home/leofang/dev/cupy_rocm3.5.0/cupyx/_runtime.py", line 215, in __str__
    props['name'].decode('utf-8')),
AttributeError: 'str' object has no attribute 'decode'
```
Following #3858, I will add another branching to `getDeviceProperties` to support HIP.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cupyx/_runtime.py`
Content:
```
1 import inspect
2 import io
3 import os
4 import platform
5 
6 import numpy
7 
8 import cupy
9 
10 try:
11     import cupy.cuda.thrust as thrust
12 except ImportError:
13     thrust = None
14 
15 try:
16     import cupy_backends.cuda.libs.cudnn as cudnn
17 except ImportError:
18     cudnn = None
19 
20 try:
21     import cupy.cuda.nccl as nccl
22 except ImportError:
23     nccl = None
24 
25 try:
26     import cupy.cuda.cub as cub
27 except ImportError:
28     cub = None
29 
30 try:
31     import cupy_backends.cuda.libs.cutensor as cutensor
32 except ImportError:
33     cutensor = None
34 
35 try:
36     import scipy
37 except ImportError:
38     scipy = None
39 
40 
41 def _eval_or_error(func, errors):
42     # Evaluates `func` and return the result.
43     # If an error specified by `errors` occured, it returns a string
44     # representing the error.
45     try:
46         return func()
47     except errors as e:
48         return repr(e)
49 
50 
51 class _InstallInfo(object):
52 
53     # TODO(niboshi): Add is_binary_distribution
54 
55     def __init__(self):
56         cupy_package_root = self._get_cupy_package_root()
57         if cupy_package_root is not None:
58             data_root = os.path.join(cupy_package_root, '.data')
59             data_paths = {
60                 'lib': _dir_or_none(os.path.join(data_root, 'lib')),
61                 'include': _dir_or_none(os.path.join(data_root, 'include')),
62             }
63         else:
64             data_paths = {
65                 'lib': None,
66                 'include': None,
67             }
68 
69         self.cupy_package_root = cupy_package_root
70         self.data_paths = data_paths
71 
72     def get_data_path(self, data_type):
73         if data_type not in self.data_paths:
74             raise ValueError('Invalid data type: {}'.format(data_type))
75         return self.data_paths[data_type]
76 
77     def _get_cupy_package_root(self):
78         try:
79             cupy_path = inspect.getfile(cupy)
80         except TypeError:
81             return None
82         return os.path.dirname(cupy_path)
83 
84 
85 class _RuntimeInfo(object):
86 
87     cupy_version = None
88     cuda_path = None
89 
90     # CUDA Driver
91     cuda_build_version = None
92     cuda_driver_version = None
93 
94     # CUDA Runtime
95     cuda_runtime_version = None
96 
97     # CUDA Toolkit
98     cublas_version = None
99     cufft_version = None
100     curand_version = None
101     cusolver_version = None
102     cusparse_version = None
103     nvrtc_version = None
104     thrust_version = None
105 
106     # Optional Libraries
107     cudnn_build_version = None
108     cudnn_version = None
109     nccl_build_version = None
110     nccl_runtime_version = None
111     cub_build_version = None
112     cutensor_version = None
113 
114     numpy_version = None
115     scipy_version = None
116 
117     def __init__(self):
118         self.cupy_version = cupy.__version__
119 
120         self.cuda_path = cupy.cuda.get_cuda_path()
121 
122         self.cuda_build_version = cupy.cuda.driver.get_build_version()
123         self.cuda_driver_version = _eval_or_error(
124             cupy.cuda.runtime.driverGetVersion,
125             cupy.cuda.runtime.CUDARuntimeError)
126 
127         self.cuda_runtime_version = _eval_or_error(
128             cupy.cuda.runtime.runtimeGetVersion,
129             cupy.cuda.runtime.CUDARuntimeError)
130 
131         self.cublas_version = _eval_or_error(
132             lambda: cupy.cuda.cublas.getVersion(
133                 cupy.cuda.device.get_cublas_handle()),
134             cupy.cuda.cublas.CUBLASError)
135         self.cufft_version = _eval_or_error(
136             cupy.cuda.cufft.getVersion,
137             cupy.cuda.cufft.CuFFTError)
138         self.curand_version = _eval_or_error(
139             cupy.cuda.curand.getVersion,
140             cupy.cuda.curand.CURANDError)
141         self.cusolver_version = _eval_or_error(
142             cupy.cuda.cusolver._getVersion,
143             cupy.cuda.cusolver.CUSOLVERError)
144         self.cusparse_version = _eval_or_error(
145             lambda: cupy.cuda.cusparse.getVersion(
146                 cupy.cuda.device.get_cusparse_handle()),
147             cupy.cuda.cusparse.CuSparseError)
148         self.nvrtc_version = _eval_or_error(
149             cupy.cuda.nvrtc.getVersion,
150             cupy.cuda.nvrtc.NVRTCError)
151 
152         if thrust is not None:
153             self.thrust_version = thrust.get_build_version()
154 
155         if cudnn is not None:
156             self.cudnn_build_version = cudnn.get_build_version()
157             self.cudnn_version = _eval_or_error(
158                 cudnn.getVersion, cudnn.CuDNNError)
159 
160         if nccl is not None:
161             self.nccl_build_version = nccl.get_build_version()
162             nccl_runtime_version = nccl.get_version()
163             if nccl_runtime_version == 0:
164                 nccl_runtime_version = '(unknown)'
165             self.nccl_runtime_version = nccl_runtime_version
166 
167         if cub is not None:
168             self.cub_build_version = cub.get_build_version()
169 
170         if cutensor is not None:
171             self.cutensor_version = cutensor.get_version()
172 
173         self.numpy_version = numpy.version.full_version
174         if scipy is not None:
175             self.scipy_version = scipy.version.full_version
176 
177     def __str__(self):
178         records = [
179             ('OS',  platform.platform()),
180             ('CuPy Version', self.cupy_version),
181             ('NumPy Version', self.numpy_version),
182             ('SciPy Version', self.scipy_version),
183             ('CUDA Root', self.cuda_path),
184 
185             ('CUDA Build Version', self.cuda_build_version),
186             ('CUDA Driver Version', self.cuda_driver_version),
187 
188             ('CUDA Runtime Version', self.cuda_runtime_version),
189         ]
190 
191         records += [
192             ('cuBLAS Version', self.cublas_version),
193             ('cuFFT Version', self.cufft_version),
194             ('cuRAND Version', self.curand_version),
195             ('cuSOLVER Version', self.cusolver_version),
196             ('cuSPARSE Version', self.cusparse_version),
197             ('NVRTC Version', self.nvrtc_version),
198             ('Thrust Version', self.thrust_version),
199             ('CUB Build Version', self.cub_build_version),
200         ]
201 
202         records += [
203             ('cuDNN Build Version', self.cudnn_build_version),
204             ('cuDNN Version', self.cudnn_version),
205             ('NCCL Build Version', self.nccl_build_version),
206             ('NCCL Runtime Version', self.nccl_runtime_version),
207             ('cuTENSOR Version', self.cutensor_version),
208         ]
209 
210         for device_id in range(cupy.cuda.runtime.getDeviceCount()):
211             with cupy.cuda.Device(device_id) as device:
212                 props = cupy.cuda.runtime.getDeviceProperties(device_id)
213                 records += [
214                     ('Device {} Name'.format(device_id),
215                      props['name'].decode('utf-8')),
216                     ('Device {} Compute Capability'.format(device_id),
217                      device.compute_capability),
218                 ]
219 
220         width = max([len(r[0]) for r in records]) + 2
221         fmt = '{:' + str(width) + '}: {}\n'
222         s = io.StringIO()
223         for k, v in records:
224             s.write(fmt.format(k, v))
225 
226         return s.getvalue()
227 
228 
229 def get_runtime_info():
230     return _RuntimeInfo()
231 
232 
233 def get_install_info():
234     return _InstallInfo()
235 
236 
237 def _dir_or_none(path):
238     """Returns None if path does not exist."""
239     if os.path.isdir(path):
240         return path
241     return None
242
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cupyx/_runtime.py b/cupyx/_runtime.py
--- a/cupyx/_runtime.py
+++ b/cupyx/_runtime.py
@@ -6,6 +6,7 @@
 import numpy
 
 import cupy
+import cupy_backends
 
 try:
     import cupy.cuda.thrust as thrust
@@ -37,6 +38,8 @@
 except ImportError:
     scipy = None
 
+is_hip = cupy_backends.cuda.api.runtime.is_hip
+
 
 def _eval_or_error(func, errors):
     # Evaluates `func` and return the result.
@@ -117,7 +120,10 @@
     def __init__(self):
         self.cupy_version = cupy.__version__
 
-        self.cuda_path = cupy.cuda.get_cuda_path()
+        if not is_hip:
+            self.cuda_path = cupy.cuda.get_cuda_path()
+        else:
+            self.cuda_path = cupy._environment.get_rocm_path()
 
         self.cuda_build_version = cupy.cuda.driver.get_build_version()
         self.cuda_driver_version = _eval_or_error(

{"golden_diff": "diff --git a/cupyx/_runtime.py b/cupyx/_runtime.py\n--- a/cupyx/_runtime.py\n+++ b/cupyx/_runtime.py\n@@ -6,6 +6,7 @@\n import numpy\n \n import cupy\n+import cupy_backends\n \n try:\n     import cupy.cuda.thrust as thrust\n@@ -37,6 +38,8 @@\n except ImportError:\n     scipy = None\n \n+is_hip = cupy_backends.cuda.api.runtime.is_hip\n+\n \n def _eval_or_error(func, errors):\n     # Evaluates `func` and return the result.\n@@ -117,7 +120,10 @@\n     def __init__(self):\n         self.cupy_version = cupy.__version__\n \n-        self.cuda_path = cupy.cuda.get_cuda_path()\n+        if not is_hip:\n+            self.cuda_path = cupy.cuda.get_cuda_path()\n+        else:\n+            self.cuda_path = cupy._environment.get_rocm_path()\n \n         self.cuda_build_version = cupy.cuda.driver.get_build_version()\n         self.cuda_driver_version = _eval_or_error(\n", "issue": "ROCm: `cupy.show_config()` not working\n```\r\n$ python -c \"import cupy; cupy.show_config()\"\r\nTraceback (most recent call last):\r\n  File \"<string>\", line 1, in <module>\r\n  File \"/home/leofang/dev/cupy_rocm3.5.0/cupy/__init__.py\", line 874, in show_config\r\n    _sys.stdout.write(str(_cupyx.get_runtime_info()))\r\n  File \"/home/leofang/dev/cupy_rocm3.5.0/cupyx/_runtime.py\", line 215, in __str__\r\n    props['name'].decode('utf-8')),\r\nAttributeError: 'str' object has no attribute 'decode'\r\n```\r\nFollowing #3858, I will add another branching to `getDeviceProperties` to support HIP.\n", "before_files": [{"content": "import inspect\nimport io\nimport os\nimport platform\n\nimport numpy\n\nimport cupy\n\ntry:\n    import cupy.cuda.thrust as thrust\nexcept ImportError:\n    thrust = None\n\ntry:\n    import cupy_backends.cuda.libs.cudnn as cudnn\nexcept ImportError:\n    cudnn = None\n\ntry:\n    import cupy.cuda.nccl as nccl\nexcept ImportError:\n    nccl = None\n\ntry:\n    import cupy.cuda.cub as cub\nexcept ImportError:\n    cub = None\n\ntry:\n    import cupy_backends.cuda.libs.cutensor as cutensor\nexcept ImportError:\n    cutensor = None\n\ntry:\n    import scipy\nexcept ImportError:\n    scipy = None\n\n\ndef _eval_or_error(func, errors):\n    # Evaluates `func` and return the result.\n    # If an error specified by `errors` occured, it returns a string\n    # representing the error.\n    try:\n        return func()\n    except errors as e:\n        return repr(e)\n\n\nclass _InstallInfo(object):\n\n    # TODO(niboshi): Add is_binary_distribution\n\n    def __init__(self):\n        cupy_package_root = self._get_cupy_package_root()\n        if cupy_package_root is not None:\n            data_root = os.path.join(cupy_package_root, '.data')\n            data_paths = {\n                'lib': _dir_or_none(os.path.join(data_root, 'lib')),\n                'include': _dir_or_none(os.path.join(data_root, 'include')),\n            }\n        else:\n            data_paths = {\n                'lib': None,\n                'include': None,\n            }\n\n        self.cupy_package_root = cupy_package_root\n        self.data_paths = data_paths\n\n    def get_data_path(self, data_type):\n        if data_type not in self.data_paths:\n            raise ValueError('Invalid data type: {}'.format(data_type))\n        return self.data_paths[data_type]\n\n    def _get_cupy_package_root(self):\n        try:\n            cupy_path = inspect.getfile(cupy)\n        except TypeError:\n            return None\n        return os.path.dirname(cupy_path)\n\n\nclass _RuntimeInfo(object):\n\n    cupy_version = None\n    cuda_path = None\n\n    # CUDA Driver\n    cuda_build_version = None\n    cuda_driver_version = None\n\n    # CUDA Runtime\n    cuda_runtime_version = None\n\n    # CUDA Toolkit\n    cublas_version = None\n    cufft_version = None\n    curand_version = None\n    cusolver_version = None\n    cusparse_version = None\n    nvrtc_version = None\n    thrust_version = None\n\n    # Optional Libraries\n    cudnn_build_version = None\n    cudnn_version = None\n    nccl_build_version = None\n    nccl_runtime_version = None\n    cub_build_version = None\n    cutensor_version = None\n\n    numpy_version = None\n    scipy_version = None\n\n    def __init__(self):\n        self.cupy_version = cupy.__version__\n\n        self.cuda_path = cupy.cuda.get_cuda_path()\n\n        self.cuda_build_version = cupy.cuda.driver.get_build_version()\n        self.cuda_driver_version = _eval_or_error(\n            cupy.cuda.runtime.driverGetVersion,\n            cupy.cuda.runtime.CUDARuntimeError)\n\n        self.cuda_runtime_version = _eval_or_error(\n            cupy.cuda.runtime.runtimeGetVersion,\n            cupy.cuda.runtime.CUDARuntimeError)\n\n        self.cublas_version = _eval_or_error(\n            lambda: cupy.cuda.cublas.getVersion(\n                cupy.cuda.device.get_cublas_handle()),\n            cupy.cuda.cublas.CUBLASError)\n        self.cufft_version = _eval_or_error(\n            cupy.cuda.cufft.getVersion,\n            cupy.cuda.cufft.CuFFTError)\n        self.curand_version = _eval_or_error(\n            cupy.cuda.curand.getVersion,\n            cupy.cuda.curand.CURANDError)\n        self.cusolver_version = _eval_or_error(\n            cupy.cuda.cusolver._getVersion,\n            cupy.cuda.cusolver.CUSOLVERError)\n        self.cusparse_version = _eval_or_error(\n            lambda: cupy.cuda.cusparse.getVersion(\n                cupy.cuda.device.get_cusparse_handle()),\n            cupy.cuda.cusparse.CuSparseError)\n        self.nvrtc_version = _eval_or_error(\n            cupy.cuda.nvrtc.getVersion,\n            cupy.cuda.nvrtc.NVRTCError)\n\n        if thrust is not None:\n            self.thrust_version = thrust.get_build_version()\n\n        if cudnn is not None:\n            self.cudnn_build_version = cudnn.get_build_version()\n            self.cudnn_version = _eval_or_error(\n                cudnn.getVersion, cudnn.CuDNNError)\n\n        if nccl is not None:\n            self.nccl_build_version = nccl.get_build_version()\n            nccl_runtime_version = nccl.get_version()\n            if nccl_runtime_version == 0:\n                nccl_runtime_version = '(unknown)'\n            self.nccl_runtime_version = nccl_runtime_version\n\n        if cub is not None:\n            self.cub_build_version = cub.get_build_version()\n\n        if cutensor is not None:\n            self.cutensor_version = cutensor.get_version()\n\n        self.numpy_version = numpy.version.full_version\n        if scipy is not None:\n            self.scipy_version = scipy.version.full_version\n\n    def __str__(self):\n        records = [\n            ('OS',  platform.platform()),\n            ('CuPy Version', self.cupy_version),\n            ('NumPy Version', self.numpy_version),\n            ('SciPy Version', self.scipy_version),\n            ('CUDA Root', self.cuda_path),\n\n            ('CUDA Build Version', self.cuda_build_version),\n            ('CUDA Driver Version', self.cuda_driver_version),\n\n            ('CUDA Runtime Version', self.cuda_runtime_version),\n        ]\n\n        records += [\n            ('cuBLAS Version', self.cublas_version),\n            ('cuFFT Version', self.cufft_version),\n            ('cuRAND Version', self.curand_version),\n            ('cuSOLVER Version', self.cusolver_version),\n            ('cuSPARSE Version', self.cusparse_version),\n            ('NVRTC Version', self.nvrtc_version),\n            ('Thrust Version', self.thrust_version),\n            ('CUB Build Version', self.cub_build_version),\n        ]\n\n        records += [\n            ('cuDNN Build Version', self.cudnn_build_version),\n            ('cuDNN Version', self.cudnn_version),\n            ('NCCL Build Version', self.nccl_build_version),\n            ('NCCL Runtime Version', self.nccl_runtime_version),\n            ('cuTENSOR Version', self.cutensor_version),\n        ]\n\n        for device_id in range(cupy.cuda.runtime.getDeviceCount()):\n            with cupy.cuda.Device(device_id) as device:\n                props = cupy.cuda.runtime.getDeviceProperties(device_id)\n                records += [\n                    ('Device {} Name'.format(device_id),\n                     props['name'].decode('utf-8')),\n                    ('Device {} Compute Capability'.format(device_id),\n                     device.compute_capability),\n                ]\n\n        width = max([len(r[0]) for r in records]) + 2\n        fmt = '{:' + str(width) + '}: {}\\n'\n        s = io.StringIO()\n        for k, v in records:\n            s.write(fmt.format(k, v))\n\n        return s.getvalue()\n\n\ndef get_runtime_info():\n    return _RuntimeInfo()\n\n\ndef get_install_info():\n    return _InstallInfo()\n\n\ndef _dir_or_none(path):\n    \"\"\"Returns None if path does not exist.\"\"\"\n    if os.path.isdir(path):\n        return path\n    return None\n", "path": "cupyx/_runtime.py"}], "after_files": [{"content": "import inspect\nimport io\nimport os\nimport platform\n\nimport numpy\n\nimport cupy\nimport cupy_backends\n\ntry:\n    import cupy.cuda.thrust as thrust\nexcept ImportError:\n    thrust = None\n\ntry:\n    import cupy_backends.cuda.libs.cudnn as cudnn\nexcept ImportError:\n    cudnn = None\n\ntry:\n    import cupy.cuda.nccl as nccl\nexcept ImportError:\n    nccl = None\n\ntry:\n    import cupy.cuda.cub as cub\nexcept ImportError:\n    cub = None\n\ntry:\n    import cupy_backends.cuda.libs.cutensor as cutensor\nexcept ImportError:\n    cutensor = None\n\ntry:\n    import scipy\nexcept ImportError:\n    scipy = None\n\nis_hip = cupy_backends.cuda.api.runtime.is_hip\n\n\ndef _eval_or_error(func, errors):\n    # Evaluates `func` and return the result.\n    # If an error specified by `errors` occured, it returns a string\n    # representing the error.\n    try:\n        return func()\n    except errors as e:\n        return repr(e)\n\n\nclass _InstallInfo(object):\n\n    # TODO(niboshi): Add is_binary_distribution\n\n    def __init__(self):\n        cupy_package_root = self._get_cupy_package_root()\n        if cupy_package_root is not None:\n            data_root = os.path.join(cupy_package_root, '.data')\n            data_paths = {\n                'lib': _dir_or_none(os.path.join(data_root, 'lib')),\n                'include': _dir_or_none(os.path.join(data_root, 'include')),\n            }\n        else:\n            data_paths = {\n                'lib': None,\n                'include': None,\n            }\n\n        self.cupy_package_root = cupy_package_root\n        self.data_paths = data_paths\n\n    def get_data_path(self, data_type):\n        if data_type not in self.data_paths:\n            raise ValueError('Invalid data type: {}'.format(data_type))\n        return self.data_paths[data_type]\n\n    def _get_cupy_package_root(self):\n        try:\n            cupy_path = inspect.getfile(cupy)\n        except TypeError:\n            return None\n        return os.path.dirname(cupy_path)\n\n\nclass _RuntimeInfo(object):\n\n    cupy_version = None\n    cuda_path = None\n\n    # CUDA Driver\n    cuda_build_version = None\n    cuda_driver_version = None\n\n    # CUDA Runtime\n    cuda_runtime_version = None\n\n    # CUDA Toolkit\n    cublas_version = None\n    cufft_version = None\n    curand_version = None\n    cusolver_version = None\n    cusparse_version = None\n    nvrtc_version = None\n    thrust_version = None\n\n    # Optional Libraries\n    cudnn_build_version = None\n    cudnn_version = None\n    nccl_build_version = None\n    nccl_runtime_version = None\n    cub_build_version = None\n    cutensor_version = None\n\n    numpy_version = None\n    scipy_version = None\n\n    def __init__(self):\n        self.cupy_version = cupy.__version__\n\n        if not is_hip:\n            self.cuda_path = cupy.cuda.get_cuda_path()\n        else:\n            self.cuda_path = cupy._environment.get_rocm_path()\n\n        self.cuda_build_version = cupy.cuda.driver.get_build_version()\n        self.cuda_driver_version = _eval_or_error(\n            cupy.cuda.runtime.driverGetVersion,\n            cupy.cuda.runtime.CUDARuntimeError)\n\n        self.cuda_runtime_version = _eval_or_error(\n            cupy.cuda.runtime.runtimeGetVersion,\n            cupy.cuda.runtime.CUDARuntimeError)\n\n        self.cublas_version = _eval_or_error(\n            lambda: cupy.cuda.cublas.getVersion(\n                cupy.cuda.device.get_cublas_handle()),\n            cupy.cuda.cublas.CUBLASError)\n        self.cufft_version = _eval_or_error(\n            cupy.cuda.cufft.getVersion,\n            cupy.cuda.cufft.CuFFTError)\n        self.curand_version = _eval_or_error(\n            cupy.cuda.curand.getVersion,\n            cupy.cuda.curand.CURANDError)\n        self.cusolver_version = _eval_or_error(\n            cupy.cuda.cusolver._getVersion,\n            cupy.cuda.cusolver.CUSOLVERError)\n        self.cusparse_version = _eval_or_error(\n            lambda: cupy.cuda.cusparse.getVersion(\n                cupy.cuda.device.get_cusparse_handle()),\n            cupy.cuda.cusparse.CuSparseError)\n        self.nvrtc_version = _eval_or_error(\n            cupy.cuda.nvrtc.getVersion,\n            cupy.cuda.nvrtc.NVRTCError)\n\n        if thrust is not None:\n            self.thrust_version = thrust.get_build_version()\n\n        if cudnn is not None:\n            self.cudnn_build_version = cudnn.get_build_version()\n            self.cudnn_version = _eval_or_error(\n                cudnn.getVersion, cudnn.CuDNNError)\n\n        if nccl is not None:\n            self.nccl_build_version = nccl.get_build_version()\n            nccl_runtime_version = nccl.get_version()\n            if nccl_runtime_version == 0:\n                nccl_runtime_version = '(unknown)'\n            self.nccl_runtime_version = nccl_runtime_version\n\n        if cub is not None:\n            self.cub_build_version = cub.get_build_version()\n\n        if cutensor is not None:\n            self.cutensor_version = cutensor.get_version()\n\n        self.numpy_version = numpy.version.full_version\n        if scipy is not None:\n            self.scipy_version = scipy.version.full_version\n\n    def __str__(self):\n        records = [\n            ('OS',  platform.platform()),\n            ('CuPy Version', self.cupy_version),\n            ('NumPy Version', self.numpy_version),\n            ('SciPy Version', self.scipy_version),\n            ('CUDA Root', self.cuda_path),\n\n            ('CUDA Build Version', self.cuda_build_version),\n            ('CUDA Driver Version', self.cuda_driver_version),\n\n            ('CUDA Runtime Version', self.cuda_runtime_version),\n        ]\n\n        records += [\n            ('cuBLAS Version', self.cublas_version),\n            ('cuFFT Version', self.cufft_version),\n            ('cuRAND Version', self.curand_version),\n            ('cuSOLVER Version', self.cusolver_version),\n            ('cuSPARSE Version', self.cusparse_version),\n            ('NVRTC Version', self.nvrtc_version),\n            ('Thrust Version', self.thrust_version),\n            ('CUB Build Version', self.cub_build_version),\n        ]\n\n        records += [\n            ('cuDNN Build Version', self.cudnn_build_version),\n            ('cuDNN Version', self.cudnn_version),\n            ('NCCL Build Version', self.nccl_build_version),\n            ('NCCL Runtime Version', self.nccl_runtime_version),\n            ('cuTENSOR Version', self.cutensor_version),\n        ]\n\n        for device_id in range(cupy.cuda.runtime.getDeviceCount()):\n            with cupy.cuda.Device(device_id) as device:\n                props = cupy.cuda.runtime.getDeviceProperties(device_id)\n                records += [\n                    ('Device {} Name'.format(device_id),\n                     props['name'].decode('utf-8')),\n                    ('Device {} Compute Capability'.format(device_id),\n                     device.compute_capability),\n                ]\n\n        width = max([len(r[0]) for r in records]) + 2\n        fmt = '{:' + str(width) + '}: {}\\n'\n        s = io.StringIO()\n        for k, v in records:\n            s.write(fmt.format(k, v))\n\n        return s.getvalue()\n\n\ndef get_runtime_info():\n    return _RuntimeInfo()\n\n\ndef get_install_info():\n    return _InstallInfo()\n\n\ndef _dir_or_none(path):\n    \"\"\"Returns None if path does not exist.\"\"\"\n    if os.path.isdir(path):\n        return path\n    return None\n", "path": "cupyx/_runtime.py"}]}