Skip to content

Commit eef5bd0

Browse files
Modification to prevent scalar indexing on CUDA devices
Scalar indexing on CUDA devices results in poor performance. This modification uses dot syntax to prevent scalar indexing.
1 parent e5d10e2 commit eef5bd0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lsqr.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ function lsqr_method!(log::ConvergenceHistory, x, A, b;
9898
n = size(A,2)
9999
length(x) == n || error("x should be of length ", n)
100100
length(b) == m || error("b should be of length ", m)
101-
for i = 1:n
102-
isfinite(x[i]) || error("Initial guess for x must be finite")
101+
102+
if !(all(isfinite.(x)))
103+
error("Initial guess for x must be finite")
103104
end
104105

106+
105107
# Initialize
106108
T = Adivtype(A, b)
107109
Tr = real(T)

0 commit comments

Comments
 (0)