xoscar 0.7.15__cp310-cp310-macosx_10_9_x86_64.whl → 0.7.17__cp310-cp310-macosx_10_9_x86_64.whl

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.

Binary file
@@ -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)
Binary file
Binary file
@@ -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
 
xoscar/virtualenv/uv.py CHANGED
@@ -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.1
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
@@ -1,7 +1,7 @@
1
- xoscar-0.7.15.dist-info/RECORD,,
2
- xoscar-0.7.15.dist-info/WHEEL,sha256=G2_osVyqlO3rQICDNwzuQ-zsxS79EB0lsq9jZ8r7Rkc,138
3
- xoscar-0.7.15.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
4
- xoscar-0.7.15.dist-info/METADATA,sha256=CXVH-87HF_k_eIeE9lFHs4lbz3_LkCpWi-YN5XSYIkI,9135
1
+ xoscar-0.7.17.dist-info/RECORD,,
2
+ xoscar-0.7.17.dist-info/WHEEL,sha256=G2_osVyqlO3rQICDNwzuQ-zsxS79EB0lsq9jZ8r7Rkc,138
3
+ xoscar-0.7.17.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
4
+ xoscar-0.7.17.dist-info/METADATA,sha256=HAx9j56JTP6ZFRo9K7s8eYkW5QYoSV27Dk4P9tLX_qw,9135
5
5
  xoscar/_utils.pyx,sha256=frgVQ5xGp92jBKc4PsPmjOlVsXlKeHWtTOAMfHmBaII,7380
6
6
  xoscar/backend.py,sha256=is436OPkZfSpQXaoqTRVta5eoye_pp45RFgCstAk2hU,1850
7
7
  xoscar/core.pxd,sha256=I_C2ka7XryyGnnAVXUVm8xfS1gtIrCs6X-9rswgOcUU,1317
@@ -10,7 +10,7 @@ xoscar/context.pxd,sha256=qKa0OyDPZtVymftSh447m-RzFZgmz8rGqQBa7qlauvc,725
10
10
  xoscar/batch.py,sha256=DpArS0L3WYJ_HVPG-6hSYEwoAFY1mY2-mlC4Jp5M_Dw,7872
11
11
  xoscar/nvutils.py,sha256=qmW4mKLU0WB2yCs198ccQOgLL02zB7Fsa-AotO3NOmg,20412
12
12
  xoscar/constants.py,sha256=QHHSREw6uWBBjQDCFqlNfTvBZgniJPGy42KSIsR8Fqw,787
13
- xoscar/_utils.cpython-310-darwin.so,sha256=lAkJo_SzswS0PcYnDlG7B-vBkrsEfuJuW0wr_342uNg,162344
13
+ xoscar/_utils.cpython-310-darwin.so,sha256=jeX9QrBb-LOGG74vIfHqUN-IqjA7LUA_-ND_szKTADo,162288
14
14
  xoscar/__init__.py,sha256=sy7Wtn2EuQZI0I4Az_MfsBVZm4G0DRj46qRyExgmnJk,1622
15
15
  xoscar/api.py,sha256=zxNqOjGiTIKuAip9WJ0LOoM7yevD6P5rb-sLynpZ2Zo,14648
16
16
  xoscar/utils.py,sha256=MaKiW4Vphwhh8c0yoqN8G8hbJr1zXgpf49EdvmGc1ZU,16500
@@ -20,8 +20,8 @@ xoscar/context.pyx,sha256=8CdgPnWcE9eOp3N600WgDQ03MCi8P73eUOGcfV7Zksg,10942
20
20
  xoscar/errors.py,sha256=wBlQOKsXf0Fc4skN39tDie0YZT-VIAuLNRgoDl2pZcA,1241
21
21
  xoscar/core.pyx,sha256=phN-yYV0A0QI8WFi2jCu0nc4CnShTepfDi0V7ZrLYPY,22092
22
22
  xoscar/driver.py,sha256=498fowtJr6b3FE8FIOA_Tc1Vwx88nfZw7p0FxrML0h4,1372
23
- xoscar/context.cpython-310-darwin.so,sha256=_yX1YrHlKQcw5tFEwEpbP6Goj1iYUH8GsDiSz0yMUfM,200160
24
- xoscar/core.cpython-310-darwin.so,sha256=4FfwQYW58oHbMfZm_ROl1tSa__jhejbtZKxIVIX6To8,413432
23
+ xoscar/context.cpython-310-darwin.so,sha256=_6zbzy1Of3GH_nu4OFUv8v2Oi9LFKRDgXwqgGVcOIrw,199656
24
+ xoscar/core.cpython-310-darwin.so,sha256=S3x-xHHIL0spFvHFh17gs8XxRYwH9kx5HVX0-a7RqcE,413064
25
25
  xoscar/profiling.py,sha256=BC5OF0HzSaXv8V7w-y-B8r5gV5DgxHFoTEIF6jCMioQ,8015
26
26
  xoscar/_utils.pxd,sha256=5KYAL3jfPdejsHnrGGT2s--ZUX5SXznQWpHVSno429k,1157
27
27
  xoscar/metrics/__init__.py,sha256=9Badi7rxYikGm2dQiNCrj9GgMRBxwuR3JaEKcFZmfak,705
@@ -38,6 +38,8 @@ xoscar/collective/core.py,sha256=NVR-7Iaq3aDPCN6fgXcq9Ew6uFEszRwxYqmUG9FLcws,235
38
38
  xoscar/collective/common.py,sha256=INAnISbfnRicbbbDHTqbSr9ITb89ZphH5BUkSpEdXXU,3561
39
39
  xoscar/collective/utils.py,sha256=3S4qF4JEnAUD3RiWVBUj-ZptL83CBSwGYyVZyIasAsE,1178
40
40
  xoscar/collective/process_group.py,sha256=zy7LcIFnEcmrcxuECI89v0bQlUbSqQMkVyBw468WBnk,22599
41
+ xoscar/collective/backend/nccl_backend.py,sha256=7VvjAVTkr6qWJC1CztzJ5CN9USGJkstO-RAbaPKQA-Y,6280
42
+ xoscar/collective/backend/__init__.py,sha256=CyLLkbImZouAk4lePIgKXT4WQoqyauIEwdqea5IOUVU,581
41
43
  xoscar/serialization/exception.py,sha256=Jy8Lsk0z-VJyEUaWeuZIwkmxqaoB-nLKMa1D15Cl4js,1634
42
44
  xoscar/serialization/pyfury.py,sha256=sifOnVMYoS82PzZEkzkfxesmMHei23k5UAUUKUyoOYQ,1163
43
45
  xoscar/serialization/core.pxd,sha256=k4RoJgX5E5LGs4jdCQ7vvcn26MabXbrWoWhkO49X6YI,985
@@ -47,11 +49,11 @@ xoscar/serialization/cuda.py,sha256=iFUEnN4SiquBIhyieyOrfw3TnKnW-tU_vYgqOxO_DrA,
47
49
  xoscar/serialization/scipy.py,sha256=yOEi0NB8cqQ6e2UnCZ1w006RsB7T725tIL-DM_hNcsU,2482
48
50
  xoscar/serialization/aio.py,sha256=5DySPgDxU43ec7_5Ct44-Oqt7YNSJBfuf8VdQgQlChA,4731
49
51
  xoscar/serialization/core.pyx,sha256=bjR-zXGm9qersk7kYPzpjpMIxDl_Auur4BCubRfKmfA,29626
50
- xoscar/serialization/core.cpython-310-darwin.so,sha256=5g69qmhzLkZneYqBhovbkH3KPQObjlXmOJbyPUMGv2I,391832
52
+ xoscar/serialization/core.cpython-310-darwin.so,sha256=1e7TgKx2dBarQSRePsddspiMugAa6F8RpSVKqI9lp4E,391384
51
53
  xoscar/serialization/mlx.py,sha256=tRu_7o6RizdRhbr88EasHrZtShimAsLy3pIEO-by29o,2118
52
54
  xoscar/backends/config.py,sha256=4tZMiXAMMS8qQ4SX_LjONLtSQVfZTx3m-IK3EqbkYdk,5375
53
55
  xoscar/backends/allocate_strategy.py,sha256=tC1Nbq2tJohahUwd-zoRYHEDX65wyuX8tmeY45uWj_w,4845
54
- xoscar/backends/message.cpython-310-darwin.so,sha256=4hN4jhmQsswXLTMskJyKMZX8TSM56blX7V8xaG5rxYk,355504
56
+ xoscar/backends/message.cpython-310-darwin.so,sha256=LWeQm1nmGRmJV9-OKPvFcH681K2Bnkw1Sfs_82rHotA,355720
55
57
  xoscar/backends/__init__.py,sha256=VHEBQcUWM5bj027W8EUf9PiJUAP7JoMrRw3Tsvy5ySw,643
56
58
  xoscar/backends/core.py,sha256=EH-fHlV9x3bnruEHaUtGYO7osKLfLJ4AQHtuzA_mr2g,10857
57
59
  xoscar/backends/context.py,sha256=XfDPG2eDhAhE6hWBEkEsHTnyyOYN9R3houlMjAL7BFw,16329
@@ -83,6 +85,6 @@ xoscar/aio/parallelism.py,sha256=VSsjk8wP-Bw7tLeUsTyLVNgp91thjxEfE3pCrw_vF5Q,129
83
85
  xoscar/aio/base.py,sha256=9j0f1piwfE5R5GIvV212vSD03ixdaeSzSSsO2kxJZVE,2249
84
86
  xoscar/virtualenv/__init__.py,sha256=65t9_X1DvbanNjFy366SiiWZrRTpa9SXWMXPmqayE-4,1117
85
87
  xoscar/virtualenv/core.py,sha256=Ij36UQaej9fFaz1PfqkEtL1ss8yBribXHcWT115kH-o,8098
86
- xoscar/virtualenv/platform.py,sha256=3f5EQEXbq_sf4pRJ_0lg4y1V_22qadUdQjmVjIaZaoU,1403
88
+ xoscar/virtualenv/platform.py,sha256=JGEp6tbCeACr3MC9UAdaOGJIJEKjWFRtScpKuGX0_Hs,1541
87
89
  xoscar/virtualenv/utils.py,sha256=qKHw7Gg0n3JuzKFjhBnftPq2QWlgNJLk1sGPr5GzamM,2875
88
- xoscar/virtualenv/uv.py,sha256=bkFN2Vp6b2mz6YXpodH2plGIGBA-YUU4vE5p2j0mKkg,11046
90
+ xoscar/virtualenv/uv.py,sha256=VBw045LN8gYMLgjaazt7-tnwBveWr7YYE2zjDsL18h0,11091