Skip to content

Commit f6ada72

Browse files
committed
leave CUDA's unsafe_execute be
1 parent 7f6dacd commit f6ada72

File tree

1 file changed

+14
-31
lines changed

1 file changed

+14
-31
lines changed

src/gpu.jl

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,37 +117,20 @@ using CUDA.CUFFT: rCuFFTPlan, cufftReal, cufftComplex, CUFFT_R2C, cufftExecR2C,
117117
plan_buffer(x) = plan_buffer(eltype(x),size(x))
118118
@memoize plan_buffer(T, dims, dev=deviceid()) = CuArray{T}(undef,dims...)
119119

120-
function unsafe_execute!(plan::rCuFFTPlan{cufftReal,K,false,N},
121-
x::CuArray{cufftReal,N}, y::CuArray{cufftComplex,N}
122-
) where {K,N}
123-
@assert plan.xtype == CUFFT_R2C
124-
cufftExecR2C(plan, x, y)
125-
end
126-
function unsafe_execute!(plan::rCuFFTPlan{cufftComplex,K,false,N},
127-
x::CuArray{cufftComplex,N}, y::CuArray{cufftReal}
128-
) where {K,N}
129-
@assert plan.xtype == CUFFT_C2R
130-
cufftExecC2R(plan, unsafe_copyto!(pointer(plan_buffer(x)),pointer(x),length(x),async=true,stream=stream()), y)
131-
end
132-
133-
# monkey-patched version of https://github.com/JuliaGPU/CUDA.jl/pull/436
134-
# until it hits a release
135-
using CUDA.CURAND: curandSetPseudoRandomGeneratorSeed, curandSetGeneratorOffset,
136-
CURAND_STATUS_ALLOCATION_FAILED, CURAND_STATUS_PREEXISTING_FAILURE, CURAND_STATUS_SUCCESS,
137-
unsafe_curandGenerateSeeds, throw_api_error, @retry_reclaim, RNG
138-
139-
function Random.seed!(rng::RNG, seed=Base.rand(UInt64), offset=0)
140-
curandSetPseudoRandomGeneratorSeed(rng, seed)
141-
curandSetGeneratorOffset(rng, offset)
142-
res = @retry_reclaim err->isequal(err, CURAND_STATUS_ALLOCATION_FAILED) ||
143-
isequal(err, CURAND_STATUS_PREEXISTING_FAILURE) begin
144-
unsafe_curandGenerateSeeds(rng)
145-
end
146-
if res != CURAND_STATUS_SUCCESS
147-
throw_api_error(res)
148-
end
149-
return
150-
end
120+
## might want to bring this back but need to adapt to newer CUDA verions
121+
122+
# function unsafe_execute!(plan::rCuFFTPlan{cufftReal,K,false,N},
123+
# x::CuArray{cufftReal,N}, y::CuArray{cufftComplex,N}
124+
# ) where {K,N}
125+
# @assert plan.xtype == CUFFT_R2C
126+
# cufftExecR2C(plan, x, y)
127+
# end
128+
# function unsafe_execute!(plan::rCuFFTPlan{cufftComplex,K,false,N},
129+
# x::CuArray{cufftComplex,N}, y::CuArray{cufftReal}
130+
# ) where {K,N}
131+
# @assert plan.xtype == CUFFT_C2R
132+
# cufftExecC2R(plan, unsafe_copyto!(pointer(plan_buffer(x)),pointer(x),length(x),async=true,stream=stream()), y)
133+
# end
151134

152135

153136
"""

0 commit comments

Comments
 (0)