Skip to content

Commit 367c68f

Browse files
committed
Drop support for CUDA 10.1 and below.
1 parent cea77a5 commit 367c68f

File tree

4 files changed

+45
-108
lines changed

4 files changed

+45
-108
lines changed

.buildkite/pipeline.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -260,27 +260,6 @@ steps:
260260
if: build.message !~ /\[skip tests\]/ && !build.pull_request.draft
261261
timeout_in_minutes: 120
262262

263-
- label: "CUDA 10.1"
264-
plugins:
265-
- JuliaCI/julia#v1:
266-
version: 1.6
267-
- JuliaCI/julia-test#v1: ~
268-
- JuliaCI/julia-coverage#v1:
269-
codecov: true
270-
dirs:
271-
- src
272-
- lib
273-
- examples
274-
agents:
275-
queue: "juliagpu"
276-
cuda: "10.1"
277-
cap: "sm_75"
278-
env:
279-
JULIA_CUDA_VERSION: '10.1'
280-
JULIA_CUDA_USE_BINARYBUILDER: 'true'
281-
if: build.message !~ /\[skip tests\]/ && !build.pull_request.draft
282-
timeout_in_minutes: 120
283-
284263

285264
# special tests
286265

lib/cublas/wrappers.jl

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,9 @@ for (fname, elty) in ((:cublasDscal_v2,:Float64),
103103
end
104104
end
105105
function scal!(n::Integer, alpha::Number, x::StridedCuArray{Float16})
106-
if version() > v"10.1"
107-
α = convert(Float32, alpha)
108-
cublasScalEx(handle(), n, Ref{Float32}(α), Float32, x, Float16, stride(x, 1), Float32)
109-
return x
110-
else
111-
wide_x = widen.(x)
112-
scal!(n, alpha, wide_x)
113-
thin_x = convert(typeof(x), wide_x)
114-
copyto!(x, thin_x)
115-
return x
116-
end
106+
α = convert(Float32, alpha)
107+
cublasScalEx(handle(), n, Ref{Float32}(α), Float32, x, Float16, stride(x, 1), Float32)
108+
return x
117109
end
118110
# specific variants in case x is complex and alpha is real
119111
for (fname, elty, celty) in ((:cublasCsscal_v2, :Float32, :ComplexF32),
@@ -153,13 +145,9 @@ for (jname, fname, elty) in ((:dot,:cublasDdot_v2,:Float64),
153145
end
154146
end
155147
function dot(n::Integer, x::StridedCuArray{Float16}, y::StridedCuArray{Float16})
156-
if version() > v"10.1"
157-
result = Ref{Float16}()
158-
cublasDotEx(handle(), n, x, Float16, stride(x, 1), y, Float16, stride(y, 1), result, Float16, Float32)
159-
return result[]
160-
else
161-
return convert(Float16, dot(n, convert(CuArray{Float32}, x), convert(CuArray{Float32}, y)))
162-
end
148+
result = Ref{Float16}()
149+
cublasDotEx(handle(), n, x, Float16, stride(x, 1), y, Float16, stride(y, 1), result, Float16, Float32)
150+
return result[]
163151
end
164152
function dotc(n::Integer, x::StridedCuArray{ComplexF16}, y::StridedCuArray{ComplexF16})
165153
return convert(ComplexF16, dotc(n, convert(CuArray{ComplexF32}, x), convert(CuArray{ComplexF32}, y)))
@@ -185,15 +173,9 @@ end
185173
nrm2(x::StridedCuArray) = nrm2(length(x), x)
186174

187175
function nrm2(n::Integer, x::StridedCuArray{Float16})
188-
if version() > v"10.1"
189-
result = Ref{Float16}()
190-
cublasNrm2Ex(handle(), n, x, Float16, stride(x, 1), result, Float16, Float32)
191-
return result[]
192-
else
193-
wide_x = widen.(x)
194-
nrm = nrm2(n, wide_x)
195-
return convert(Float16, nrm)
196-
end
176+
result = Ref{Float16}()
177+
cublasNrm2Ex(handle(), n, x, Float16, stride(x, 1), result, Float16, Float32)
178+
return result[]
197179
end
198180
function nrm2(n::Integer, x::StridedCuArray{ComplexF16})
199181
wide_x = widen.(x)
@@ -233,18 +215,9 @@ for (fname, elty) in ((:cublasDaxpy_v2,:Float64),
233215
end
234216

235217
function axpy!(n::Integer, alpha::Number, dx::StridedCuArray{Float16}, dy::StridedCuArray{Float16})
236-
if version() >= v"10.1"
237-
α = convert(Float32, alpha)
238-
cublasAxpyEx(handle(), n, Ref{Float32}(α), Float32, dx, Float16, stride(dx, 1), dy, Float16, stride(dy, 1), Float32)
239-
return dy
240-
else
241-
wide_x = widen.(dx)
242-
wide_y = widen.(dy)
243-
axpy!(n, alpha, wide_x, wide_y)
244-
thin_y = convert(typeof(dy), wide_y)
245-
copyto!(dy, thin_y)
246-
return dy
247-
end
218+
α = convert(Float32, alpha)
219+
cublasAxpyEx(handle(), n, Ref{Float32}(α), Float32, dx, Float16, stride(dx, 1), dy, Float16, stride(dy, 1), Float32)
220+
return dy
248221
end
249222
function axpy!(n::Integer, alpha::Number, dx::StridedCuArray{ComplexF16}, dy::StridedCuArray{ComplexF16})
250223
wide_x = widen.(dx)

lib/cusparse/conversions.jl

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -121,36 +121,27 @@ function CuSparseMatrixCSR{T}(S::Adjoint{T, <:CuSparseMatrixCSC{T}}) where {T <:
121121
end
122122

123123
# by flipping rows and columns, we can use that to get CSC to CSR too
124-
for (fname,elty) in ((:cusparseScsr2csc, :Float32),
125-
(:cusparseDcsr2csc, :Float64),
126-
(:cusparseCcsr2csc, :ComplexF32),
127-
(:cusparseZcsr2csc, :ComplexF64))
124+
for elty in (Float32, Float64, ComplexF32, ComplexF64)
128125
@eval begin
129126
function CuSparseMatrixCSC{$elty}(csr::CuSparseMatrixCSR{$elty}; inda::SparseChar='O')
130127
m,n = size(csr)
131128
colPtr = CUDA.zeros(Cint, n+1)
132129
rowVal = CUDA.zeros(Cint, nnz(csr))
133130
nzVal = CUDA.zeros($elty, nnz(csr))
134-
if version() >= v"10.2"
135-
# TODO: algorithm configuratibility?
136-
function bufferSize()
137-
out = Ref{Csize_t}(1)
138-
cusparseCsr2cscEx2_bufferSize(handle(), m, n, nnz(csr), nonzeros(csr),
139-
csr.rowPtr, csr.colVal, nzVal, colPtr, rowVal,
140-
$elty, CUSPARSE_ACTION_NUMERIC, inda,
141-
CUSPARSE_CSR2CSC_ALG1, out)
142-
return out[]
143-
end
144-
with_workspace(bufferSize) do buffer
145-
cusparseCsr2cscEx2(handle(), m, n, nnz(csr), nonzeros(csr),
146-
csr.rowPtr, csr.colVal, nzVal, colPtr, rowVal,
147-
$elty, CUSPARSE_ACTION_NUMERIC, inda,
148-
CUSPARSE_CSR2CSC_ALG1, buffer)
149-
end
150-
else
151-
$fname(handle(), m, n, nnz(csr), nonzeros(csr),
152-
csr.rowPtr, csr.colVal, nzVal, rowVal,
153-
colPtr, CUSPARSE_ACTION_NUMERIC, inda)
131+
# TODO: algorithm configuratibility?
132+
function bufferSize()
133+
out = Ref{Csize_t}(1)
134+
cusparseCsr2cscEx2_bufferSize(handle(), m, n, nnz(csr), nonzeros(csr),
135+
csr.rowPtr, csr.colVal, nzVal, colPtr, rowVal,
136+
$elty, CUSPARSE_ACTION_NUMERIC, inda,
137+
CUSPARSE_CSR2CSC_ALG1, out)
138+
return out[]
139+
end
140+
with_workspace(bufferSize) do buffer
141+
cusparseCsr2cscEx2(handle(), m, n, nnz(csr), nonzeros(csr),
142+
csr.rowPtr, csr.colVal, nzVal, colPtr, rowVal,
143+
$elty, CUSPARSE_ACTION_NUMERIC, inda,
144+
CUSPARSE_CSR2CSC_ALG1, buffer)
154145
end
155146
CuSparseMatrixCSC(colPtr,rowVal,nzVal,size(csr))
156147
end
@@ -160,26 +151,20 @@ for (fname,elty) in ((:cusparseScsr2csc, :Float32),
160151
rowPtr = CUDA.zeros(Cint,m+1)
161152
colVal = CUDA.zeros(Cint,nnz(csc))
162153
nzVal = CUDA.zeros($elty,nnz(csc))
163-
if version() >= v"10.2"
164-
# TODO: algorithm configuratibility?
165-
function bufferSize()
166-
out = Ref{Csize_t}(1)
167-
cusparseCsr2cscEx2_bufferSize(handle(), n, m, nnz(csc), nonzeros(csc),
168-
csc.colPtr, rowvals(csc), nzVal, rowPtr, colVal,
169-
$elty, CUSPARSE_ACTION_NUMERIC, inda,
170-
CUSPARSE_CSR2CSC_ALG1, out)
171-
return out[]
172-
end
173-
with_workspace(bufferSize) do buffer
174-
cusparseCsr2cscEx2(handle(), n, m, nnz(csc), nonzeros(csc),
175-
csc.colPtr, rowvals(csc), nzVal, rowPtr, colVal,
176-
$elty, CUSPARSE_ACTION_NUMERIC, inda,
177-
CUSPARSE_CSR2CSC_ALG1, buffer)
178-
end
179-
else
180-
$fname(handle(), n, m, nnz(csc), nonzeros(csc),
181-
csc.colPtr, rowvals(csc), nzVal, colVal,
182-
rowPtr, CUSPARSE_ACTION_NUMERIC, inda)
154+
# TODO: algorithm configuratibility?
155+
function bufferSize()
156+
out = Ref{Csize_t}(1)
157+
cusparseCsr2cscEx2_bufferSize(handle(), n, m, nnz(csc), nonzeros(csc),
158+
csc.colPtr, rowvals(csc), nzVal, rowPtr, colVal,
159+
$elty, CUSPARSE_ACTION_NUMERIC, inda,
160+
CUSPARSE_CSR2CSC_ALG1, out)
161+
return out[]
162+
end
163+
with_workspace(bufferSize) do buffer
164+
cusparseCsr2cscEx2(handle(), n, m, nnz(csc), nonzeros(csc),
165+
csc.colPtr, rowvals(csc), nzVal, rowPtr, colVal,
166+
$elty, CUSPARSE_ACTION_NUMERIC, inda,
167+
CUSPARSE_CSR2CSC_ALG1, buffer)
183168
end
184169
CuSparseMatrixCSR(rowPtr,colVal,nzVal,size(csc))
185170
end
@@ -197,7 +182,7 @@ for (elty, welty) in ((:Float16, :Float32),
197182
rowVal = CUDA.zeros(Cint, nnz(csr))
198183
nzVal = CUDA.zeros($elty, nnz(csr))
199184
# TODO: algorithm configuratibility?
200-
if version() >= v"10.2" && $elty == Float16 #broken for ComplexF16?
185+
if $elty == Float16 #broken for ComplexF16?
201186
function bufferSize()
202187
out = Ref{Csize_t}(1)
203188
cusparseCsr2cscEx2_bufferSize(handle(), m, n, nnz(csr), nonzeros(csr),
@@ -225,7 +210,7 @@ for (elty, welty) in ((:Float16, :Float32),
225210
rowPtr = CUDA.zeros(Cint,m+1)
226211
colVal = CUDA.zeros(Cint,nnz(csc))
227212
nzVal = CUDA.zeros($elty,nnz(csc))
228-
if version() >= v"10.2" && $elty == Float16 #broken for ComplexF16?
213+
if $elty == Float16 #broken for ComplexF16?
229214
# TODO: algorithm configuratibility?
230215
function bufferSize()
231216
out = Ref{Csize_t}(1)

src/initialization.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ end
6262
return
6363
end
6464

65-
if version() < v"10.1"
66-
@warn "This version of CUDA.jl only supports NVIDIA drivers for CUDA 10.1 or higher (yours is for CUDA $(version()))"
65+
if version() < v"10.2"
66+
@warn "This version of CUDA.jl only supports NVIDIA drivers for CUDA 10.2 or higher (yours is for CUDA $(version()))"
6767
end
6868

6969
if version() < v"11.2"

0 commit comments

Comments
 (0)