Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ jobs:
needs: test_windows

if: |
!github.event.pull_request.head.repo.fork &&
!github.event.pull_request.head.repo.fork && !github.event.push.repository.fork &&
(github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/'))

runs-on: windows-latest
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
author = 'Intel'

# The short X.Y version
version = '0.10'
version = '0.11'
# The full version, including alpha/beta/rc tags
release = '0.10.3'
release = '0.11.0'


# -- General configuration ---------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions dpnp/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

# set(DPNP_VERSION 0.10.3)
# set(DPNP_API_VERSION 0.10)
# set(DPNP_VERSION 0.11.0)
# set(DPNP_API_VERSION 0.11)

# set directory where the custom finders live
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
Expand Down
2 changes: 1 addition & 1 deletion dpnp/backend/doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "DPNP C++ backend kernel library"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.10.3
PROJECT_NUMBER = 0.11.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
11 changes: 10 additions & 1 deletion dpnp/backend/src/dpnp_utils.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2020, Intel Corporation
// Copyright (c) 2016-2022, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -40,6 +40,15 @@
(__LIBSYCL_MAJOR_VERSION > major) || (__LIBSYCL_MAJOR_VERSION == major and __LIBSYCL_MINOR_VERSION > minor) || \
(__LIBSYCL_MAJOR_VERSION == major and __LIBSYCL_MINOR_VERSION == minor and __LIBSYCL_PATCH_VERSION >= patch)

/**
* Version of SYCL DPC++ 2023 compiler at which transition to SYCL 2020 occurs.
* Intel(R) oneAPI DPC++ 2022.2.1 compiler has version 20221020L on Linux and
* 20221101L on Windows.
*/
#ifndef __SYCL_COMPILER_2023_SWITCHOVER
#define __SYCL_COMPILER_2023_SWITCHOVER 20221102L
#endif

/**
* @defgroup BACKEND_UTILS Backend C++ library utilities
* @{
Expand Down
5 changes: 4 additions & 1 deletion dpnp/backend/src/dpnpc_memory_adapter.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2020, Intel Corporation
// Copyright (c) 2016-2022, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -28,6 +28,7 @@
#define DPNP_MEMORY_ADAPTER_H

#include "queue_sycl.hpp"
#include "dpnp_utils.hpp"

/**
* @ingroup BACKEND_UTILS
Expand Down Expand Up @@ -84,8 +85,10 @@ class DPNPC_ptr_adapter final
std::cerr << "\n\t size_in_bytes=" << size_in_bytes;
std::cerr << "\n\t pointer type=" << (long)src_ptr_type;
std::cerr << "\n\t queue inorder=" << queue.is_in_order();
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
std::cerr << "\n\t queue is_host=" << queue.is_host();
std::cerr << "\n\t queue device is_host=" << queue.get_device().is_host();
#endif
std::cerr << "\n\t queue device is_cpu=" << queue.get_device().is_cpu();
std::cerr << "\n\t queue device is_gpu=" << queue.get_device().is_gpu();
std::cerr << "\n\t queue device is_accelerator=" << queue.get_device().is_accelerator();
Expand Down
9 changes: 7 additions & 2 deletions dpnp/backend/src/queue_sycl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <dpnp_iface.hpp>
#include "queue_sycl.hpp"
#include "dpnp_utils.hpp"

#if defined(DPNP_LOCAL_QUEUE)
sycl::queue* backend_sycl::queue = nullptr;
Expand Down Expand Up @@ -211,10 +212,14 @@ bool backend_sycl::backend_sycl_is_cpu()
{
sycl::queue& qptr = get_queue();

if (qptr.is_host() || qptr.get_device().is_cpu() || qptr.get_device().is_host())
{
if (qptr.get_device().is_cpu()) {
return true;
}
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
else if (qptr.is_host() || qptr.get_device().is_host()) {
return true;
}
#endif

return false;
}
Expand Down
4 changes: 4 additions & 0 deletions dpnp/dpnp_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def sycl_context(self):
def device(self):
return self._array_obj.device

@property
def usm_type(self):
return self._array_obj.usm_type

def __abs__(self):
return dpnp.abs(self)

Expand Down
2 changes: 1 addition & 1 deletion dpnp/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
DPNP version module
"""

__version__: str = '0.10.3'
__version__: str = '0.11.0'

version: str = __version__
13 changes: 1 addition & 12 deletions tests/test_arraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[0, -5, 10, -2.5, 9.7],
ids=['0', '-5', '10', '-2.5', '9.7'])
@pytest.mark.parametrize("stop",
[None, 10, -2, 20.5, 10**5],
[None, 10, -2, 20.5, 1000],
ids=['None', '10', '-2', '20.5', '10**5'])
@pytest.mark.parametrize("step",
[None, 1, 2.7, -1.6, 100],
Expand All @@ -26,17 +26,6 @@ def test_arange(start, stop, step, dtype):
# numpy casts to float32 type when computes float16 data
rtol_mult = 4

# secure there is no 'inf' elements in resulting array
max = numpy.finfo(dtype).max
if stop is not None and stop > max:
# consider comulative accuracy while generating array
# to calculate maximum allowed 'stop' value for dtype=float16
arr_len = (max - start) / (step if step is not None else 1)
arr_ilen = int(arr_len)
arr_len = (arr_ilen + 1) if float(arr_ilen) < arr_len else arr_ilen
acc = rtol_mult * numpy.finfo(dtype).eps
stop = max - acc * arr_len

exp_array = numpy.arange(start, stop=stop, step=step, dtype=dtype)

dpnp_array = dpnp.arange(start, stop=stop, step=step, dtype=dtype)
Expand Down
26 changes: 16 additions & 10 deletions tests/test_random_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
)


def assert_cfd(data, exp_sycl_queue, exp_usm_type=None):
assert exp_sycl_queue == data.sycl_queue
if exp_usm_type:
assert exp_usm_type == data.usm_type


class TestNormal:
@pytest.mark.parametrize("dtype",
[dpnp.float32, dpnp.float64, None],
Expand Down Expand Up @@ -47,7 +53,7 @@ def test_distr(self, dtype, usm_type):
assert_array_almost_equal(dpnp.asnumpy(data), desired, decimal=precision)

# check if compute follows data isn't broken
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue, usm_type)


@pytest.mark.parametrize("dtype",
Expand Down Expand Up @@ -138,7 +144,7 @@ def test_fallback(self, loc, scale):
assert_array_almost_equal(actual, desired, decimal=precision)

# check if compute follows data isn't broken
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue)


@pytest.mark.parametrize("dtype",
Expand Down Expand Up @@ -174,17 +180,17 @@ def test_distr(self, usm_type):

precision = numpy.finfo(dtype=numpy.float64).precision
assert_array_almost_equal(dpnp.asnumpy(data), desired, decimal=precision)
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue, usm_type)

# call with the same seed has to draw the same values
data = RandomState(seed, sycl_queue=sycl_queue).rand(3, 2, usm_type=usm_type)
assert_array_almost_equal(dpnp.asnumpy(data), desired, decimal=precision)
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue, usm_type)

# call with omitted dimensions has to draw the first element from desired
data = RandomState(seed, sycl_queue=sycl_queue).rand(usm_type=usm_type)
assert_array_almost_equal(dpnp.asnumpy(data), desired[0, 0], decimal=precision)
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue, usm_type)

# rand() is an alias on random_sample(), map arguments
with mock.patch('dpnp.random.RandomState.random_sample') as m:
Expand Down Expand Up @@ -245,7 +251,7 @@ def test_distr(self, dtype, usm_type):
[5, 3],
[5, 7]], dtype=numpy.int32)
assert_array_equal(dpnp.asnumpy(data), desired)
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue, usm_type)

# call with the same seed has to draw the same values
data = RandomState(seed, sycl_queue=sycl_queue).randint(low=low,
Expand All @@ -254,15 +260,15 @@ def test_distr(self, dtype, usm_type):
dtype=dtype,
usm_type=usm_type)
assert_array_equal(dpnp.asnumpy(data), desired)
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue, usm_type)

# call with omitted dimensions has to draw the first element from desired
data = RandomState(seed, sycl_queue=sycl_queue).randint(low=low,
high=high,
dtype=dtype,
usm_type=usm_type)
assert_array_equal(dpnp.asnumpy(data), desired[0, 0])
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue, usm_type)

# rand() is an alias on random_sample(), map arguments
with mock.patch('dpnp.random.RandomState.uniform') as m:
Expand Down Expand Up @@ -701,7 +707,7 @@ def test_distr(self, bounds, dtype, usm_type):
assert_array_equal(dpnp.asnumpy(data), desired)

# check if compute follows data isn't broken
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue, usm_type)


@pytest.mark.parametrize("dtype",
Expand Down Expand Up @@ -766,7 +772,7 @@ def test_fallback(self, low, high):
assert_array_almost_equal(actual, desired, decimal=precision)

# check if compute follows data isn't broken
assert sycl_queue == data.sycl_queue
assert_cfd(data, sycl_queue)


@pytest.mark.parametrize("dtype",
Expand Down
6 changes: 2 additions & 4 deletions tests/test_sycl_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ def test_uniform(usm_type, size):
high = 2.0
res = dpnp.random.uniform(low, high, size=size, usm_type=usm_type)

res_usm_type = res.get_array().usm_type
assert usm_type == res_usm_type
assert usm_type == res.usm_type


@pytest.mark.parametrize("usm_type",
Expand All @@ -295,8 +294,7 @@ def test_rs_uniform(usm_type, seed):
rs = dpnp.random.RandomState(seed, sycl_queue=sycl_queue)
res = rs.uniform(low, high, usm_type=usm_type)

res_usm_type = res.get_array().usm_type
assert usm_type == res_usm_type
assert usm_type == res.usm_type

res_sycl_queue = res.get_array().sycl_queue
assert_sycl_queue_equal(res_sycl_queue, sycl_queue)
Expand Down