xoscar 0.7.15__tar.gz → 0.7.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of xoscar might be problematic. Click here for more details.

Files changed (95) hide show
  1. {xoscar-0.7.15 → xoscar-0.7.17}/PKG-INFO +1 -1
  2. xoscar-0.7.17/xoscar/collective/backend/__init__.py +13 -0
  3. xoscar-0.7.17/xoscar/collective/backend/nccl_backend.py +160 -0
  4. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/virtualenv/platform.py +4 -1
  5. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/virtualenv/uv.py +3 -0
  6. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar.egg-info/PKG-INFO +1 -1
  7. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar.egg-info/SOURCES.txt +2 -0
  8. {xoscar-0.7.15 → xoscar-0.7.17}/MANIFEST.in +0 -0
  9. {xoscar-0.7.15 → xoscar-0.7.17}/pyproject.toml +0 -0
  10. {xoscar-0.7.15 → xoscar-0.7.17}/setup.cfg +0 -0
  11. {xoscar-0.7.15 → xoscar-0.7.17}/setup.py +0 -0
  12. {xoscar-0.7.15 → xoscar-0.7.17}/versioneer.py +0 -0
  13. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/__init__.py +0 -0
  14. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/_utils.pxd +0 -0
  15. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/_utils.pyx +0 -0
  16. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/_version.py +0 -0
  17. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/aio/__init__.py +0 -0
  18. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/aio/base.py +0 -0
  19. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/aio/file.py +0 -0
  20. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/aio/lru.py +0 -0
  21. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/aio/parallelism.py +0 -0
  22. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/api.py +0 -0
  23. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backend.py +0 -0
  24. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/__init__.py +0 -0
  25. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/allocate_strategy.py +0 -0
  26. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/communication/__init__.py +0 -0
  27. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/communication/base.py +0 -0
  28. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/communication/core.py +0 -0
  29. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/communication/dummy.py +0 -0
  30. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/communication/errors.py +0 -0
  31. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/communication/socket.py +0 -0
  32. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/communication/ucx.py +0 -0
  33. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/communication/utils.py +0 -0
  34. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/config.py +0 -0
  35. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/context.py +0 -0
  36. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/core.py +0 -0
  37. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/indigen/__init__.py +0 -0
  38. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/indigen/__main__.py +0 -0
  39. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/indigen/backend.py +0 -0
  40. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/indigen/driver.py +0 -0
  41. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/indigen/fate_sharing.py +0 -0
  42. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/indigen/pool.py +0 -0
  43. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/indigen/shared_memory.py +0 -0
  44. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/message.pyi +0 -0
  45. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/message.pyx +0 -0
  46. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/pool.py +0 -0
  47. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/router.py +0 -0
  48. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/test/__init__.py +0 -0
  49. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/test/backend.py +0 -0
  50. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/backends/test/pool.py +0 -0
  51. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/batch.py +0 -0
  52. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/collective/__init__.py +0 -0
  53. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/collective/common.py +0 -0
  54. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/collective/core.py +0 -0
  55. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/collective/process_group.py +0 -0
  56. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/collective/utils.py +0 -0
  57. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/collective/xoscar_pygloo.pyi +0 -0
  58. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/constants.py +0 -0
  59. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/context.pxd +0 -0
  60. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/context.pyx +0 -0
  61. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/core.pxd +0 -0
  62. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/core.pyx +0 -0
  63. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/debug.py +0 -0
  64. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/driver.py +0 -0
  65. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/errors.py +0 -0
  66. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/libcpp.pxd +0 -0
  67. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/metrics/__init__.py +0 -0
  68. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/metrics/api.py +0 -0
  69. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/metrics/backends/__init__.py +0 -0
  70. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/metrics/backends/console/__init__.py +0 -0
  71. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/metrics/backends/console/console_metric.py +0 -0
  72. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/metrics/backends/metric.py +0 -0
  73. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/metrics/backends/prometheus/__init__.py +0 -0
  74. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/metrics/backends/prometheus/prometheus_metric.py +0 -0
  75. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/nvutils.py +0 -0
  76. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/profiling.py +0 -0
  77. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/__init__.py +0 -0
  78. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/aio.py +0 -0
  79. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/core.pxd +0 -0
  80. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/core.pyi +0 -0
  81. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/core.pyx +0 -0
  82. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/cuda.py +0 -0
  83. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/exception.py +0 -0
  84. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/mlx.py +0 -0
  85. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/numpy.py +0 -0
  86. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/pyfury.py +0 -0
  87. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/serialization/scipy.py +0 -0
  88. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/utils.py +0 -0
  89. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/virtualenv/__init__.py +0 -0
  90. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/virtualenv/core.py +0 -0
  91. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar/virtualenv/utils.py +0 -0
  92. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar.egg-info/dependency_links.txt +0 -0
  93. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar.egg-info/not-zip-safe +0 -0
  94. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar.egg-info/requires.txt +0 -0
  95. {xoscar-0.7.15 → xoscar-0.7.17}/xoscar.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xoscar
3
- Version: 0.7.15
3
+ Version: 0.7.17
4
4
  Summary: Python actor framework for heterogeneous computing.
5
5
  Home-page: http://github.com/xorbitsai/xoscar
6
6
  Author: Qin Xuye
@@ -0,0 +1,13 @@
1
+ # Copyright 2022-2025 XProbe Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
@@ -0,0 +1,160 @@
1
+ # Copyright 2022-2023 XProbe Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # We need to extend cupy's inner class because an actor is a daemonic processes
16
+ # which are not allowed to have children. However, the origin code in cupy
17
+ # will create children processes.
18
+
19
+ import queue
20
+ import socket
21
+ import threading
22
+ from ctypes import sizeof
23
+
24
+ from ...utils import lazy_import
25
+
26
+ cupy = lazy_import("cupy")
27
+
28
+ if cupy is not None:
29
+ import cupyx.distributed
30
+ from cupy.cuda import nccl
31
+ from cupyx.distributed import _klv_utils, _store, _store_actions
32
+
33
+ class ExceptionAwareThreading(threading.Thread):
34
+ def __init__(self, *args, **kwargs):
35
+ super().__init__(*args, **kwargs)
36
+ self._exception = None
37
+ self.q = queue.Queue()
38
+
39
+ def run(self):
40
+ try:
41
+ super().run()
42
+ self.q.put(None)
43
+ except Exception as e:
44
+ self.q.put(e)
45
+
46
+ def join(self):
47
+ super().join()
48
+ if not self.q.empty():
49
+ exception = self.q.get()
50
+ if exception is not None:
51
+ raise exception
52
+
53
+ class TCPStore:
54
+ # This is only used for initialization of nccl so we don't care
55
+ # too much about performance
56
+ def __init__(self, world_size):
57
+ self.storage = {}
58
+ self._thread = None
59
+ self._world_size = world_size
60
+ self._run = 1
61
+ # For implementing a barrier
62
+ self._lock = threading.Lock()
63
+ self._current_barrier = None
64
+
65
+ def __del__(self):
66
+ if not _store._exit_mode:
67
+ self.stop()
68
+
69
+ def _thread_request(self, c_socket):
70
+ with c_socket:
71
+ # Receive in KLV format
72
+ action_bytes = c_socket.recv(sizeof(_klv_utils.action_t))
73
+ if len(action_bytes) > 0:
74
+ action_m = _klv_utils.action_t.from_buffer_copy(action_bytes)
75
+ if action_m.length > 256:
76
+ raise ValueError("Invalid length for message")
77
+ value = bytearray(action_m.value)[: action_m.length]
78
+ r = _store_actions.execute_action(action_m.action, value, self)
79
+ if r is not None:
80
+ c_socket.sendall(r.klv())
81
+
82
+ def _server_loop(self, host, port):
83
+ # This is for minimum info exchange during initialization
84
+ # a single connection allows to implement locking mechanics easily
85
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
86
+ s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
87
+ s.bind((host, port))
88
+ s.listen()
89
+ s.settimeout(0.5)
90
+ while self._run == 1:
91
+ try:
92
+ c_socket, addr = s.accept()
93
+ except socket.timeout:
94
+ continue
95
+
96
+ t = threading.Thread(
97
+ target=self._thread_request, args=(c_socket,), daemon=True
98
+ )
99
+ t.start()
100
+
101
+ def run(self, host=_store._DEFAULT_HOST, port=_store._DEFAULT_PORT):
102
+ # Run the TCP store in a different process
103
+ t = ExceptionAwareThreading(target=self._server_loop, args=(host, port))
104
+ t.start()
105
+ self._thread = t
106
+
107
+ def stop(self):
108
+ if _store._exit_mode:
109
+ return # Prevent shutdown errors
110
+ if self._thread is not None:
111
+ # acquire the lock
112
+ self._lock.acquire()
113
+ self._run = 0
114
+ self._lock.release()
115
+ self._thread.join()
116
+
117
+ class XoscarNCCLBackend(cupyx.distributed.NCCLBackend):
118
+ """Interface that uses NVIDIA's NCCL to perform communications.
119
+
120
+ Args:
121
+ n_devices (int): Total number of devices that will be used in the
122
+ distributed execution.
123
+ rank (int): Unique id of the GPU that the communicator is associated to
124
+ its value needs to be `0 <= rank < n_devices`.
125
+ host (str, optional): host address for the process rendezvous on
126
+ initialization. Defaults to `"127.0.0.1"`.
127
+ port (int, optional): port used for the process rendezvous on
128
+ initialization. Defaults to `13333`.
129
+ use_mpi(bool, optional): switch between MPI and use the included TCP
130
+ server for initialization & synchronization. Defaults to `False`.
131
+ """
132
+
133
+ def __init__(
134
+ self,
135
+ n_devices,
136
+ rank,
137
+ tcpstore,
138
+ host=_store._DEFAULT_HOST,
139
+ port=_store._DEFAULT_PORT,
140
+ use_mpi=False,
141
+ ):
142
+ self._tcpstore = tcpstore
143
+ super().__init__(n_devices, rank, host, port, use_mpi)
144
+
145
+ def _init_with_tcp_store(self, n_devices, rank, host, port):
146
+ nccl_id = None
147
+ if rank == 0:
148
+ self._tcpstore.run(host, port)
149
+ nccl_id = nccl.get_unique_id()
150
+ # get_unique_id return negative values due to cython issues
151
+ # with bytes && c strings. We shift them by 128 to
152
+ # make them positive and send them as bytes to the proxy store
153
+ shifted_nccl_id = bytes([b + 128 for b in nccl_id])
154
+ self._store_proxy["nccl_id"] = shifted_nccl_id
155
+ self._store_proxy.barrier()
156
+ else:
157
+ self._store_proxy.barrier()
158
+ nccl_id = self._store_proxy["nccl_id"]
159
+ nccl_id = tuple([int(b) - 128 for b in nccl_id])
160
+ self._comm = nccl.NcclCommunicator(n_devices, nccl_id, rank)
@@ -39,7 +39,10 @@ def get_cuda_arch() -> Optional[str]:
39
39
 
40
40
  major, minor = torch.cuda.get_device_capability()
41
41
  return f"sm_{major}{minor}" # e.g. 'sm_80'
42
- except (ImportError, AttributeError):
42
+ except (ImportError, AttributeError, AssertionError):
43
+ # If no cuda available,
44
+ # AssertionError("Torch not compiled with CUDA enabled")
45
+ # will be raised
43
46
  return None
44
47
 
45
48
 
@@ -239,6 +239,9 @@ class UVVirtualEnvManager(VirtualEnvManager):
239
239
  return
240
240
 
241
241
  packages = self.process_packages(packages)
242
+ if not packages:
243
+ return
244
+
242
245
  log = kwargs.pop("log", False)
243
246
  skip_installed = kwargs.pop("skip_installed", SKIP_INSTALLED)
244
247
  uv_path = self._get_uv_path()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xoscar
3
- Version: 0.7.15
3
+ Version: 0.7.17
4
4
  Summary: Python actor framework for heterogeneous computing.
5
5
  Home-page: http://github.com/xorbitsai/xoscar
6
6
  Author: Qin Xuye
@@ -66,6 +66,8 @@ xoscar/collective/core.py
66
66
  xoscar/collective/process_group.py
67
67
  xoscar/collective/utils.py
68
68
  xoscar/collective/xoscar_pygloo.pyi
69
+ xoscar/collective/backend/__init__.py
70
+ xoscar/collective/backend/nccl_backend.py
69
71
  xoscar/metrics/__init__.py
70
72
  xoscar/metrics/api.py
71
73
  xoscar/metrics/backends/__init__.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes