Skip to content

Commit 19f3031

Browse files
committed
improve compile-time warnings & raise UserWarning at run time
1 parent d8cba63 commit 19f3031

File tree

9 files changed

+33
-27
lines changed

9 files changed

+33
-27
lines changed

cuda_bindings/cuda/ccuda.pxd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ from cuda.bindings.cydriver cimport *
22

33
cdef extern from *:
44
"""
5+
#ifdef _MSC_VER
56
#pragma message ( "The cuda.ccuda module is deprecated and will be removed in a future release, " \
67
"please switch to use the cuda.bindings.cydriver module instead." )
8+
#else
9+
#warning The cuda.ccuda module is deprecated and will be removed in a future release, \
10+
please switch to use the cuda.bindings.cydriver module instead.
11+
#endif
712
"""

cuda_bindings/cuda/ccuda.pyx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
from cuda.bindings.cydriver cimport *
2-
3-
cdef extern from *:
4-
"""
5-
#pragma message ( "The cuda.ccuda module is deprecated and will be removed in a future release, " \
6-
"please switch to use the cuda.bindings.cydriver module instead." )
7-
"""
8-
9-
102
from cuda.bindings import cydriver
113
__pyx_capi__ = cydriver.__pyx_capi__
124
del cydriver

cuda_bindings/cuda/ccudart.pxd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ from cuda.bindings.cyruntime cimport *
22

33
cdef extern from *:
44
"""
5+
#ifdef _MSC_VER
56
#pragma message ( "The cuda.ccudart module is deprecated and will be removed in a future release, " \
67
"please switch to use the cuda.bindings.cyruntime module instead." )
8+
#else
9+
#warning The cuda.ccudart module is deprecated and will be removed in a future release, \
10+
please switch to use the cuda.bindings.cyruntime module instead.
11+
#endif
712
"""

cuda_bindings/cuda/ccudart.pyx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
from cuda.bindings.cyruntime cimport *
2-
3-
cdef extern from *:
4-
"""
5-
#pragma message ( "The cuda.ccudart module is deprecated and will be removed in a future release, " \
6-
"please switch to use the cuda.bindings.cyruntime module instead." )
7-
"""
8-
9-
102
from cuda.bindings import cyruntime
113
__pyx_capi__ = cyruntime.__pyx_capi__
124
del cyruntime

cuda_bindings/cuda/cnvrtc.pxd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ from cuda.bindings.cynvrtc cimport *
22

33
cdef extern from *:
44
"""
5+
#ifdef _MSC_VER
56
#pragma message ( "The cuda.cnvrtc module is deprecated and will be removed in a future release, " \
67
"please switch to use the cuda.bindings.cynvrtc module instead." )
8+
#else
9+
#warning The cuda.cnvrtc module is deprecated and will be removed in a future release, \
10+
please switch to use the cuda.bindings.cynvrtc module instead.
11+
#endif
712
"""

cuda_bindings/cuda/cnvrtc.pyx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
from cuda.bindings.cynvrtc cimport *
2-
3-
cdef extern from *:
4-
"""
5-
#pragma message ( "The cuda.cnvrtc module is deprecated and will be removed in a future release, " \
6-
"please switch to use the cuda.bindings.cynvrtc module instead." )
7-
"""
8-
9-
102
from cuda.bindings import cynvrtc
113
__pyx_capi__ = cynvrtc.__pyx_capi__
124
del cynvrtc

cuda_bindings/cuda/cuda.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ from cuda.bindings.driver import *
55

66
cdef extern from *:
77
"""
8+
#ifdef _MSC_VER
89
#pragma message ( "The cuda.cuda module is deprecated and will be removed in a future release, " \
910
"please switch to use the cuda.bindings.driver module instead." )
11+
#else
12+
#warning The cuda.cuda module is deprecated and will be removed in a future release, \
13+
please switch to use the cuda.bindings.driver module instead.
14+
#endif
1015
"""
1116

1217

1318
_warnings.warn("The cuda.cuda module is deprecated and will be removed in a future release, "
14-
"please switch to use the cuda.bindings.driver module instead.", DeprecationWarning, stacklevel=2)
19+
"please switch to use the cuda.bindings.driver module instead.", UserWarning, stacklevel=2)

cuda_bindings/cuda/cudart.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ from cuda.bindings.runtime import *
55

66
cdef extern from *:
77
"""
8+
#ifdef _MSC_VER
89
#pragma message ( "The cuda.cudart module is deprecated and will be removed in a future release, " \
910
"please switch to use the cuda.bindings.runtime module instead." )
11+
#else
12+
#warning The cuda.cudart module is deprecated and will be removed in a future release, \
13+
please switch to use the cuda.bindings.runtime module instead.
14+
#endif
1015
"""
1116

1217

1318
_warnings.warn("The cuda.cudart module is deprecated and will be removed in a future release, "
14-
"please switch to use the cuda.bindings.runtime module instead.", DeprecationWarning, stacklevel=2)
19+
"please switch to use the cuda.bindings.runtime module instead.", UserWarning, stacklevel=2)

cuda_bindings/cuda/nvrtc.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ from cuda.bindings.nvrtc import *
55

66
cdef extern from *:
77
"""
8+
#ifdef _MSC_VER
89
#pragma message ( "The cuda.nvrtc module is deprecated and will be removed in a future release, " \
910
"please switch to use the cuda.bindings.nvrtc module instead." )
11+
#else
12+
#warning The cuda.nvrtc module is deprecated and will be removed in a future release, \
13+
please switch to use the cuda.bindings.nvrtc module instead.
14+
#endif
1015
"""
1116

1217

1318
_warnings.warn("The cuda.nvrtc module is deprecated and will be removed in a future release, "
14-
"please switch to use the cuda.bindings.nvrtc module instead.", DeprecationWarning, stacklevel=2)
19+
"please switch to use the cuda.bindings.nvrtc module instead.", UserWarning, stacklevel=2)

0 commit comments

Comments
 (0)