Skip to content

Commit 00c0506

Browse files
authored
change DPCtrl usage logic out of default (#887)
1 parent e4a14d9 commit 00c0506

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

dpnp/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
Explicitly use NumPy.ndarray as return type for creation functions
4444
'''
4545

46-
__DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__ = int(os.getenv('DPNP_OUTPUT_DPCTL_DEFAULT_SHARED', 0))
46+
__DPNP_OUTPUT_DPCTL__ = int(os.getenv('DPNP_OUTPUT_DPCTL', 0))
4747
'''
48-
Explicitly use SYCL shared memory parameter in DPCtl array constructor for creation functions
48+
Explicitly use DPCtl package container as return type for creation functions
4949
'''
5050

51-
__DPNP_DPCTL_AVAILABLE__ = False
51+
__DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__ = int(os.getenv('DPNP_OUTPUT_DPCTL_DEFAULT_SHARED', 0))
5252
'''
53-
Availability of the DPCtl package in the environment
53+
Explicitly use SYCL shared memory parameter in DPCtl array constructor for creation functions
5454
'''

dpnp/dpnp_container.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,18 @@
4040
import numpy
4141

4242

43-
try:
44-
"""
45-
Detect DPCtl availability to use data container
46-
"""
47-
import dpctl.tensor as dpctl
48-
49-
config.__DPNP_DPCTL_AVAILABLE__ = True
50-
51-
except ImportError:
52-
"""
53-
No DPCtl data container available
54-
"""
55-
config.__DPNP_DPCTL_AVAILABLE__ = False
43+
if config.__DPNP_OUTPUT_DPCTL__:
44+
try:
45+
"""
46+
Detect DPCtl availability to use data container
47+
"""
48+
import dpctl.tensor as dpctl
5649

57-
# config.__DPNP_DPCTL_AVAILABLE__ = False
50+
except ImportError:
51+
"""
52+
No DPCtl data container available
53+
"""
54+
config.__DPNP_OUTPUT_DPCTL__ = 0
5855

5956

6057
__all__ = [
@@ -67,7 +64,7 @@ def create_output_container(shape, type):
6764
""" Create NumPy ndarray """
6865
# TODO need to use "buffer=" parameter to use SYCL aware memory
6966
result = numpy.ndarray(shape, dtype=type)
70-
elif config.__DPNP_DPCTL_AVAILABLE__:
67+
elif config.__DPNP_OUTPUT_DPCTL__:
7168
""" Create DPCTL array """
7269
if config.__DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__:
7370
"""

dpnp/dpnp_iface_arraycreation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def array(x1, dtype=None, copy=True, order='C', subok=False, ndmin=0, like=None)
195195

196196
if not dpnp.is_type_supported(dtype) and dtype is not None:
197197
pass
198-
elif config.__DPNP_DPCTL_AVAILABLE__:
198+
elif config.__DPNP_OUTPUT_DPCTL__:
199199
# TODO this is workaround becasue
200200
# usm_array has no element wise assignment (aka []) and
201201
# has no "flat" property and

0 commit comments

Comments
 (0)