Skip to content

Commit

Permalink
Merge pull request #8202 from leofang/cudart_include
Browse files Browse the repository at this point in the history
Fix: remove unnecessary include that causes deployment issue
  • Loading branch information
kmaehashi committed Feb 28, 2024
2 parents 1144fca + e8a42ec commit 2fcc6d4
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 92 deletions.
13 changes: 2 additions & 11 deletions cupyx/scipy/interpolate/_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import cupy
from cupy._core import internal # NOQA
from cupy._core._scalar import get_typename # NOQA
from cupy_backends.cuda.api import runtime
from cupyx.scipy import special as spec
from cupyx.scipy.interpolate._bspline import BSpline, _get_dtype

Expand Down Expand Up @@ -122,15 +121,7 @@ def _comb(n, k):
name_expressions=[
'find_breakpoint_position_1d', 'find_breakpoint_position_nd'])

if runtime.is_hip:
BASE_HEADERS = """#include <hip/hip_runtime.h>
"""
else:
BASE_HEADERS = """#include <cuda_runtime.h>
#include <device_launch_parameters.h>
"""

PPOLY_KERNEL = BASE_HEADERS + r"""
PPOLY_KERNEL = r"""
#include <cupy/complex.cuh>
#include <cupy/math_constants.h>
Expand Down Expand Up @@ -404,7 +395,7 @@ def _comb(n, k):
[f'fix_continuity<{type_name}>' for type_name in TYPES] +
[f'integrate<{type_name}>' for type_name in TYPES]))

BPOLY_KERNEL = BASE_HEADERS + r"""
BPOLY_KERNEL = r"""
#include <cupy/complex.cuh>
#include <cupy/math_constants.h>
Expand Down
14 changes: 2 additions & 12 deletions cupyx/scipy/signal/_iir_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,7 @@ def _get_typename(dtype):
TYPE_PAIR_NAMES = [(_get_typename(x), _get_typename(y)) for x, y in TYPE_PAIRS]


if runtime.is_hip:
IIR_KERNEL_BASE = r"""
#include <hip/hip_runtime.h>
"""
else:
IIR_KERNEL_BASE = r"""
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
"""

IIR_KERNEL = IIR_KERNEL_BASE + r"""
IIR_KERNEL = r"""
#include <cupy/math_constants.h>
#include <cupy/carray.cuh>
#include <cupy/complex.cuh>
Expand Down Expand Up @@ -200,7 +190,7 @@ def _get_typename(dtype):
}
"""

IIR_SOS_KERNEL = IIR_KERNEL_BASE + r"""
IIR_SOS_KERNEL = r"""
#include <cupy/math_constants.h>
#include <cupy/carray.cuh>
#include <cupy/complex.cuh>
Expand Down
14 changes: 2 additions & 12 deletions cupyx/scipy/signal/_max_len_seq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import cupy
from cupy_backends.cuda.api import runtime


_mls_taps = {2: [1], 3: [2], 4: [3], 5: [3], 6: [5], 7: [6], 8: [7, 6, 1],
9: [5], 10: [7], 11: [9], 12: [11, 10, 4], 13: [12, 11, 8],
Expand All @@ -10,17 +9,8 @@
27: [26, 25, 22], 28: [25], 29: [27], 30: [29, 28, 7],
31: [28], 32: [31, 30, 10]}

if runtime.is_hip:
MAX_LEN_SEQ_BASE = r"""
#include <hip/hip_runtime.h>
"""
else:
MAX_LEN_SEQ_BASE = r"""
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
"""

MAX_LEN_SEQ_KERNEL = MAX_LEN_SEQ_BASE + r"""
MAX_LEN_SEQ_KERNEL = r"""
#include <cupy/math_constants.h>
#include <cupy/carray.cuh>
#include <cupy/complex.cuh>
Expand Down
12 changes: 1 addition & 11 deletions cupyx/scipy/signal/_peak_finding.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,7 @@ def _get_typename(dtype):
cupy.not_equal: 5,
}

if runtime.is_hip:
PEAKS_KERNEL_BASE = r"""
#include <hip/hip_runtime.h>
"""
else:
PEAKS_KERNEL_BASE = r"""
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
"""

PEAKS_KERNEL = PEAKS_KERNEL_BASE + r"""
PEAKS_KERNEL = r"""
#include <cupy/math_constants.h>
#include <cupy/carray.cuh>
#include <cupy/complex.cuh>
Expand Down
13 changes: 1 addition & 12 deletions cupyx/scipy/signal/_spectral_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import cupy

from cupy_backends.cuda.api import runtime
import cupyx.scipy.signal._signaltools as filtering
from cupyx.scipy.signal._arraytools import (
odd_ext, even_ext, zero_ext, const_ext, _as_strided)
Expand All @@ -48,17 +47,7 @@ def _get_module_func_raw(module, func_name, *template_args):
return kernel


if runtime.is_hip:
KERNEL_BASE = r"""
#include <hip/hip_runtime.h>
"""
else:
KERNEL_BASE = r"""
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
"""

LOMBSCARGLE_KERNEL = KERNEL_BASE + r"""
LOMBSCARGLE_KERNEL = r"""
///////////////////////////////////////////////////////////////////////////////
// LOMBSCARGLE //
Expand Down
12 changes: 1 addition & 11 deletions cupyx/scipy/signal/_splines.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

import cupy
from cupy._core._scalar import get_typename
from cupy_backends.cuda.api import runtime
from cupy._core.internal import _normalize_axis_index

from cupyx.scipy.signal._signaltools import lfilter
Expand All @@ -10,16 +9,7 @@
from cupyx.scipy.signal._iir_utils import collapse_2d, apply_iir_sos


if runtime.is_hip:
SYMIIR2_KERNEL = r"""#include <hip/hip_runtime.h>
"""
else:
SYMIIR2_KERNEL = r"""
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
"""

SYMIIR2_KERNEL = SYMIIR2_KERNEL + r"""
SYMIIR2_KERNEL = r"""
#include <cupy/math_constants.h>
#include <cupy/carray.cuh>
Expand Down
12 changes: 1 addition & 11 deletions cupyx/scipy/signal/_waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,17 +661,7 @@ def _sweep_poly_phase(t, poly):
return phase


if runtime.is_hip:
KERNEL_BASE = r"""
#include <hip/hip_runtime.h>
"""
else:
KERNEL_BASE = r"""
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
"""

UNIT_KERNEL = KERNEL_BASE + r'''
UNIT_KERNEL = r'''
#include <cupy/math_constants.h>
#include <cupy/carray.cuh>
#include <cupy/complex.cuh>
Expand Down
14 changes: 2 additions & 12 deletions cupyx/scipy/spatial/_kdtree_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,7 @@ def _get_typename(dtype):
TYPE_NAMES = [_get_typename(t) for t in TYPES]


if runtime.is_hip:
KERNEL_BASE = r"""
#include <hip/hip_runtime.h>
"""
else:
KERNEL_BASE = r"""
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
"""

KD_KERNEL = KERNEL_BASE + r'''
KD_KERNEL = r'''
#include <cupy/math_constants.h>
#include <cupy/carray.cuh>
#include <cupy/complex.cuh>
Expand Down Expand Up @@ -202,7 +192,7 @@ def _get_typename(dtype):
}
'''

KNN_KERNEL = KERNEL_BASE + r'''
KNN_KERNEL = r'''
#include <cupy/math_constants.h>
#include <cupy/carray.cuh>
#include <cupy/complex.cuh>
Expand Down

0 comments on commit 2fcc6d4

Please sign in to comment.