xobjects 0.5.0__tar.gz → 0.5.1__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.5.0/xobjects.egg-info → xobjects-0.5.1}/PKG-INFO +1 -1
- xobjects-0.5.1/xobjects/_version.py +1 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/context_cpu.py +0 -6
- xobjects-0.5.1/xobjects/general.py +52 -0
- {xobjects-0.5.0 → xobjects-0.5.1/xobjects.egg-info}/PKG-INFO +1 -1
- xobjects-0.5.0/xobjects/_version.py +0 -1
- xobjects-0.5.0/xobjects/general.py +0 -33
- {xobjects-0.5.0 → xobjects-0.5.1}/LICENSE +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/pyproject.toml +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/setup.cfg +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/setup.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_align.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_array.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_buffer.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_capi.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_chunk.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_context_opencl.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_hybrid_class.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_kernel.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_linked_array.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_nplike_arrays.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_ref.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_scalars.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_shared_memory.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_strides.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_string.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_struct.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_to_json.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_typeutils.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/tests/test_unionref.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/__init__.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/_patch_pyopencl_array.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/array.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/capi.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/context.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/context_cupy.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/context_pyopencl.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/hybrid_class.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/linkedarray.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/ref.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/scalar.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/specialize_source.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/string.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/struct.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/test_helpers.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/typeutils.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects/union.py +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects.egg-info/SOURCES.txt +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects.egg-info/dependency_links.txt +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects.egg-info/requires.txt +0 -0
- {xobjects-0.5.0 → xobjects-0.5.1}/xobjects.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.1"
|
|
@@ -422,12 +422,6 @@ class ContextCpu(XContext):
|
|
|
422
422
|
xtr_link_args.append("-fopenmp")
|
|
423
423
|
xtr_compile_args.append("-DXO_CONTEXT_CPU_OPENMP")
|
|
424
424
|
xtr_link_args.append("-DXO_CONTEXT_CPU_OPENMP")
|
|
425
|
-
|
|
426
|
-
# https://mac.r-project.org/openmp/
|
|
427
|
-
# on macos comment the above and uncomment the below flags to compile OpenMP with Xcode clang:
|
|
428
|
-
# xtr_compile_args.append("-Xclang")
|
|
429
|
-
# xtr_compile_args.append("-fopenmp")
|
|
430
|
-
# xtr_link_args.append("-lomp")
|
|
431
425
|
else:
|
|
432
426
|
xtr_compile_args.append("-DXO_CONTEXT_CPU_SERIAL")
|
|
433
427
|
xtr_link_args.append("-DXO_CONTEXT_CPU_SERIAL")
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# copyright ################################# #
|
|
2
|
+
# This file is part of the Xobjects Package. #
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
|
+
# ########################################### #
|
|
5
|
+
from numpy.testing import assert_allclose as np_assert_allclose
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Print:
|
|
10
|
+
suppress = False
|
|
11
|
+
|
|
12
|
+
def __call__(self, *args, **kwargs):
|
|
13
|
+
if not self.suppress:
|
|
14
|
+
print(*args, **kwargs)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
_print = Print()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def assert_allclose(a, b, rtol=0, atol=0, max_outliers=0):
|
|
21
|
+
if hasattr(a, "get"):
|
|
22
|
+
a = a.get()
|
|
23
|
+
if hasattr(b, "get"):
|
|
24
|
+
b = b.get()
|
|
25
|
+
try:
|
|
26
|
+
a = np.squeeze(a)
|
|
27
|
+
except:
|
|
28
|
+
pass
|
|
29
|
+
try:
|
|
30
|
+
b = np.squeeze(b)
|
|
31
|
+
except:
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
np_assert_allclose(a, b, rtol=rtol, atol=atol)
|
|
36
|
+
except AssertionError as e:
|
|
37
|
+
if max_outliers == 0:
|
|
38
|
+
raise e
|
|
39
|
+
if not allclose_with_outliers(a, b, rtol, atol, max_outliers):
|
|
40
|
+
raise AssertionError(
|
|
41
|
+
"Arrays are not close enough, even with outliers allowed."
|
|
42
|
+
) from e
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def allclose_with_outliers(a, b, rtol=1e-7, atol=0, max_outliers=0):
|
|
46
|
+
a = np.asanyarray(a)
|
|
47
|
+
b = np.asanyarray(b)
|
|
48
|
+
diff = np.abs(a - b)
|
|
49
|
+
allowed = atol + rtol * np.abs(b)
|
|
50
|
+
mask = diff > allowed
|
|
51
|
+
num_outliers = np.count_nonzero(mask)
|
|
52
|
+
return num_outliers <= max_outliers
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.5.0"
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# copyright ################################# #
|
|
2
|
-
# This file is part of the Xobjects Package. #
|
|
3
|
-
# Copyright (c) CERN, 2024. #
|
|
4
|
-
# ########################################### #
|
|
5
|
-
from numpy.testing import assert_allclose as np_assert_allclose
|
|
6
|
-
import numpy as np
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Print:
|
|
10
|
-
suppress = False
|
|
11
|
-
|
|
12
|
-
def __call__(self, *args, **kwargs):
|
|
13
|
-
if not self.suppress:
|
|
14
|
-
print(*args, **kwargs)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_print = Print()
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def assert_allclose(a, b, rtol=1e-7, atol=1e-7):
|
|
21
|
-
if hasattr(a, "get"):
|
|
22
|
-
a = a.get()
|
|
23
|
-
if hasattr(b, "get"):
|
|
24
|
-
b = b.get()
|
|
25
|
-
try:
|
|
26
|
-
a = np.squeeze(a)
|
|
27
|
-
except:
|
|
28
|
-
pass
|
|
29
|
-
try:
|
|
30
|
-
b = np.squeeze(b)
|
|
31
|
-
except:
|
|
32
|
-
pass
|
|
33
|
-
np_assert_allclose(a, b, rtol=rtol, atol=atol)
|
|
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
|
|
File without changes
|