xoscar 0.7.16__cp310-cp310-win_amd64.whl → 0.7.17__cp310-cp310-win_amd64.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
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)
xoscar/collective/uv.dll CHANGED
Binary file
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,5 +1,5 @@
1
1
  xoscar/__init__.py,sha256=lzCXUmkuIjcjkiNQFekysdJR_ZhlbjcfR5ka1bZZNQg,1683
2
- xoscar/_utils.cp310-win_amd64.pyd,sha256=JMiXkAbc2eRFP30iDQniR56sOhIDbCVG9PuasI6jFZI,114688
2
+ xoscar/_utils.cp310-win_amd64.pyd,sha256=HAKncNrvE1oYPWzsVc2CJ-aDL_bK6hbfxMYmYdWjUEI,114688
3
3
  xoscar/_utils.pxd,sha256=rlNbTg5lhXA-jCOLksqF4jhUlNn0xw2jx1HxdLa34pc,1193
4
4
  xoscar/_utils.pyx,sha256=TWScgqmJGYzjbWBOShBLkq07ldfYEQ5fw6V4OytX_IA,7626
5
5
  xoscar/_version.py,sha256=bsfCVAo_o9LkiP3AjPsP4SRRqhjuS0t4D1WGJPzbdls,24412
@@ -7,10 +7,10 @@ xoscar/api.py,sha256=QQDHn-_FiDExmOxEk8BUnq4Qrx13VX3shSlEEqPQJo0,15175
7
7
  xoscar/backend.py,sha256=8G5JwjoOT6Q2slb11eXNApxgcmvNQUCdQzkoIMDwLcQ,1917
8
8
  xoscar/batch.py,sha256=Jk5BSpvMFAV9DrRy0a9tgPvIo_dt8cbJReZBL0cnOPc,8128
9
9
  xoscar/constants.py,sha256=GJ1KEOxwnqksc9K_GH42TSWpQECeC6ti3KJmE3PUcTw,810
10
- xoscar/context.cp310-win_amd64.pyd,sha256=8M3d3LC0BWI7p6fjxV58-00INS8LDVeH4BslIVi3htw,161792
10
+ xoscar/context.cp310-win_amd64.pyd,sha256=tjsTX_oUMJUaTGrn8v5e3LNpVA2oE9aXxMdBAAHDg7E,161792
11
11
  xoscar/context.pxd,sha256=6n6IAbmArSRq8EjcsbS6npW8xP1jI0qOoS1fF0oyj-o,746
12
12
  xoscar/context.pyx,sha256=FOJVerGOvxe2USryXEQA0rpaFX_ScxISH6QWKUcahY8,11310
13
- xoscar/core.cp310-win_amd64.pyd,sha256=50-MDRQS83rNH-DhyfxgrXbkrUc9OvyCDtPAIJJ-3jQ,322048
13
+ xoscar/core.cp310-win_amd64.pyd,sha256=PnEJyC4U8SYg4EsonXXwb3FF17yC8pnqD-gwbT2eXwY,322048
14
14
  xoscar/core.pxd,sha256=9IZP7dYGfnF1I-obIls8R8b6forxDOPbiM3v5nVslLk,1368
15
15
  xoscar/core.pyx,sha256=U6jCZN74MQHi7HkQRaVGm_w5q-FMsw0nnE3aU6533_Q,22756
16
16
  xoscar/debug.py,sha256=hrmxIH6zvTKasQo6PUUgXu5mgEsR0g87Fvpw7CoHipg,5257
@@ -30,7 +30,7 @@ xoscar/backends/allocate_strategy.py,sha256=DzvTlixwzTANURI2mDLHm3vcaugSPDxU6UQZ
30
30
  xoscar/backends/config.py,sha256=86j0g_Xrl8ENPzBWi296yWg9QEcljvdKK-yJbfYTvQ0,5532
31
31
  xoscar/backends/context.py,sha256=qWwksx8JxYcKR-LQA3PvXh4ReuuTTEyDaLbjpxGXcTA,16766
32
32
  xoscar/backends/core.py,sha256=fbekAxys_t1Dv7if-1R6uVvC_yAxNkXLeQ1V1ZSAfC0,11161
33
- xoscar/backends/message.cp310-win_amd64.pyd,sha256=DK2xO52AfH1rXV6Ag1pfSSQjMrSThtSdHM5DG1SmuQk,244224
33
+ xoscar/backends/message.cp310-win_amd64.pyd,sha256=a8K7Wez2Qyjm0gyNG-36Oo9VsRisaQzftJGKMTXRig0,244224
34
34
  xoscar/backends/message.pyx,sha256=lBEjMJv4VyxmeO9lHXJJazOajbFnTLak4PSBcLoPZvU,20331
35
35
  xoscar/backends/pool.py,sha256=bS_m8XBkfQQsCOaLEzM6HkV5e78dPPp1bCH6yjvPEss,62153
36
36
  xoscar/backends/router.py,sha256=EjfNpQUrhFU15eYe1kRPueziHgI2gfDViUzm7ruvXDE,10817
@@ -57,8 +57,10 @@ xoscar/collective/common.py,sha256=9c7xq3IOUvfA0I9GnpalUqXZOzmF6IEILv4zL64BYVE,3
57
57
  xoscar/collective/core.py,sha256=191aPxbUgWpjzrqyozndImDAQhZFmqoQdBkHFLDfXN0,24239
58
58
  xoscar/collective/process_group.py,sha256=kTPbrLMJSGhqbiWvTIiz-X3W0rZWd_CFn_zUIlXbOlM,23286
59
59
  xoscar/collective/utils.py,sha256=p3WEVtXvnVhkuO5mRgQBhBRFr1dKHcDKMjrbMyuiyfg,1219
