xobjects 0.5.12__tar.gz → 0.5.13__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.
Files changed (57) hide show
  1. {xobjects-0.5.12/xobjects.egg-info → xobjects-0.5.13}/PKG-INFO +1 -1
  2. xobjects-0.5.13/xobjects/_version.py +1 -0
  3. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/context_cpu.py +17 -9
  4. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/struct.py +26 -0
  5. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/test_helpers.py +8 -0
  6. {xobjects-0.5.12 → xobjects-0.5.13/xobjects.egg-info}/PKG-INFO +1 -1
  7. xobjects-0.5.12/xobjects/_version.py +0 -1
  8. {xobjects-0.5.12 → xobjects-0.5.13}/Architecture.md +0 -0
  9. {xobjects-0.5.12 → xobjects-0.5.13}/LICENSE +0 -0
  10. {xobjects-0.5.12 → xobjects-0.5.13}/MANIFEST.in +0 -0
  11. {xobjects-0.5.12 → xobjects-0.5.13}/Readme.md +0 -0
  12. {xobjects-0.5.12 → xobjects-0.5.13}/pyproject.toml +0 -0
  13. {xobjects-0.5.12 → xobjects-0.5.13}/setup.cfg +0 -0
  14. {xobjects-0.5.12 → xobjects-0.5.13}/setup.py +0 -0
  15. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_align.py +0 -0
  16. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_array.py +0 -0
  17. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_buffer.py +0 -0
  18. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_capi.py +0 -0
  19. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_chunk.py +0 -0
  20. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_common.py +0 -0
  21. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_context_opencl.py +0 -0
  22. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_hybrid_class.py +0 -0
  23. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_kernel.py +0 -0
  24. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_linked_array.py +0 -0
  25. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_nplike_arrays.py +0 -0
  26. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_ref.py +0 -0
  27. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_scalars.py +0 -0
  28. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_shared_memory.py +0 -0
  29. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_strides.py +0 -0
  30. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_string.py +0 -0
  31. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_struct.py +0 -0
  32. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_to_dict.py +0 -0
  33. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_typeutils.py +0 -0
  34. {xobjects-0.5.12 → xobjects-0.5.13}/tests/test_unionref.py +0 -0
  35. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/__init__.py +0 -0
  36. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/_patch_pyopencl_array.py +0 -0
  37. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/array.py +0 -0
  38. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/capi.py +0 -0
  39. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/context.py +0 -0
  40. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/context_cupy.py +0 -0
  41. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/context_pyopencl.py +0 -0
  42. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/general.py +0 -0
  43. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/headers/atomicadd.h +0 -0
  44. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/headers/common.h +0 -0
  45. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/hybrid_class.py +0 -0
  46. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/linkedarray.py +0 -0
  47. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/ref.py +0 -0
  48. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/scalar.py +0 -0
  49. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/specialize_source.py +0 -0
  50. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/string.py +0 -0
  51. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/typeutils.py +0 -0
  52. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects/union.py +0 -0
  53. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects.egg-info/SOURCES.txt +0 -0
  54. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects.egg-info/dependency_links.txt +0 -0
  55. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects.egg-info/entry_points.txt +0 -0
  56. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects.egg-info/requires.txt +0 -0
  57. {xobjects-0.5.12 → xobjects-0.5.13}/xobjects.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xobjects
3
- Version: 0.5.12
3
+ Version: 0.5.13
4
4
  Summary: In-memory serialization and code generator for CPU and GPU
5
5
  Home-page: https://xsuite.readthedocs.io/
6
6
  Download-URL: https://pypi.python.org/pypi/xobjects
@@ -0,0 +1 @@
1
+ __version__ = "0.5.13"
@@ -316,6 +316,12 @@ class ContextCpu(XContext):
316
316
  if _forbid_compile:
317
317
  raise RuntimeError("Compilation is forbidden")
318
318
 
319
+ if os.environ.get('XOBJECTS_FORBID_COMPILE'):
320
+ raise RuntimeError(
321
+ "Compilation is forbidden by the environment variable "
322
+ "XOBJECTS_FORBID_COMPILE"
323
+ )
324
+
319
325
  so_file = self.compile_kernel(
320
326
  module_name,
321
327
  kernel_descriptions,
@@ -376,8 +382,9 @@ class ContextCpu(XContext):
376
382
  )
377
383
  out_kernels = {}
378
384
  for pyname, kernel_desc in kernel_descriptions.items():
385
+ c_name = kernel_desc.c_name or pyname
379
386
  out_kernels[pyname] = KernelCpu(
380
- function=getattr(module.lib, kernel_desc.c_name),
387
+ function=getattr(module.lib, c_name),
381
388
  description=kernel_desc,
382
389
  ffi_interface=module.ffi,
383
390
  context=self,
@@ -459,14 +466,15 @@ class ContextCpu(XContext):
459
466
  return Path(output_file)
460
467
  finally:
461
468
  # Clean temp files
462
- files_to_remove = [
463
- module_name + ".c",
464
- module_name + ".o",
465
- ]
466
-
467
- for ff in files_to_remove:
468
- if os.path.exists(ff):
469
- os.remove(ff)
469
+ if 'XOBJECTS_KEEP_BUILD_FILES' not in os.environ:
470
+ files_to_remove = [
471
+ module_name + ".c",
472
+ module_name + ".o",
473
+ ]
474
+
475
+ for ff in files_to_remove:
476
+ if os.path.exists(ff):
477
+ os.remove(ff)
470
478
 
471
479
  def _build_sources(
472
480
  self,
@@ -475,6 +475,32 @@ class Struct(metaclass=MetaStruct):
475
475
  extra_classes=(),
476
476
  extra_compile_args=(),
477
477
  ):
478
+
479
+ if context.allow_prebuilt_kernels:
480
+ _print_state = Print.suppress
481
+ Print.suppress = True
482
+ try:
483
+ from xsuite import (
484
+ get_suitable_kernel,
485
+ XSK_PREBUILT_KERNELS_LOCATION,
486
+ )
487
+ kernel_info = get_suitable_kernel(
488
+ config={},
489
+ tracker_element_classes=[],
490
+ classes=list(extra_classes) + [cls],
491
+ )
492
+ except ImportError:
493
+ kernel_info = None
494
+
495
+ Print.suppress = _print_state
496
+ if kernel_info:
497
+ kernels = context.kernels_from_file(
498
+ module_name=kernel_info['module_name'],
499
+ containing_dir=XSK_PREBUILT_KERNELS_LOCATION,
500
+ kernel_descriptions=cls._kernels,
501
+ )
502
+ context.kernels.update(kernels)
503
+
478
504
  if only_if_needed:
479
505
  all_found = True
480
506
  for kk, kernel_description in cls._kernels.items():
@@ -5,6 +5,7 @@
5
5
 
6
6
  from functools import wraps
7
7
  from typing import Callable, Iterable, Union
8
+ import os
8
9
 
9
10
  import pytest
10
11
 
@@ -105,3 +106,10 @@ def fix_random_seed(seed: int):
105
106
  return wrapper
106
107
 
107
108
  return decorator
109
+
110
+ def skip_if_forbid_compile():
111
+ if os.environ.get('XOBJECTS_FORBID_COMPILE'):
112
+ pytest.skip(
113
+ "Compilation is forbidden by the environment variable "
114
+ "XOBJECTS_FORBID_COMPILE"
115
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xobjects
3
- Version: 0.5.12
3
+ Version: 0.5.13
4
4
  Summary: In-memory serialization and code generator for CPU and GPU
5
5
  Home-page: https://xsuite.readthedocs.io/
6
6
  Download-URL: https://pypi.python.org/pypi/xobjects
@@ -1 +0,0 @@
1
- __version__ = "0.5.12"
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