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

Cannot mmap datasets of type ComplexF32 #863

Closed
roflmaostc opened this issue Aug 20, 2021 · 0 comments · Fixed by #864
Closed

Cannot mmap datasets of type ComplexF32 #863

roflmaostc opened this issue Aug 20, 2021 · 0 comments · Fixed by #864

Comments

@roflmaostc
Copy link

Hello,

the following with HDF5 v0.15.6 and Julia 1.6.2 happened:

using HDF5

fname = tempname()
fid = h5open(fname, "w")
g = create_group(fid, "mygroup")
mat = create_dataset(g, "mat", datatype(ComplexF32), dataspace(5,5))
for i in 1:5, j in 1:5
    mat[i, j] = randn(ComplexF32)
end
close(fid)

fid = h5open(fname, "r+")
# works
mat = read(fid["mygroup"]["mat"])

# does not
mat_mmap = HDF5.readmmap(fid["mygroup"]["mat"])

Thanks to #558 complex numbers work, but with readmmap it seems to fail.

julia> include("HDF5.jl")
mat = ComplexF32[1.3623464f0 + 0.6244532f0im -0.29518035f0 - 0.45002094f0im 0.039368484f0 + 0.35088688f0im -0.60823476f0 + 0.30127338f0im -1.0006275f0 - 0.8201217f0im; -1.4361695f0 + 0.6460856f0im -0.53106135f0 + 1.713218f0im -0.31101835f0 + 0.9580644f0im 0.9598781f0 - 0.24997331f0im 0.010050308f0 + 0.8048518f0im; -0.8531363f0 - 0.1344513f0im -0.16356188f0 - 0.9398935f0im -0.19551729f0 - 0.16608053f0im 0.7344293f0 + 0.55872333f0im -0.7306926f0 + 1.5917627f0im; -0.63949335f0 + 0.87596196f0im -0.32529232f0 + 0.37911814f0im -0.37411737f0 - 0.12143369f0im 0.33119792f0 - 0.15147632f0im -0.67340744f0 - 0.56344426f0im; 0.01321806f0 - 0.29816392f0im 0.3216847f0 - 0.20785226f0im -0.38204104f0 - 0.68331385f0im -0.22857241f0 - 0.007945157f0im -0.29809278f0 + 1.3333956f0im]
ERROR: LoadError: Cannot mmap datasets of type ComplexF32
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] readmmap(obj::HDF5.Dataset)
   @ HDF5 ~/.julia/packages/HDF5/0iEnL/src/HDF5.jl:1497
 [3] top-level scope
   @ ~/HDF5.jl:18
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:444
 [5] top-level scope
   @ REPL[59]:1
in expression starting at /home/fxw/HDF5.jl:18

Is there any other fix than using a reinterpret?

Thanks,

Felix

jmert added a commit to jmert/HDF5.jl that referenced this issue Aug 20, 2021
jmert added a commit to jmert/HDF5.jl that referenced this issue Aug 20, 2021
jmert added a commit to jmert/HDF5.jl that referenced this issue Aug 20, 2021
jmert added a commit to jmert/HDF5.jl that referenced this issue Aug 20, 2021
@musm musm closed this as completed in #864 Aug 31, 2021
musm pushed a commit that referenced this issue Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant