xobjects 0.2.7__tar.gz → 0.2.9__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.2.7/xobjects.egg-info → xobjects-0.2.9}/PKG-INFO +1 -1
- xobjects-0.2.9/xobjects/_version.py +1 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/context_cpu.py +11 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/context_cupy.py +6 -4
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/hybrid_class.py +7 -1
- {xobjects-0.2.7 → xobjects-0.2.9/xobjects.egg-info}/PKG-INFO +1 -1
- xobjects-0.2.7/xobjects/_version.py +0 -1
- {xobjects-0.2.7 → xobjects-0.2.9}/LICENSE +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/pyproject.toml +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/setup.cfg +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/setup.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/__init__.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/_patch_pyopencl_array.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/array.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/capi.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/context.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/context_pyopencl.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/general.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/linkedarray.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/ref.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/scalar.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/specialize_source.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/string.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/struct.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/test_helpers.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/typeutils.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects/union.py +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects.egg-info/SOURCES.txt +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects.egg-info/dependency_links.txt +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects.egg-info/requires.txt +0 -0
- {xobjects-0.2.7 → xobjects-0.2.9}/xobjects.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.9"
|
|
@@ -16,6 +16,8 @@ from .general import _print
|
|
|
16
16
|
import numpy as np
|
|
17
17
|
import scipy as sp
|
|
18
18
|
|
|
19
|
+
_forbid_compile = False
|
|
20
|
+
|
|
19
21
|
from .context import (
|
|
20
22
|
Kernel,
|
|
21
23
|
ModuleNotAvailable,
|
|
@@ -301,6 +303,9 @@ class ContextCpu(XContext):
|
|
|
301
303
|
cdefs = "\n".join(cls._gen_c_decl({}) for cls in classes)
|
|
302
304
|
cdefs += "\n" + extra_cdef
|
|
303
305
|
|
|
306
|
+
if _forbid_compile:
|
|
307
|
+
raise RuntimeError("Compilation is forbidden")
|
|
308
|
+
|
|
304
309
|
so_file = self.compile_kernel(
|
|
305
310
|
module_name,
|
|
306
311
|
kernel_descriptions,
|
|
@@ -407,6 +412,12 @@ class ContextCpu(XContext):
|
|
|
407
412
|
xtr_compile_args.append("-fopenmp")
|
|
408
413
|
xtr_link_args.append("-fopenmp")
|
|
409
414
|
|
|
415
|
+
# https://mac.r-project.org/openmp/
|
|
416
|
+
# on macos comment the above and uncomment the below flags to compile OpenMP with Xcode clang:
|
|
417
|
+
#xtr_compile_args.append("-Xclang")
|
|
418
|
+
#xtr_compile_args.append("-fopenmp")
|
|
419
|
+
#xtr_link_args.append("-lomp")
|
|
420
|
+
|
|
410
421
|
if os.name == "nt": # windows
|
|
411
422
|
# TODO: to be handled properly
|
|
412
423
|
xtr_compile_args = []
|
|
@@ -392,13 +392,14 @@ class ContextCupy(XContext):
|
|
|
392
392
|
def linked_array_type(self):
|
|
393
393
|
return LinkedArrayCupy
|
|
394
394
|
|
|
395
|
-
def __init__(self, default_block_size=256, device=None):
|
|
395
|
+
def __init__(self, default_block_size=256, default_shared_mem_size_bytes=0, device=None):
|
|
396
396
|
if device is not None:
|
|
397
397
|
cupy.cuda.Device(device).use()
|
|
398
398
|
|
|
399
399
|
super().__init__()
|
|
400
400
|
|
|
401
401
|
self.default_block_size = default_block_size
|
|
402
|
+
self.default_shared_mem_size_bytes = default_shared_mem_size_bytes
|
|
402
403
|
|
|
403
404
|
def _make_buffer(self, capacity):
|
|
404
405
|
return BufferCupy(capacity=capacity, context=self)
|
|
@@ -417,7 +418,6 @@ class ContextCupy(XContext):
|
|
|
417
418
|
) -> Dict[Tuple[str, tuple], "KernelCupy"]:
|
|
418
419
|
if not compile:
|
|
419
420
|
raise NotImplementedError("compile=False available only on CPU.")
|
|
420
|
-
|
|
421
421
|
classes = list(classes_from_kernels(kernel_descriptions))
|
|
422
422
|
classes += list(extra_classes)
|
|
423
423
|
classes = sort_classes(classes)
|
|
@@ -455,12 +455,12 @@ class ContextCupy(XContext):
|
|
|
455
455
|
for pyname, kernel in kernel_descriptions.items():
|
|
456
456
|
if kernel.c_name is None:
|
|
457
457
|
kernel.c_name = pyname
|
|
458
|
-
|
|
459
458
|
out_kernels[pyname] = KernelCupy(
|
|
460
459
|
function=module.get_function(kernel.c_name),
|
|
461
460
|
description=kernel,
|
|
462
461
|
block_size=self.default_block_size,
|
|
463
462
|
context=self,
|
|
463
|
+
shared_mem_size_bytes=self.default_shared_mem_size_bytes
|
|
464
464
|
)
|
|
465
465
|
|
|
466
466
|
out_kernels[pyname].source = source
|
|
@@ -633,11 +633,13 @@ class KernelCupy(object):
|
|
|
633
633
|
description,
|
|
634
634
|
block_size,
|
|
635
635
|
context,
|
|
636
|
+
shared_mem_size_bytes
|
|
636
637
|
):
|
|
637
638
|
self.function = function
|
|
638
639
|
self.description = description
|
|
639
640
|
self.block_size = block_size
|
|
640
641
|
self.context = context
|
|
642
|
+
self.shared_mem_size_bytes = shared_mem_size_bytes
|
|
641
643
|
|
|
642
644
|
def to_function_arg(self, arg, value):
|
|
643
645
|
if arg.pointer:
|
|
@@ -682,7 +684,7 @@ class KernelCupy(object):
|
|
|
682
684
|
n_threads = self.description.n_threads
|
|
683
685
|
|
|
684
686
|
grid_size = int(np.ceil(n_threads / self.block_size))
|
|
685
|
-
self.function((grid_size,), (self.block_size,), arg_list)
|
|
687
|
+
self.function((grid_size,), (self.block_size,), arg_list, shared_mem=self.shared_mem_size_bytes)
|
|
686
688
|
|
|
687
689
|
|
|
688
690
|
class FFTCupy(object):
|
|
@@ -301,7 +301,13 @@ class HybridClass(metaclass=MetaHybridClass):
|
|
|
301
301
|
|
|
302
302
|
if hasattr(obj, "_store_in_to_dict"):
|
|
303
303
|
for nn in obj._store_in_to_dict:
|
|
304
|
-
|
|
304
|
+
ww = getattr(obj, nn)
|
|
305
|
+
if hasattr(ww, "to_dict"):
|
|
306
|
+
out[nn] = ww.to_dict()
|
|
307
|
+
elif hasattr(ww, "_to_dict"):
|
|
308
|
+
out[nn] = ww._to_dict()
|
|
309
|
+
else:
|
|
310
|
+
out[nn] = ww
|
|
305
311
|
|
|
306
312
|
return out
|
|
307
313
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.7"
|
|
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
|