Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CuArrays.zeros(T, 0) fails #81

Closed
samo-lin opened this issue May 14, 2020 · 2 comments
Closed

CuArrays.zeros(T, 0) fails #81

samo-lin opened this issue May 14, 2020 · 2 comments
Labels
bug Something isn't working cuda array Stuff about CuArray. good first issue Good for newcomers

Comments

@samo-lin
Copy link
Contributor

It fails with an AssertionError:

julia> T = Float64
julia> CuArrays.zeros(T, 0)
ERROR: AssertionError: total_threads > 0
Stacktrace:
 [1] #gpu_call#1 at /scratch/snx3000tds/omlins/9_soft_install_julia_1_4/software/Julia/1.4.1-CrayGNU-19.10-cuda-10.1/extensions/packages/GPUArrays/OXvxB/src/device/execution.jl:60 [inlined]
 [2] gpu_call at /scratch/snx3000tds/omlins/9_soft_install_julia_1_4/software/Julia/1.4.1-CrayGNU-19.10-cuda-10.1/extensions/packages/GPUArrays/OXvxB/src/device/execution.jl:46 [inlined]
 [3] fill!(::CuArray{Float64,1,Nothing}, ::Int64) at /scratch/snx3000tds/omlins/9_soft_install_julia_1_4/software/Julia/1.4.1-CrayGNU-19.10-cuda-10.1/extensions/packages/GPUArrays/OXvxB/src/host/construction.jl:12
 [4] zeros(::Type{T} where T, ::Int64, ::Vararg{Int64,N} where N) at /scratch/snx3000tds/omlins/9_soft_install_julia_1_4/software/Julia/1.4.1-CrayGNU-19.10-cuda-10.1/extensions/packages/CuArrays/l0gXB/src/array.jl:337
 [5] top-level scope at REPL[129]:1

This works:

julia> CuArray{T}(undef, 0)
0-element CuArray{Float64,1,Nothing}
@samo-lin samo-lin changed the title cuzeros(T, 0) fails CuArrays.zeros(T, 0) fails May 14, 2020
@maleadt maleadt transferred this issue from JuliaGPU/CuArrays.jl May 27, 2020
@maleadt maleadt added bug Something isn't working cuda array Stuff about CuArray. labels May 27, 2020
@maleadt maleadt added the good first issue Good for newcomers label Jun 22, 2020
bors bot added a commit to JuliaGPU/GPUArrays.jl that referenced this issue Jul 15, 2020
300: fix  `fill` when length = 0 r=maleadt a=Ellipse0934

As reported in [#81](JuliaGPU/CUDA.jl#81) , CUDA.jl . Currently constructors such as `CUDA.zeros(T, 0)` would fail for the types not handled by CUDA memset (64-bit numbers not supported).

Previously
```julia
julia> T = Float64
julia> CuArrays.zeros(T, 0)
ERROR: AssertionError: total_threads > 0
Stacktrace:
 [1] #gpu_call#1 at /scratch/snx3000tds/omlins/9_soft_install_julia_1_4/software/Julia/1.4.1-CrayGNU-19.10-cuda-10.1/extensions/packages/GPUArrays/OXvxB/src/device/execution.jl:60 [inlined]
 [2] gpu_call at /scratch/snx3000tds/omlins/9_soft_install_julia_1_4/software/Julia/1.4.1-CrayGNU-19.10-cuda-10.1/extensions/packages/GPUArrays/OXvxB/src/device/execution.jl:46 [inlined]
 [3] fill!(::CuArray{Float64,1,Nothing}, ::Int64) at /scratch/snx3000tds/omlins/9_soft_install_julia_1_4/software/Julia/1.4.1-CrayGNU-19.10-cuda-10.1/extensions/packages/GPUArrays/OXvxB/src/host/construction.jl:12
 [4] zeros(::Type{T} where T, ::Int64, ::Vararg{Int64,N} where N) at /scratch/snx3000tds/omlins/9_soft_install_julia_1_4/software/Julia/1.4.1-CrayGNU-19.10-cuda-10.1/extensions/packages/CuArrays/l0gXB/src/array.jl:337
 [5] top-level scope at REPL[129]:1
```

Now:

```julia
julia> CUDA.zeros(Float64, 0)
0-element CuArray{Float64,1}
```

Co-authored-by: Ellipse0934 <Ellipse0934@github.com>
@Ellipse0934
Copy link
Contributor

Resolved, should be closed.

@maleadt maleadt closed this as completed Jul 16, 2020
@samo-lin
Copy link
Contributor Author

Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda array Stuff about CuArray. good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants