xobjects 0.4.3__tar.gz → 0.4.5__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.
- {xobjects-0.4.3 → xobjects-0.4.5}/PKG-INFO +1 -1
- xobjects-0.4.5/xobjects/_version.py +1 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/capi.py +1 -1
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/context.py +14 -3
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/context_cpu.py +6 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/context_cupy.py +0 -1
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects.egg-info/PKG-INFO +1 -1
- xobjects-0.4.3/xobjects/_version.py +0 -1
- {xobjects-0.4.3 → xobjects-0.4.5}/.github/workflows/black.yml +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/.gitignore +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/.pre-commit-config.yaml +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/.readthedocs.yaml +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/Architecture.md +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/LICENSE +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/Readme.md +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/contributors_and_credits.txt +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/docs/Makefile +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/docs/architecture/contexts.rst +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/docs/architecture/types.rst +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/docs/architecture.rst +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/docs/conf.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/docs/index.rst +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/docs/make.bat +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/docs/quickstart.rst +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/docs/reference.rst +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/api_def.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/api_init.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/capi_example.c +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/check_assembly.c +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/ex_array_init_perf.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/ex_cpugpu.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/ex_nested_ref.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/ex_ref_cpu.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/ex_struct_cpu.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/ex_unionref_cpu.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/ex_unionref_method.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/init_soa.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/issue_with_two_pyopencl_contexts.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/kernel_basics/kernel_cffi.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/kernel_basics/kernel_cupy.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/kernel_basics/kernel_pyopencl.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/opencl_offsets.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/simple_kernel.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/examples/sixtracklib.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/mktest +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/pyproject.toml +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/release.sh +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/requirements.txt +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/setup.cfg +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/setup.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/__init__.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/__pycache__/test_context.cpython-37-pytest-6.2.1.pyc +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/notest_capi.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_align.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_array.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_buffer.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_capi.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_chunk.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_context_opencl.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_hybrid_class.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_kernel.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_linked_array.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_nplike_arrays.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_ref.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_scalars.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_shared_memory.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_strides.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_string.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_struct.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_to_json.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_typeutils.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/tests/test_unionref.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/update_cprght_statement.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/__init__.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/_patch_pyopencl_array.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/array.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/context_pyopencl.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/general.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/hybrid_class.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/linkedarray.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/ref.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/scalar.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/specialize_source.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/string.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/struct.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/test_helpers.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/typeutils.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects/union.py +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects.egg-info/SOURCES.txt +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects.egg-info/dependency_links.txt +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects.egg-info/requires.txt +0 -0
- {xobjects-0.4.3 → xobjects-0.4.5}/xobjects.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.5"
|
|
@@ -210,19 +210,30 @@ class XContext(ABC):
|
|
|
210
210
|
|
|
211
211
|
def __init__(self):
|
|
212
212
|
self._kernels = KernelDict()
|
|
213
|
-
self._buffers =
|
|
213
|
+
self._buffers = weakref.WeakSet()
|
|
214
|
+
self._allocations = 0
|
|
214
215
|
|
|
215
216
|
def __str__(self):
|
|
216
217
|
return type(self).__name__
|
|
217
218
|
|
|
218
219
|
def new_buffer(self, capacity=1048576):
|
|
219
220
|
buf = self._make_buffer(capacity=capacity)
|
|
220
|
-
self.
|
|
221
|
+
self._buffers.add(buf)
|
|
222
|
+
self._allocations += 1
|
|
221
223
|
return buf
|
|
222
224
|
|
|
225
|
+
def __getstate__(self):
|
|
226
|
+
state = self.__dict__
|
|
227
|
+
del state["_buffers"]
|
|
228
|
+
return state
|
|
229
|
+
|
|
230
|
+
def __setstate__(self, state):
|
|
231
|
+
self.__dict__.update(state)
|
|
232
|
+
self._buffers = weakref.WeakSet()
|
|
233
|
+
|
|
223
234
|
@property
|
|
224
235
|
def buffers(self):
|
|
225
|
-
return self._buffers
|
|
236
|
+
return list(self._buffers)
|
|
226
237
|
|
|
227
238
|
@property
|
|
228
239
|
def kernels(self):
|
|
@@ -10,6 +10,7 @@ import sysconfig
|
|
|
10
10
|
import uuid
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from typing import Callable, Dict, List, Sequence, Tuple
|
|
13
|
+
import weakref
|
|
13
14
|
|
|
14
15
|
from .general import _print
|
|
15
16
|
|
|
@@ -106,6 +107,9 @@ class LinkedArrayCpu(BaseLinkedArray, np.ndarray):
|
|
|
106
107
|
order="C",
|
|
107
108
|
)
|
|
108
109
|
|
|
110
|
+
def copy(self):
|
|
111
|
+
return np.array(self)
|
|
112
|
+
|
|
109
113
|
|
|
110
114
|
def _so_for_module_name(name, containing_dir=".") -> Path:
|
|
111
115
|
# The so file name is something like:
|
|
@@ -642,10 +646,12 @@ class ContextCpu(XContext):
|
|
|
642
646
|
def __getstate__(self):
|
|
643
647
|
state = self.__dict__.copy()
|
|
644
648
|
state["_kernels"] = {}
|
|
649
|
+
del state["_buffers"]
|
|
645
650
|
return state
|
|
646
651
|
|
|
647
652
|
def __setstate__(self, state):
|
|
648
653
|
self.__dict__.update(state)
|
|
654
|
+
self._buffers = weakref.WeakSet()
|
|
649
655
|
|
|
650
656
|
|
|
651
657
|
class BufferByteArray(XBuffer):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.3"
|
|
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
|
|
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
|
{xobjects-0.4.3 → xobjects-0.4.5}/tests/__pycache__/test_context.cpython-37-pytest-6.2.1.pyc
RENAMED
|
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
|
|
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
|