• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IntelPython / dpnp / 12279662243

11 Dec 2024 03:33PM UTC coverage: 65.029% (-0.06%) from 65.09%
12279662243

Pull #2075

github

web-flow
Merge e87174e31 into c4997cc62
Pull Request #2075: Handle dpnp functions and tests to run on CUDA devices

4604 of 11552 branches covered (39.85%)

Branch coverage included in aggregate %.

49 of 89 new or added lines in 7 files covered. (55.06%)

1 existing line in 1 file now uncovered.

16996 of 21664 relevant lines covered (78.45%)

19739.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.14
/dpnp/dpnp_iface_libmath.py
1
# -*- coding: utf-8 -*-
2
# *****************************************************************************
3
# Copyright (c) 2016-2024, Intel Corporation
4
# All rights reserved.
5
#
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions are met:
8
# - Redistributions of source code must retain the above copyright notice,
9
#   this list of conditions and the following disclaimer.
10
# - Redistributions in binary form must reproduce the above copyright notice,
11
#   this list of conditions and the following disclaimer in the documentation
12
#   and/or other materials provided with the distribution.
13
#
14
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24
# THE POSSIBILITY OF SUCH DAMAGE.
25
# *****************************************************************************
26

27
"""
28
Interface of the function from Python Math library
29

30
Notes
31
-----
32
This module is a face or public interface file for the library
33
it contains:
34
 - Interface functions
35
 - documentation for the functions
36
 - The functions parameters check
37

38
"""
39

40
import math
1✔
41

42
import dpnp
1✔
43

44
# pylint: disable=no-name-in-module
45
from .dpnp_algo import (
1✔
46
    dpnp_erf,
47
)
48
from .dpnp_utils import (
1✔
49
    create_output_descriptor_py,
50
)
51

52
__all__ = ["erf"]
1✔
53

54

55
def erf(in_array1):
1✔
56
    """
57
    Returns the error function of complex argument.
58

59
    For full documentation refer to :obj:`scipy.special.erf`.
60

61
    Limitations
62
    -----------
63
    Parameter `in_array1` is supported as :obj:`dpnp.ndarray`.
64
    Otherwise the function will be executed sequentially on CPU.
65
    Input array data types are limited by supported DPNP :ref:`Data types`.
66

67
    .. seealso:: :obj:`math.erf`
68

69
    Examples
70
    --------
71
    >>> import dpnp as np
72
    >>> x = np.linspace(2.0, 3.0, num=5)
73
    >>> [i for i in x]
74
    [2.0, 2.25, 2.5, 2.75, 3.0]
75
    >>> out = np.erf(x)
76
    >>> [i for i in out]
77
    [0.99532227, 0.99853728, 0.99959305, 0.99989938, 0.99997791]
78

79
    """
80

81
    x1_desc = dpnp.get_dpnp_descriptor(
1✔
82
        in_array1, copy_when_strides=False, copy_when_nondefault_queue=False
83
    )
84
    if x1_desc:
1!
85
        if dpnp.is_cuda_backend(x1_desc.get_array()):
1!
NEW
86
            raise NotImplementedError(
×
87
                "Running on CUDA is currently not supported"
88
            )
89
        return dpnp_erf(x1_desc).get_pyobj()
1✔
90

91
    result = create_output_descriptor_py(
×
92
        in_array1.shape, in_array1.dtype, None
93
    ).get_pyobj()
94
    for i in range(result.size):
×
95
        result[i] = math.erf(in_array1[i])
×
96

97
    return result
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc