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

IntelPython / dpnp / 18463977845

13 Oct 2025 11:15AM UTC coverage: 72.021% (+0.006%) from 72.015%
18463977845

Pull #2616

github

web-flow
Merge 4683c32d6 into 800f642c9
Pull Request #2616: Add `dpnp.exceptions` submodule to aggregate generic exceptions

5067 of 10224 branches covered (49.56%)

Branch coverage included in aggregate %.

8 of 8 new or added lines in 2 files covered. (100.0%)

2041 existing lines in 130 files now uncovered.

18659 of 22719 relevant lines covered (82.13%)

18876.68 hits per line

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

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

29
#include <stdexcept>
30

31
#include "dpnp_random_state.hpp"
32
#include <oneapi/mkl/rng.hpp>
33

34
namespace mkl_rng = oneapi::mkl::rng;
35

36
void MT19937_InitScalarSeed(mt19937_struct *mt19937,
37
                            DPCTLSyclQueueRef q_ref,
38
                            uint32_t seed)
39
{
438✔
40
    sycl::queue *q = reinterpret_cast<sycl::queue *>(q_ref);
438✔
41
    mt19937->engine = new mkl_rng::mt19937(*q, seed);
438✔
42
}
438✔
43

44
void MT19937_InitVectorSeed(mt19937_struct *mt19937,
45
                            DPCTLSyclQueueRef q_ref,
46
                            uint32_t *seed,
47
                            unsigned int n)
48
{
180✔
49
    sycl::queue *q = reinterpret_cast<sycl::queue *>(q_ref);
180✔
50

51
    switch (n) {
180✔
52
    case 1:
6✔
53
        mt19937->engine = new mkl_rng::mt19937(*q, {seed[0]});
6✔
54
        break;
6✔
UNCOV
55
    case 2:
×
UNCOV
56
        mt19937->engine = new mkl_rng::mt19937(*q, {seed[0], seed[1]});
×
UNCOV
57
        break;
×
58
    case 3:
174✔
59
        mt19937->engine = new mkl_rng::mt19937(*q, {seed[0], seed[1], seed[2]});
174✔
60
        break;
174✔
UNCOV
61
    default:
×
62
        // TODO need to get rid of the limitation for seed vector length
UNCOV
63
        throw std::runtime_error("Too long seed vector");
×
64
    }
180✔
65
}
180✔
66

67
void MT19937_Delete(mt19937_struct *mt19937)
68
{
642✔
69
    mkl_rng::mt19937 *engine = static_cast<mkl_rng::mt19937 *>(mt19937->engine);
642✔
70
    mt19937->engine = nullptr;
642✔
71
    delete engine;
642✔
72
}
642✔
73

74
void MCG59_InitScalarSeed(mcg59_struct *mcg59,
75
                          DPCTLSyclQueueRef q_ref,
76
                          uint64_t seed)
77
{
×
UNCOV
78
    sycl::queue *q = reinterpret_cast<sycl::queue *>(q_ref);
×
UNCOV
79
    mcg59->engine = new mkl_rng::mcg59(*q, seed);
×
80
}
×
81

82
void MCG59_Delete(mcg59_struct *mcg59)
83
{
×
84
    mkl_rng::mcg59 *engine = static_cast<mkl_rng::mcg59 *>(mcg59->engine);
×
UNCOV
85
    mcg59->engine = nullptr;
×
UNCOV
86
    delete engine;
×
UNCOV
87
}
×
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

© 2026 Coveralls, Inc