Skip to content

Example rewritten on the dpnp failed with numpy.pi #1249

Closed
@mvyasank

Description

@mvyasank

Example rewritten on the dpnp failed. Why user should understand that it is needed to specify precision floating-point number type? Can it be more clear for end user?

Example on numpy

import numpy as np

create function f(x) = sin(x)

y = lambda x: np.sin(x)

create area for graphic

x = np.linspace(0, numpy.pi, 100)

draw graphic

print (y(x))

import dpnp as np

create function f(x) = sin(x)

y = lambda x: np.sin(x)

create area for graphic

x = np.linspace(0, numpy.pi, 100)

draw graphic

print (y(x))

Error is

RuntimeError Traceback (most recent call last)
File dpctl\tensor_usmarray.pyx:936, in dpctl.tensor._usmarray.usm_ndarray.setitem()

File ~\Anaconda3\envs\my_env\lib\site-packages\dpctl\tensor_copy_utils.py:84, in _copy_from_numpy_into(dst, np_ary)
83 src_ary = np.broadcast_to(np_ary, dst.shape)
---> 84 ti._copy_numpy_ndarray_into_usm_ndarray(
85 src=src_ary, dst=dst, sycl_queue=dst.sycl_queue
86 )

RuntimeError: The program was built for 1 devices
Build program log for 'Intel(R) Graphics [0x9a49]':

error: double type is not supported on this platform
in kernel: 'typeinfo name for cl::sycl::detail::__pf_kernel_wrapper<copy_cast_generic_kernel<double, bool> >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for cl::sycl::detail::__pf_kernel_wrapper<copy_cast_generic_kernel<double, bool> >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for copy_cast_generic_kernel<double, bool>'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for copy_cast_generic_kernel<double, bool>'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for cl::sycl::detail::__pf_kernel_wrapper<copy_cast_generic_kernel<std::complex, bool> >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for cl::sycl::detail::__pf_kernel_wrapper<copy_cast_generic_kernel<std::complex, bool> >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for cl::sycl::detail::__pf_kernel_wrapper<copy_cast_generic_kernel<std::complex, bool> >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for cl::sycl::detail::__pf_kernel_wrapper<copy_cast_generic_kernel<std::complex, bool> >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for copy_cast_generic_kernel<std::complex, bool>'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for copy_cast_generic_kernel<std::complex, bool>'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for copy_cast_generic_kernel<std::complex, bool>'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for copy_cast_generic_kernel<std::complex, bool>'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for cl::sycl::detail::__pf_kernel_wrapper<copy_cast_generic_kernel<double, signed char> >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for cl::sycl::detail::__pf_kernel_wrapper<copy_cast_generic_kernel<double, signed char> >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for linear_sequence_affine_kernel<std::complex >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for cl::sycl::detail::__pf_kernel_wrapper<__usmfill >'
error: backend compiler failed build.

error: double type is not supported on this platform
in kernel: 'typeinfo name for __usmfill'
error: backend compiler failed build.
-11 (CL_BUILD_PROGRAM_FAILURE)

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
Input In [20], in <cell line: 7>()
5 y = lambda x: np.sin(x)
6 # create area for graphic
----> 7 x = np.linspace(0, numpy.pi,100)
8 # draw graphic
9 print (y(x))

File ~\Anaconda3\envs\my_env\lib\site-packages\dpnp\dpnp_iface_arraycreation.py:867, in linspace(start, stop, num, endpoint, retstep, dtype, axis)
864 if axis != 0:
865 checker_throw_value_error("linspace", "axis", axis, 0)
--> 867 res = dpnp_linspace(start, stop, num, endpoint, retstep, dtype, axis)
869 if retstep:
870 return res

File dpnp\dpnp_algo\dpnp_algo_arraycreation.pyx:310, in dpnp.dpnp_algo.dpnp_algo.dpnp_linspace()

File dpnp\dpnp_algo\dpnp_algo_arraycreation.pyx:329, in dpnp.dpnp_algo.dpnp_algo.dpnp_linspace()

File ~\Anaconda3\envs\my_env\lib\site-packages\dpnp\dpnp_array.py:273, in dpnp_array.setitem(self, key, val)
272 def setitem(self, key, val):
--> 273 self._array_obj.setitem(key, val)

File dpctl\tensor_usmarray.pyx:938, in dpctl.tensor._usmarray.usm_ndarray.setitem()

ValueError: Input of type <class 'int'> could not be converted to numpy.ndarray

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions