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

IntelPython / dpnp / 12420042259

19 Dec 2024 08:11PM UTC coverage: 65.06% (-0.01%) from 65.074%
12420042259

Pull #2242

github

web-flow
Merge c87e9c8b0 into cabc0d71c
Pull Request #2242: Support dpnp in virtual environment on Windows out of the box

4556 of 11468 branches covered (39.73%)

Branch coverage included in aggregate %.

1 of 5 new or added lines in 1 file covered. (20.0%)

1 existing line in 1 file now uncovered.

16943 of 21577 relevant lines covered (78.52%)

19827.73 hits per line

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

59.46
/dpnp/__init__.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
import os
1✔
28
import sys
1✔
29

30
mypath = os.path.dirname(os.path.realpath(__file__))
1✔
31

32
# workaround against hanging in OneMKL calls and in DPCTL
33
os.environ.setdefault("SYCL_QUEUE_THREAD_POOL_SIZE", "6")
1✔
34

35
import dpctl
1✔
36

37
dpctlpath = os.path.dirname(dpctl.__file__)
1✔
38

39
# For Windows OS with Python >= 3.7, it is required to explicitly define a path
40
# where to search for DLLs towards both DPNP backend and DPCTL Sycl interface,
41
# otherwise DPNP import will be failing. This is because the libraries
42
# are not installed under any of default paths where Python is searching.
43
from platform import system
1✔
44

45
if system() == "Windows":
1!
46
    if hasattr(os, "add_dll_directory"):
×
47
        os.add_dll_directory(mypath)
×
48
        os.add_dll_directory(dpctlpath)
×
49

UNCOV
50
    os.environ["PATH"] = os.pathsep.join(
×
51
        [os.getenv("PATH", ""), mypath, dpctlpath]
52
    )
53

54
    # For virtual environments on Windows, add folder with DPC++ libraries
55
    # to the DLL search path
NEW
56
    if sys.base_exec_prefix != sys.exec_prefix and os.path.isfile(
×
57
        os.path.join(sys.exec_prefix, "pyvenv.cfg")
58
    ):
NEW
59
        dll_path = os.path.join(sys.exec_prefix, "Library", "bin")
×
NEW
60
        if os.path.isdir(dll_path):
×
NEW
61
            os.environ["PATH"] = os.pathsep.join(
×
62
                [os.getenv("PATH", ""), dll_path]
63
            )
64

65
# Borrowed from DPCTL
66
from dpctl.tensor import DLDeviceType
1✔
67

68
from dpnp.dpnp_array import dpnp_array as ndarray
1✔
69
from dpnp.dpnp_flatiter import flatiter as flatiter
1✔
70
from dpnp.dpnp_iface_types import *
1✔
71
from dpnp.dpnp_iface import *
1✔
72
from dpnp.dpnp_iface import __all__ as _iface__all__
1✔
73
from dpnp.dpnp_iface_utils import *
1✔
74
from dpnp.dpnp_iface_utils import __all__ as _ifaceutils__all__
1✔
75
from dpnp._version import get_versions
1✔
76

77
__all__ = _iface__all__
1✔
78
__all__ += _ifaceutils__all__
1✔
79

80

81
__version__ = get_versions()["version"]
1✔
82
del get_versions
1✔
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