We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Emit warning if compiled in Debug mode
In debug mode ChainerX runs significantly slower.
However sometimes it's difficult notice that.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `chainerx/__init__.py`
Content:
```
1 import os
2 import sys
3 
4 
5 if sys.version_info[0] < 3:
6     _available = False
7 else:
8     try:
9         from chainerx import _core
10         _available = True
11     except Exception:
12         _available = False
13 
14 
15 if _available:
16     from numpy import dtype  # NOQA
17     from numpy import (
18         bool_, int8, int16, int32, int64, uint8, float16, float32, float64)  # NOQA
19     all_dtypes = (
20         bool_, int8, int16, int32, int64, uint8, float16, float32, float64)
21 
22     from chainerx._core import *  # NOQA
23     from chainerx._core import _to_cupy  # NOQA
24 
25     from builtins import bool, int, float  # NOQA
26 
27     from chainerx import _device  # NOQA
28 
29     from chainerx.creation.from_data import asanyarray  # NOQA
30     from chainerx.creation.from_data import fromfile  # NOQA
31     from chainerx.creation.from_data import fromfunction  # NOQA
32     from chainerx.creation.from_data import fromiter  # NOQA
33     from chainerx.creation.from_data import fromstring  # NOQA
34     from chainerx.creation.from_data import loadtxt  # NOQA
35 
36     from chainerx.manipulation.shape import ravel  # NOQA
37 
38     from chainerx.math.misc import clip  # NOQA
39 
40     from chainerx import random  # NOQA
41 
42     _global_context = _core.Context()
43     _core.set_global_default_context(_global_context)
44 
45     # Implements ndarray methods in Python
46     from chainerx import _ndarray
47     _ndarray.populate()
48 
49     # Temporary workaround implementations that fall back to NumPy/CuPy's
50     # respective functions.
51     from chainerx import _fallback_workarounds
52     _fallback_workarounds.populate()
53 
54     # Dynamically inject docstrings
55     from chainerx import _docs
56     _docs.set_docs()
57 
58     from chainerx import _cuda
59     # Share memory pool with CuPy.
60     if bool(int(os.getenv('CHAINERX_CUDA_CUPY_SHARE_ALLOCATOR', '0'))):
61         _cuda.cupy_share_allocator()
62 else:
63     class ndarray(object):
64 
65         """Dummy class for type testing."""
66 
67         def __init__(self, *args, **kwargs):
68             raise RuntimeError('chainerx is not available.')
69 
70 
71 def is_available():
72     return _available
73
```
--- 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/chainerx/__init__.py b/chainerx/__init__.py
--- a/chainerx/__init__.py
+++ b/chainerx/__init__.py
@@ -1,5 +1,6 @@
 import os
 import sys
+import warnings
 
 
 if sys.version_info[0] < 3:
@@ -70,3 +71,9 @@
 
 def is_available():
     return _available
+
+
+if _available and _core._is_debug():
+    # Warn if the ChainerX core binary is built in debug mode
+    warnings.warn(
+        'ChainerX core binary is built in debug mode.', stacklevel=2)

{"golden_diff": "diff --git a/chainerx/__init__.py b/chainerx/__init__.py\n--- a/chainerx/__init__.py\n+++ b/chainerx/__init__.py\n@@ -1,5 +1,6 @@\n import os\n import sys\n+import warnings\n \n \n if sys.version_info[0] < 3:\n@@ -70,3 +71,9 @@\n \n def is_available():\n     return _available\n+\n+\n+if _available and _core._is_debug():\n+    # Warn if the ChainerX core binary is built in debug mode\n+    warnings.warn(\n+        'ChainerX core binary is built in debug mode.', stacklevel=2)\n", "issue": "Emit warning if compiled in Debug mode\nIn debug mode ChainerX runs significantly slower.\r\nHowever sometimes it's difficult notice that.\n", "before_files": [{"content": "import os\nimport sys\n\n\nif sys.version_info[0] < 3:\n    _available = False\nelse:\n    try:\n        from chainerx import _core\n        _available = True\n    except Exception:\n        _available = False\n\n\nif _available:\n    from numpy import dtype  # NOQA\n    from numpy import (\n        bool_, int8, int16, int32, int64, uint8, float16, float32, float64)  # NOQA\n    all_dtypes = (\n        bool_, int8, int16, int32, int64, uint8, float16, float32, float64)\n\n    from chainerx._core import *  # NOQA\n    from chainerx._core import _to_cupy  # NOQA\n\n    from builtins import bool, int, float  # NOQA\n\n    from chainerx import _device  # NOQA\n\n    from chainerx.creation.from_data import asanyarray  # NOQA\n    from chainerx.creation.from_data import fromfile  # NOQA\n    from chainerx.creation.from_data import fromfunction  # NOQA\n    from chainerx.creation.from_data import fromiter  # NOQA\n    from chainerx.creation.from_data import fromstring  # NOQA\n    from chainerx.creation.from_data import loadtxt  # NOQA\n\n    from chainerx.manipulation.shape import ravel  # NOQA\n\n    from chainerx.math.misc import clip  # NOQA\n\n    from chainerx import random  # NOQA\n\n    _global_context = _core.Context()\n    _core.set_global_default_context(_global_context)\n\n    # Implements ndarray methods in Python\n    from chainerx import _ndarray\n    _ndarray.populate()\n\n    # Temporary workaround implementations that fall back to NumPy/CuPy's\n    # respective functions.\n    from chainerx import _fallback_workarounds\n    _fallback_workarounds.populate()\n\n    # Dynamically inject docstrings\n    from chainerx import _docs\n    _docs.set_docs()\n\n    from chainerx import _cuda\n    # Share memory pool with CuPy.\n    if bool(int(os.getenv('CHAINERX_CUDA_CUPY_SHARE_ALLOCATOR', '0'))):\n        _cuda.cupy_share_allocator()\nelse:\n    class ndarray(object):\n\n        \"\"\"Dummy class for type testing.\"\"\"\n\n        def __init__(self, *args, **kwargs):\n            raise RuntimeError('chainerx is not available.')\n\n\ndef is_available():\n    return _available\n", "path": "chainerx/__init__.py"}], "after_files": [{"content": "import os\nimport sys\nimport warnings\n\n\nif sys.version_info[0] < 3:\n    _available = False\nelse:\n    try:\n        from chainerx import _core\n        _available = True\n    except Exception:\n        _available = False\n\n\nif _available:\n    from numpy import dtype  # NOQA\n    from numpy import (\n        bool_, int8, int16, int32, int64, uint8, float16, float32, float64)  # NOQA\n    all_dtypes = (\n        bool_, int8, int16, int32, int64, uint8, float16, float32, float64)\n\n    from chainerx._core import *  # NOQA\n    from chainerx._core import _to_cupy  # NOQA\n\n    from builtins import bool, int, float  # NOQA\n\n    from chainerx import _device  # NOQA\n\n    from chainerx.creation.from_data import asanyarray  # NOQA\n    from chainerx.creation.from_data import fromfile  # NOQA\n    from chainerx.creation.from_data import fromfunction  # NOQA\n    from chainerx.creation.from_data import fromiter  # NOQA\n    from chainerx.creation.from_data import fromstring  # NOQA\n    from chainerx.creation.from_data import loadtxt  # NOQA\n\n    from chainerx.manipulation.shape import ravel  # NOQA\n\n    from chainerx.math.misc import clip  # NOQA\n\n    from chainerx import random  # NOQA\n\n    _global_context = _core.Context()\n    _core.set_global_default_context(_global_context)\n\n    # Implements ndarray methods in Python\n    from chainerx import _ndarray\n    _ndarray.populate()\n\n    # Temporary workaround implementations that fall back to NumPy/CuPy's\n    # respective functions.\n    from chainerx import _fallback_workarounds\n    _fallback_workarounds.populate()\n\n    # Dynamically inject docstrings\n    from chainerx import _docs\n    _docs.set_docs()\n\n    from chainerx import _cuda\n    # Share memory pool with CuPy.\n    if bool(int(os.getenv('CHAINERX_CUDA_CUPY_SHARE_ALLOCATOR', '0'))):\n        _cuda.cupy_share_allocator()\nelse:\n    class ndarray(object):\n\n        \"\"\"Dummy class for type testing.\"\"\"\n\n        def __init__(self, *args, **kwargs):\n            raise RuntimeError('chainerx is not available.')\n\n\ndef is_available():\n    return _available\n\n\nif _available and _core._is_debug():\n    # Warn if the ChainerX core binary is built in debug mode\n    warnings.warn(\n        'ChainerX core binary is built in debug mode.', stacklevel=2)\n", "path": "chainerx/__init__.py"}]}