Skip to content

Commit e617eaa

Browse files
committed
remove workaround #703 cufinufft upcast now that we're 2.4.0
1 parent f8f3816 commit e617eaa

1 file changed

Lines changed: 2 additions & 26 deletions

File tree

src/aspire/nufft/cufinufft.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from cufinufft import Plan as cufPlan
66

77
from aspire.nufft import Plan
8-
from aspire.utils import complex_type
98

109
logger = logging.getLogger(__name__)
1110

@@ -26,12 +25,6 @@ def __init__(self, sz, fourier_pts, epsilon=1e-8, ntransforms=1, **kwargs):
2625
# Passing "ntransforms" > 1 expects one large higher dimensional array later.
2726
self.ntransforms = ntransforms
2827

29-
# Workaround cufinufft A100 singles issue
30-
# ASPIRE-Python/703
31-
# Cast to doubles.
32-
self._original_dtype = fourier_pts.dtype
33-
fourier_pts = fourier_pts.astype(np.float64, copy=False)
34-
3528
# Basic dtype passthough.
3629
dtype = fourier_pts.dtype
3730
if dtype == np.float64 or dtype == np.complex128:
@@ -86,12 +79,8 @@ def transform(self, signal):
8679
`(ntransforms, num_pts)` as CuPy array.
8780
"""
8881

89-
# Check we're not forcing a dtype workaround for ASPIRE-Python/703,
90-
# then check if we have a dtype mismatch.
9182
# This avoids false positive complaint for the workaround.
92-
if (self._original_dtype == self.dtype) and not (
93-
signal.dtype == self.dtype or signal.dtype == self.complex_dtype
94-
):
83+
if not (signal.dtype == self.dtype or signal.dtype == self.complex_dtype):
9584
logger.warning(
9685
"Incorrect dtypes passed to (a)nufft."
9786
" In the future this will be an error."
@@ -128,10 +117,6 @@ def transform(self, signal):
128117

129118
self._transform_plan.execute(signal, out=result)
130119

131-
# ASPIRE-Python/703
132-
if result.dtype != complex_type(self._original_dtype):
133-
result = result.astype(complex_type(self._original_dtype))
134-
135120
return result
136121

137122
def adjoint(self, signal):
@@ -145,12 +130,7 @@ def adjoint(self, signal):
145130
:returns: Transformed signal `(sz)` or `(sz, ntransforms)` as CuPy array.
146131
"""
147132

148-
# Check we're not forcing a dtype workaround for ASPIRE-Python/703,
149-
# then check if we have a dtype mismatch.
150-
# This avoids false positive complaint for the workaround.
151-
if (self._original_dtype == self.dtype) and not (
152-
signal.dtype == self.complex_dtype or signal.dtype == self.dtype
153-
):
133+
if not (signal.dtype == self.complex_dtype or signal.dtype == self.dtype):
154134
logger.warning(
155135
"Incorrect dtypes passed to (a)nufft."
156136
" In the future this will be an error."
@@ -177,8 +157,4 @@ def adjoint(self, signal):
177157

178158
self._adjoint_plan.execute(signal, out=result)
179159

180-
# ASPIRE-Python/703
181-
if result.dtype != complex_type(self._original_dtype):
182-
result = result.astype(complex_type(self._original_dtype))
183-
184160
return result

0 commit comments

Comments
 (0)