xoscar 0.7.16__cp39-cp39-macosx_10_9_x86_64.whl → 0.7.17__cp39-cp39-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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xoscar
3
- Version: 0.7.16
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.16.dist-info/RECORD,,
2
- xoscar-0.7.16.dist-info/WHEEL,sha256=3Qygrk1hDgANQwZ2WnY8NvFNuTorj1Zw9KuT8tN2L7s,136
3
- xoscar-0.7.16.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
4
- xoscar-0.7.16.dist-info/METADATA,sha256=Yt5bo1VSoHeKy8IPnhVlorXbAkW0Cdws6o4VJZG5Y2E,9135
1
+ xoscar-0.7.17.dist-info/RECORD,,
2
+ xoscar-0.7.17.dist-info/WHEEL,sha256=3Qygrk1hDgANQwZ2WnY8NvFNuTorj1Zw9KuT8tN2L7s,136
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
@@ -12,18 +12,18 @@ xoscar/nvutils.py,sha256=qmW4mKLU0WB2yCs198ccQOgLL02zB7Fsa-AotO3NOmg,20412
12
12
  xoscar/constants.py,sha256=QHHSREw6uWBBjQDCFqlNfTvBZgniJPGy42KSIsR8Fqw,787
13
13
  xoscar/__init__.py,sha256=sy7Wtn2EuQZI0I4Az_MfsBVZm4G0DRj46qRyExgmnJk,1622
14
14
  xoscar/api.py,sha256=zxNqOjGiTIKuAip9WJ0LOoM7yevD6P5rb-sLynpZ2Zo,14648
15
- xoscar/core.cpython-39-darwin.so,sha256=iITfSNJRXofljBEbKU1jajKstREAFqWt7K7sRBTygeA,413504
15
+ xoscar/core.cpython-39-darwin.so,sha256=9EznuwcmcUIJnR7gw4-vDZNlo4nea1h35531roTYpDU,413504
16
16
  xoscar/utils.py,sha256=MaKiW4Vphwhh8c0yoqN8G8hbJr1zXgpf49EdvmGc1ZU,16500
17
17
  xoscar/debug.py,sha256=9Z8SgE2WaKYQcyDo-5-DxEJQ533v7kWjrvCd28pSx3E,5069
18
18
  xoscar/libcpp.pxd,sha256=DJqBxLFOKL4iRr9Kale5UH3rbvPRD1x5bTSOPHFpz9I,1147
19
19
  xoscar/context.pyx,sha256=8CdgPnWcE9eOp3N600WgDQ03MCi8P73eUOGcfV7Zksg,10942
20
20
  xoscar/errors.py,sha256=wBlQOKsXf0Fc4skN39tDie0YZT-VIAuLNRgoDl2pZcA,1241
21
- xoscar/_utils.cpython-39-darwin.so,sha256=WZxXsz3iVeuekjDrJLdQX9A9L3domGHvHiPTcEfDc7M,162352
21
+ xoscar/_utils.cpython-39-darwin.so,sha256=9SdbmMMnpwyPbxEojyLnPJTGVFaAFKxp7HH-d6ExIgY,162352
22
22
  xoscar/core.pyx,sha256=phN-yYV0A0QI8WFi2jCu0nc4CnShTepfDi0V7ZrLYPY,22092
23
23
  xoscar/driver.py,sha256=498fowtJr6b3FE8FIOA_Tc1Vwx88nfZw7p0FxrML0h4,1372
24
24
  xoscar/profiling.py,sha256=BC5OF0HzSaXv8V7w-y-B8r5gV5DgxHFoTEIF6jCMioQ,8015
25
25
  xoscar/_utils.pxd,sha256=5KYAL3jfPdejsHnrGGT2s--ZUX5SXznQWpHVSno429k,1157
26
- xoscar/context.cpython-39-darwin.so,sha256=Tr0lnG1kdKSOqtLNDm3PjBZSMsS2XDO5MI1dCRaSt9s,200032
26
+ xoscar/context.cpython-39-darwin.so,sha256=t6Kb1PI-Lh6M5btzYcJ6lOkoUU1JJ9LZOSmp9clKMc8,200032
27
27
  xoscar/metrics/__init__.py,sha256=9Badi7rxYikGm2dQiNCrj9GgMRBxwuR3JaEKcFZmfak,705
28
28
  xoscar/metrics/api.py,sha256=BBlMIFvVAGVfrtpeJ1YlH9Tqhy9OzGavwvGyeHcQ0Tk,8856
29
29
  xoscar/metrics/backends/__init__.py,sha256=h_JgzSqV5lP6vQ6XX_17kE4IY4BRnvKta_7VLQAL1ms,581
@@ -38,18 +38,20 @@ 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
44
46
  xoscar/serialization/__init__.py,sha256=v76XC2OQLp-Yk4_U3_IVguEylMeyRw1UrkU_DPDMh0U,856
45
47
  xoscar/serialization/numpy.py,sha256=5Kem87CvpJmzUMp3QHk4WeHU30FoQWTJJP2SwIcaQG0,2919
46
- xoscar/serialization/core.cpython-39-darwin.so,sha256=spO1oYl4oPoU5TItGmMh-Lv5kegBms3vc4YSjutaVAc,391672
48
+ xoscar/serialization/core.cpython-39-darwin.so,sha256=VB1aj1Amf4qHuyfqcf5OBgfDNGR5MOi00SIt2NO4MD4,391672
47
49
  xoscar/serialization/cuda.py,sha256=iFUEnN4SiquBIhyieyOrfw3TnKnW-tU_vYgqOxO_DrA,3758
48
50
  xoscar/serialization/scipy.py,sha256=yOEi0NB8cqQ6e2UnCZ1w006RsB7T725tIL-DM_hNcsU,2482
49
51
  xoscar/serialization/aio.py,sha256=5DySPgDxU43ec7_5Ct44-Oqt7YNSJBfuf8VdQgQlChA,4731
50
52
  xoscar/serialization/core.pyx,sha256=bjR-zXGm9qersk7kYPzpjpMIxDl_Auur4BCubRfKmfA,29626
51
53
  xoscar/serialization/mlx.py,sha256=tRu_7o6RizdRhbr88EasHrZtShimAsLy3pIEO-by29o,2118
52
- xoscar/backends/message.cpython-39-darwin.so,sha256=kmnPv74MDhSHHJM8FEUbLrekAib6NCHiQMAoGskNWWE,355536
54
+ xoscar/backends/message.cpython-39-darwin.so,sha256=dxOSXFnppiiHDToRoJJeJ9g4KI9EYZVjzwQwcFMZFDw,355792
53
55
  xoscar/backends/config.py,sha256=4tZMiXAMMS8qQ4SX_LjONLtSQVfZTx3m-IK3EqbkYdk,5375
54
56
  xoscar/backends/allocate_strategy.py,sha256=tC1Nbq2tJohahUwd-zoRYHEDX65wyuX8tmeY45uWj_w,4845
55
57
  xoscar/backends/__init__.py,sha256=VHEBQcUWM5bj027W8EUf9PiJUAP7JoMrRw3Tsvy5ySw,643
@@ -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
90
  xoscar/virtualenv/uv.py,sha256=VBw045LN8gYMLgjaazt7-tnwBveWr7YYE2zjDsL18h0,11091