Skip to content

Commit f25c29e

Browse files
Merge 'master' into fix_asfarray_func
2 parents b4a98c5 + 4012c98 commit f25c29e

File tree

6 files changed

+31
-7
lines changed

6 files changed

+31
-7
lines changed

0.build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ CC=icpx python setup.py build_ext --inplace
2525

2626
echo
2727
echo =========example3==============
28-
icpx -fsycl -g -fPIC dpnp/backend/examples/example3.cpp -Idpnp -Idpnp/backend/include -Ldpnp -Wl,-rpath='$ORIGIN'/dpnp -ldpnp_backend_c -o example3
28+
DPCTL_INCLUDES=$(python -m dpctl --includes)
29+
icpx -fsycl -g -O0 -ggdb3 -fPIC dpnp/backend/examples/example3.cpp $DPCTL_INCLUDES -Idpnp -Idpnp/backend/include -Ldpnp -Wl,-rpath='$ORIGIN'/dpnp -ldpnp_backend_c -o example3
2930
# LD_DEBUG=libs,bindings,symbols ./example3
3031
./example3
3132

@@ -47,7 +48,7 @@ icpx -fsycl -g -fPIC dpnp/backend/examples/example3.cpp -Idpnp -Idpnp/backend/in
4748
# strings /usr/share/miniconda/envs/dpnp*/lib/libstdc++.so | grep GLIBCXX | sort -n
4849

4950

50-
# echo
51+
echo
5152
echo =========example1==============
5253
# LD_DEBUG=libs,bindings,symbols python examples/example1.py
5354
# LD_DEBUG=libs python examples/example1.py

conda-recipe/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ fi
2929
export CFLAGS="-Wl,-rpath,\$ORIGIN/../dpctl,-rpath,\$ORIGIN $CFLAGS"
3030
export LDFLAGS="-Wl,-rpath,\$ORIGIN/../dpctl,-rpath,\$ORIGIN $LDFLAGS"
3131

32+
# Intel LLVM must cooperate with compiler and sysroot from conda
33+
echo "--gcc-toolchain=${BUILD_PREFIX} --sysroot=${BUILD_PREFIX}/${HOST}/sysroot -target ${HOST}" > icpx_for_conda.cfg
34+
export ICPXCFG="$(pwd)/icpx_for_conda.cfg"
35+
export ICXCFG="$(pwd)/icpx_for_conda.cfg"
36+
3237
$PYTHON setup.py build_clib
3338
$PYTHON setup.py build_ext install
3439

dpnp/backend/src/queue_sycl.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ class backend_sycl
137137
#else
138138
// temporal solution. Started from Sept-2020
139139
DPCTLSyclQueueRef DPCtrl_queue = DPCTLQueueMgr_GetCurrentQueue();
140+
if (DPCtrl_queue == nullptr)
141+
{
142+
std::string reason = (DPCTLQueueMgr_GetQueueStackSize() == static_cast<size_t>(-1))
143+
? ": the queue stack is empty, probably no device is available."
144+
: ".";
145+
throw std::runtime_error("Failed to create a copy of SYCL queue with default device" + reason);
146+
}
140147
return *(reinterpret_cast<sycl::queue*>(DPCtrl_queue));
141148
#endif
142149
}

dpnp/dpnp_algo/dpnp_algo.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ cdef extern from "constants.hpp":
391391

392392
cdef extern from "dpnp_iface.hpp":
393393
void dpnp_queue_initialize_c(QueueOptions selector)
394-
size_t dpnp_queue_is_cpu_c()
394+
size_t dpnp_queue_is_cpu_c() except +
395395

396396
char * dpnp_memory_alloc_c(size_t size_in_bytes) except +
397397
void dpnp_memory_free_c(void * ptr)

dpnp/dpnp_utils/dpnp_algo_utils.pyx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,6 @@ cdef tuple get_common_usm_allocation(dpnp_descriptor x1, dpnp_descriptor x2):
651651
"".format(array1_obj.usm_type, array2_obj.usm_type))
652652

653653
common_sycl_queue = dpu.get_execution_queue((array1_obj.sycl_queue, array2_obj.sycl_queue))
654-
# TODO: refactor, remove when CFD is implemented in all array constructors
655-
if common_sycl_queue is None and array1_obj.sycl_context == array2_obj.sycl_context:
656-
common_sycl_queue = array1_obj.sycl_queue
657654
if common_sycl_queue is None:
658655
raise ValueError(
659656
"could not recognize common SYCL queue for inputs in SYCL queues {} and {}"

tests/test_sycl_queue.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import numpy
77

88
from numpy.testing import (
9-
assert_array_equal
9+
assert_array_equal,
10+
assert_raises
1011
)
1112

1213

@@ -353,6 +354,19 @@ def test_broadcasting(func, data1, data2, device):
353354
assert_sycl_queue_equal(result_queue, expected_queue)
354355

355356

357+
@pytest.mark.parametrize("func", ["add", "copysign", "divide", "floor_divide", "fmod",
358+
"maximum", "minimum", "multiply", "outer", "power",
359+
"remainder", "subtract"])
360+
@pytest.mark.parametrize("device",
361+
valid_devices,
362+
ids=[device.filter_string for device in valid_devices])
363+
def test_2in_1out_diff_queue_but_equal_context(func, device):
364+
x1 = dpnp.arange(10)
365+
x2 = dpnp.arange(10, sycl_queue=dpctl.SyclQueue(device))[::-1]
366+
with assert_raises(ValueError):
367+
getattr(dpnp, func)(x1, x2)
368+
369+
356370
@pytest.mark.parametrize(
357371
"func, kwargs",
358372
[

0 commit comments

Comments
 (0)