Skip to content

Commit

Permalink
Merge pull request #1368 from vlad-perevezentsev/cython_profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-pavlyk authored Apr 5, 2023
2 parents b536ae9 + 8e45a67 commit 26f73d5
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 14 deletions.
1 change: 1 addition & 0 deletions dpnp/dparray.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_algo/dpnp_algo.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_algo/dpnp_algo_arraycreation.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_algo/dpnp_algo_bitwise.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down
3 changes: 2 additions & 1 deletion dpnp/dpnp_algo/dpnp_algo_counting.pxi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2020, Intel Corporation
# Copyright (c) 2016-2023, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_algo/dpnp_algo_indexing.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_algo/dpnp_algo_linearalgebra.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_algo/dpnp_algo_logic.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down
3 changes: 2 additions & 1 deletion dpnp/dpnp_algo/dpnp_algo_manipulation.pxi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2020, Intel Corporation
# Copyright (c) 2016-2023, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
3 changes: 2 additions & 1 deletion dpnp/dpnp_algo/dpnp_algo_mathematical.pxi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2020, Intel Corporation
# Copyright (c) 2016-2023, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_algo/dpnp_algo_searching.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down
3 changes: 2 additions & 1 deletion dpnp/dpnp_algo/dpnp_algo_sorting.pxi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2020, Intel Corporation
# Copyright (c) 2016-2023, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
3 changes: 2 additions & 1 deletion dpnp/dpnp_algo/dpnp_algo_special.pxi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2020, Intel Corporation
# Copyright (c) 2016-2023, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_algo/dpnp_algo_statistics.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down
3 changes: 2 additions & 1 deletion dpnp/dpnp_algo/dpnp_algo_trigonometric.pxi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2020, Intel Corporation
# Copyright (c) 2016-2023, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
3 changes: 2 additions & 1 deletion dpnp/dpnp_utils/dpnp_algo_utils.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down Expand Up @@ -257,7 +258,7 @@ def get_usm_allocations(objects):

if not isinstance(objects, (list, tuple)):
raise TypeError("Expected a list or a tuple, got {}".format(type(objects)))

if len(objects) == 0:
return (None, None)
return (_get_coerced_usm_type(objects), _get_common_allocation_queue(objects))
Expand Down
3 changes: 2 additions & 1 deletion dpnp/fft/dpnp_algo_fft.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2022, Intel Corporation
# Copyright (c) 2016-2023, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
3 changes: 2 additions & 1 deletion dpnp/linalg/dpnp_algo_linalg.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down Expand Up @@ -87,7 +88,7 @@ cpdef utils.dpnp_descriptor dpnp_cholesky(utils.dpnp_descriptor input_):

# ceate result array with type given by FPTR data
cdef utils.dpnp_descriptor result = utils.create_output_descriptor(input_.shape,
kernel_data.return_type,
kernel_data.return_type,
None,
device=input_obj.sycl_device,
usm_type=input_obj.usm_type,
Expand Down
11 changes: 6 additions & 5 deletions dpnp/random/dpnp_algo_random.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cython: language_level=3
# cython: linetrace=True
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2023, Intel Corporation
Expand Down Expand Up @@ -143,7 +144,7 @@ ctypedef c_dpctl.DPCTLSyclEventRef(*fptr_dpnp_rng_laplace_c_1out_t)(c_dpctl.DPCT
const double,
const size_t,
const c_dpctl.DPCTLEventVectorRef) except +
ctypedef c_dpctl.DPCTLSyclEventRef(*fptr_dpnp_rng_logistic_c_1out_t)(c_dpctl.DPCTLSyclQueueRef, void * ,
ctypedef c_dpctl.DPCTLSyclEventRef(*fptr_dpnp_rng_logistic_c_1out_t)(c_dpctl.DPCTLSyclQueueRef, void * ,
const double,
const double,
const size_t,
Expand Down Expand Up @@ -514,7 +515,7 @@ cpdef utils.dpnp_descriptor dpnp_rng_binomial(int ntrial, double p, size):

with nogil: c_dpctl.DPCTLEvent_WaitAndThrow(event_ref)
c_dpctl.DPCTLEvent_Delete(event_ref)

return result


Expand Down Expand Up @@ -831,7 +832,7 @@ cpdef utils.dpnp_descriptor dpnp_rng_logistic(double loc, double scale, size):
cdef fptr_dpnp_rng_logistic_c_1out_t func = < fptr_dpnp_rng_logistic_c_1out_t > kernel_data.ptr
# call FPTR function
cdef c_dpctl.DPCTLSyclEventRef event_ref = func(q_ref, result.get_data(), loc, scale, result.size, NULL)

with nogil: c_dpctl.DPCTLEvent_WaitAndThrow(event_ref)
c_dpctl.DPCTLEvent_Delete(event_ref)

Expand Down Expand Up @@ -1015,7 +1016,7 @@ cpdef utils.dpnp_descriptor dpnp_rng_negative_binomial(double a, double p, size)
func = <fptr_dpnp_rng_negative_binomial_c_1out_t > kernel_data.ptr
# call FPTR function
event_ref = func(q_ref, result.get_data(), a, p, result.size, NULL)

with nogil: c_dpctl.DPCTLEvent_WaitAndThrow(event_ref)
c_dpctl.DPCTLEvent_Delete(event_ref)

Expand Down Expand Up @@ -1204,7 +1205,7 @@ cpdef utils.dpnp_descriptor dpnp_rng_rayleigh(double scale, size):

q = <c_dpctl.SyclQueue> result_sycl_queue
q_ref = q.get_queue_ref()

func = <fptr_dpnp_rng_rayleigh_c_1out_t > kernel_data.ptr
# call FPTR function
event_ref = func(q_ref, result.get_data(), scale, result.size, NULL)
Expand Down

0 comments on commit 26f73d5

Please sign in to comment.