Skip to content

Commit 80c49be

Browse files
Use dpctl_capi.h header in dpnp4pybind11.hpp (#2859)
This PR proposes replacing the individual dpctl C-API includes and import calls in `dpnp4pybind11.hpp` with `dpctl_capi.h` header and its `import_dpctl()` function. Previous changes to the explicit imports were made to avoid conflicting with dpctl which contained a tensor; now that dpctl no longer contains a tensor, we can use the header directly. Additionally, fixes `RuntimeWarning` filter in `test_exp_complex_contig`
1 parent 391fb6d commit 80c49be

File tree

2 files changed

+6
-32
lines changed

2 files changed

+6
-32
lines changed

dpnp/backend/include/dpnp4pybind11.hpp

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,8 @@
2828

2929
#pragma once
3030

31-
// Include dpctl SYCL interface from external dpctl package
32-
#include "syclinterface/dpctl_sycl_extension_interface.h"
33-
#include "syclinterface/dpctl_sycl_types.h"
34-
35-
#ifdef __cplusplus
36-
#define CYTHON_EXTERN_C extern "C"
37-
#else
38-
#define CYTHON_EXTERN_C
39-
#endif
40-
41-
// Include dpctl C-API headers (both declarations and import functions)
42-
#include "dpctl/_sycl_context.h"
43-
#include "dpctl/_sycl_context_api.h"
44-
#include "dpctl/_sycl_device.h"
45-
#include "dpctl/_sycl_device_api.h"
46-
#include "dpctl/_sycl_event.h"
47-
#include "dpctl/_sycl_event_api.h"
48-
#include "dpctl/_sycl_queue.h"
49-
#include "dpctl/_sycl_queue_api.h"
50-
#include "dpctl/memory/_memory.h"
51-
#include "dpctl/memory/_memory_api.h"
52-
#include "dpctl/program/_program.h"
53-
#include "dpctl/program/_program_api.h"
31+
// Include dpctl C-API headers
32+
#include "dpctl_capi.h"
5433

5534
// Include generated Cython headers for usm_ndarray
5635
// (struct definition and constants only)
@@ -253,14 +232,9 @@ class dpctl_capi
253232
default_usm_memory_{}, default_usm_ndarray_{}, as_usm_memory_{}
254233

255234
{
256-
// Import dpctl SYCL interface modules
257-
// This imports python modules and initializes pointers to Python types
258-
import_dpctl___sycl_device();
259-
import_dpctl___sycl_context();
260-
import_dpctl___sycl_event();
261-
import_dpctl___sycl_queue();
262-
import_dpctl__memory___memory();
263-
import_dpctl__program___program();
235+
// Import dpctl C-API
236+
// (device, context, event, queue, memory, program)
237+
import_dpctl();
264238
// Import dpnp tensor module for PyUSMArrayType
265239
import_dpnp__tensor___usmarray();
266240

dpnp/tests/tensor/elementwise/test_exp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_exp_real_contig(dtype):
7878
assert_allclose(dpt.asnumpy(Z), np.repeat(Ynp, n_rep), atol=tol, rtol=tol)
7979

8080

81-
@pytest.mark.filterwarnings("ignore:overflow encountered:RuntimeWarning")
81+
@pytest.mark.filterwarnings("ignore::RuntimeWarning")
8282
@pytest.mark.parametrize("dtype", ["c8", "c16"])
8383
def test_exp_complex_contig(dtype):
8484
q = get_queue_or_skip()

0 commit comments

Comments
 (0)