60
- xoscar/collective/uv.dll,sha256=ELGPHUkSKyFGZEjlCiTYLkiGUsb8SlPiZ7VWk7c6WH0,620544
61
- xoscar/collective/xoscar_pygloo.cp310-win_amd64.pyd,sha256=3UPzhpxy-bGomBWN42JKs4EMl74Y4OCQeuAzOAo9ENs,779264
60
+ xoscar/collective/uv.dll,sha256=asFNpWJyYV_2HrFxDub-UiOvpn-hKDZhc8p1mMi3Ymw,620544
61
+ xoscar/collective/xoscar_pygloo.cp310-win_amd64.pyd,sha256=17LRSS01H9aiy-3on2w8B9ERdKY3cGCSnFNe2yqDfuM,779264
62
+ xoscar/collective/backend/__init__.py,sha256=ddL0XEwB6InL4A6Z6eKsYKoDbMSC9s_mwLBPhOcnDfI,594
63
+ xoscar/collective/backend/nccl_backend.py,sha256=lp05ki_qhfdYEqG8HxG2ZSSfLoLlx1oMY7uwsD5I7-0,6440
62
64
  xoscar/metrics/__init__.py,sha256=RjXuuYw4I2YYgD8UY2Z5yCZk0Z56xMJ1n40O80Dtxf8,726
63
65
  xoscar/metrics/api.py,sha256=dtJ4QrIqQNXhJedeqOPs4TXKgrRGZFFN50xAd9SCfec,9144
64
66
  xoscar/metrics/backends/__init__.py,sha256=ZHepfhCDRuK9yz4pAM7bjpWDvS3Ijp1YgyynoUFLeuU,594
@@ -69,7 +71,7 @@ xoscar/metrics/backends/prometheus/__init__.py,sha256=ZHepfhCDRuK9yz4pAM7bjpWDvS
69
71
  xoscar/metrics/backends/prometheus/prometheus_metric.py,sha256=65hb8O3tmsEJ7jgOrIwl_suj9SE5Tmqcfjuk0urkLvE,2120
70
72
  xoscar/serialization/__init__.py,sha256=tS8C49yrW_geWNEsbgW3phK1q4YN1ojI6CN-vroIFYM,876
71
73
  xoscar/serialization/aio.py,sha256=7YLXgkWpQ3ANy-TZ1qO8Mt4_J3cZFhFh2FEgUgxMT60,4873
72
- xoscar/serialization/core.cp310-win_amd64.pyd,sha256=JtUD94QD6mg-lzmvw5Lq0peDu9IZUVorcEcV5ByIgWo,266240
74
+ xoscar/serialization/core.cp310-win_amd64.pyd,sha256=WmxpX-M22SCvkolnexZRXw1sfaFbzVgeEMdUfx8NiMs,266240
73
75
  xoscar/serialization/core.pxd,sha256=X-47bqBM2Kzw5SkLqICdKD0gU6CpmLsBxC3kfW--wVk,1013
74
76
  xoscar/serialization/core.pyx,sha256=ZKexLRnRwZXXn2045kR7xfM_szcoPNrDuouQCWtpFp8,30570
75
77
  xoscar/serialization/cuda.py,sha256=Fj4Cpr_YmkGceUCo0mQn8fRvmHP_5WcLdRx6epZ3RC0,3869
@@ -80,10 +82,10 @@ xoscar/serialization/pyfury.py,sha256=3ucal29Hr7PX9_1SfB2x43FE2xw_C0rLkVv3foL7qw
80
82
  xoscar/serialization/scipy.py,sha256=9ph-yoRoNiwUZTwQrn35U60VPirWlncXNAg6EXvqMR4,2554
81
83
  xoscar/virtualenv/__init__.py,sha256=rhJ7I6x7aXjKOCzSqsKLwqFJMh4YC2sqchEIJNEfI58,1151
82
84
  xoscar/virtualenv/core.py,sha256=nRfOcKQbb-4TjtLmeMepFnMPLySJAIFwFJsXvXnNv44,8366
83
- xoscar/virtualenv/platform.py,sha256=rkcqR_lTVJh3AVlP5TJ0NmUKbKKw47S56gRiHPDRimI,1456
85
+ xoscar/virtualenv/platform.py,sha256=pykIAB8R5uHHQc8igPt-6dHisoVscRKnUcNPrPIFWrY,1597
84
86
  xoscar/virtualenv/utils.py,sha256=WzhEnwgGNQV5sRqZrdvCyQPcJqI5V9feBLM_Mr7UD-w,2975
85
87
  xoscar/virtualenv/uv.py,sha256=m95UyJ9BnWHqAoRI_yT1PFB11ulr_CS_pBd_gKkOkyU,11412
86
- xoscar-0.7.16.dist-info/METADATA,sha256=FpyJkl7S-dm8CsRbEIZFTM4PGuAGlg46mVWn0lh7YYc,9361
87
- xoscar-0.7.16.dist-info/WHEEL,sha256=NVXpD7b4Gxps0cd2ds5rr5TG8W4ApEwx_i5J99qMZ5E,102
88
- xoscar-0.7.16.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
89
- xoscar-0.7.16.dist-info/RECORD,,
88
+ xoscar-0.7.17.dist-info/METADATA,sha256=rkEs0pYiIprCwjMGv8b1WDNIBBg5f0apVbDpp8XB8Jo,9361
89
+ xoscar-0.7.17.dist-info/WHEEL,sha256=NVXpD7b4Gxps0cd2ds5rr5TG8W4ApEwx_i5J99qMZ5E,102
90
+ xoscar-0.7.17.dist-info/top_level.txt,sha256=vYlqqY4Nys8Thm1hePIuUv8eQePdULVWMmt7lXtX_ZA,21
91
+ xoscar-0.7.17.dist-info/RECORD,,