Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

Wrong return type for reductions of complex CuArrays #550

Closed
Sleort opened this issue Jan 5, 2020 · 0 comments · Fixed by JuliaGPU/GPUArrays.jl#226
Closed

Wrong return type for reductions of complex CuArrays #550

Sleort opened this issue Jan 5, 2020 · 0 comments · Fixed by JuliaGPU/GPUArrays.jl#226
Labels

Comments

@Sleort
Copy link

Sleort commented Jan 5, 2020

Describe the bug
With ordinary Arrays, we have

x = rand(ComplexF32, 1)
sum(abs, x) isa Float32 # true
prod(abs, x) isa Float32 # true

as expected, while for CuArrays

using CuArrays
y = cu(x)
sum(abs, y) isa Float32 # false -- sum(abs, y) turns out to be a ComplexF32 with zero imaginary part
prod(abs, y) isa Float32 # false

The same happens to be the case when replacing abs with abs2 or ComplexF32 with ComplexF64.

Expected behavior
CuArrays should behave the same way as Arrays, i.e.

sum(abs, y) isa Float32 # true -- NOT a ComplexF32
prod(abs, y) isa Float32 # true

Environment details
Details on Julia:

julia> versioninfo()
Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

Julia packages:

(v1.3) pkg> st CuArrays
    Status `~/.julia/environments/v1.3/Project.toml`
  [79e6a3ab] Adapt v1.0.0
  [fa961155] CEnum v0.2.0
  [3895d2a7] CUDAapi v2.1.0
  [c5f51814] CUDAdrv v5.0.1
  [be33ccc6] CUDAnative v2.7.0
  [3a865a2d] CuArrays v1.6.0
  [864edb3b] DataStructures v0.17.7
  [872c559c] NNlib v0.6.2

CUDA: toolkit and driver version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant