Skip to content

Commit

Permalink
Investigate fft tests failure on Linux in ext CI
Browse files Browse the repository at this point in the history
  • Loading branch information
antonwolfy committed Oct 7, 2022
1 parent 15fc4b8 commit 4bdf551
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ jobs:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Install dpnp
run: conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} dpctl=${{ matrix.dpctl }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
run: conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
env:
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'

Expand All @@ -239,6 +239,12 @@ jobs:
- name: Smoke test
run: python -c "import dpnp, dpctl; dpctl.lsplatform()"

- name: Run fft tests with debug
run: python -m pytest -q -ra --disable-warnings -vv test_fft.py -s
env:
SYCL_ENABLE_HOST_DEVICE: '1'
working-directory: ${{ env.tests-path }}

# TODO: run the whole scope once the issues on CPU are resolved
- name: Run tests
run: python -m pytest -q -ra --disable-warnings -vv test_arraycreation.py test_dparray.py test_fft.py test_mathematical.py test_special.py
Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_algo/dpnp_algo.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ cdef DPNPFuncType dpnp_dtype_to_DPNPFuncType(dtype):
if isinstance(kind, int):
kind = chr(kind)
itemsize = numpy.dtype(dtype).itemsize
print(f"dpnp_dtype_to_DPNPFuncType: dtype={dtype}, dt_c={dt_c}, kind={kind}, itemsize={itemsize}")

if dt_c == 'd':
return DPNP_FT_DOUBLE
Expand Down
6 changes: 6 additions & 0 deletions dpnp/dpnp_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,24 @@ def asarray(x1,
usm_type=None,
sycl_queue=None):
"""Converts `x1` to `dpnp_array`."""
print(f"asarray: x1.dtype={x1.dtype}")
print(f"asarray: x1={x1}, dtype={dtype}, copy={copy}, order={order}, device={device}, usm_type={usm_type}, sycl_queue={sycl_queue}")
if isinstance(x1, dpnp_array):
print("asarray: instance of dpnp_array?")
x1_obj = x1.get_array()
else:
x1_obj = x1

sycl_queue_normalized = normalize_queue_device(sycl_queue=sycl_queue, device=device)
print(f"asarray: sycl_queue_normalized={sycl_queue_normalized}")
print(f"asarray: before dpctl: x1_obj.dtype={x1_obj.dtype}")
array_obj = dpt.asarray(x1_obj,
dtype=dtype,
copy=copy,
order=order,
usm_type=usm_type,
sycl_queue=sycl_queue_normalized)
print(f"asarray: after dpctl: array_obj.dtype={array_obj.dtype}")

return dpnp_array(array_obj.shape, buffer=array_obj, order=order)

Expand Down
12 changes: 12 additions & 0 deletions dpnp/dpnp_iface.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ def get_dpnp_descriptor(ext_obj, copy_when_strides=True, copy_when_nondefault_qu
# if no_modules_load_doc_build();
# return False

print(f"get_dpnp_descriptor: enter: ext_obj.dtype={ext_obj.dtype}")

if use_origin_backend():
return False

Expand All @@ -219,22 +221,32 @@ def get_dpnp_descriptor(ext_obj, copy_when_strides=True, copy_when_nondefault_qu
ext_obj_offset = 0

if ext_obj.strides != shape_offsets or ext_obj_offset != 0:
print("get_dpnp_descriptor: create non-strides copy")
ext_obj = array(ext_obj)
else:
print("get_dpnp_descriptor: no need to create non-strides copy")

print(f"get_dpnp_descriptor: if non-strided copy: ext_obj.dtype={ext_obj.dtype}")

# while dpnp functions are based on DPNP_QUEUE
# we need to create a copy on device associated with DPNP_QUEUE
# if function get implementation for different queue
# then this behavior can be disabled with setting "copy_when_nondefault_queue"
arr_obj = unwrap_array(ext_obj)
print(f"get_dpnp_descriptor: arr_obj.dtype={arr_obj.dtype}")

queue = getattr(arr_obj, "sycl_queue", None)
if queue is not None and copy_when_nondefault_queue:
default_queue = dpctl.SyclQueue()
queue_is_default = dpctl.utils.get_execution_queue([queue, default_queue]) is not None
if not queue_is_default:
ext_obj = array(arr_obj, sycl_queue=default_queue)

print(f"get_dpnp_descriptor: if new queue: arr_obj.dtype={arr_obj.dtype}")

dpnp_desc = dpnp_descriptor(ext_obj)
if dpnp_desc.is_valid:
print(f"get_dpnp_descriptor: return: dpnp_desc.dtype={dpnp_desc.dtype}")
return dpnp_desc

return False
Expand Down
8 changes: 8 additions & 0 deletions dpnp/dpnp_utils/dpnp_algo_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ cdef dpnp_descriptor create_output_descriptor(shape_type_c output_shape,
if sycl_queue is not None:
device = None
result_dtype = dpnp_DPNPFuncType_to_dtype(< size_t > c_type)
print(f"create_output_descriptor: result_dtype={result_dtype}")
result_obj = dpnp_container.empty(output_shape,
dtype=result_dtype,
device=device,
Expand Down Expand Up @@ -570,6 +571,8 @@ cdef class dpnp_descriptor:
self.dpnp_descriptor_data_size = 0
self.dpnp_descriptor_is_scalar = True

print("dpnp_descriptor: __init__")

""" Accure DPCTL data container storage """
self.descriptor = getattr(obj, "__sycl_usm_array_interface__", None)
if self.descriptor is None:
Expand All @@ -581,8 +584,12 @@ cdef class dpnp_descriptor:

if self.descriptor["version"] != 3:
return
else:
print("dpnp_descriptor: has __sycl_usm_array_interface__ attr")
print(f"dpnp_descriptor: self.descriptor={self.descriptor}")

self.origin_pyobj = obj
print(f"dpnp_descriptor: obj.dtype={obj.dtype}")

""" array size calculation """
cdef Py_ssize_t shape_it = 0
Expand Down Expand Up @@ -630,6 +637,7 @@ cdef class dpnp_descriptor:
def dtype(self):
if self.is_valid:
type_str = self.descriptor["typestr"]
print(f"dtype: type_str={type_str}")
return dpnp.dtype(type_str)
return None

Expand Down
1 change: 1 addition & 0 deletions dpnp/fft/dpnp_algo_fft.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ cpdef utils.dpnp_descriptor dpnp_fft(utils.dpnp_descriptor input,
output_shape[axis_norm] = output_boundarie

# convert string type names (dtype) to C enum DPNPFuncType
print(f"dpnp_fft: input.dtype={input.dtype}")
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(input.dtype)

# get the FPTR data structure
Expand Down

0 comments on commit 4bdf551

Please sign in to comment.