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

Conversion from Float64 to Float16 is incorrect #45528

Closed
zsoerenm opened this issue May 31, 2022 · 8 comments
Closed

Conversion from Float64 to Float16 is incorrect #45528

zsoerenm opened this issue May 31, 2022 · 8 comments

Comments

@zsoerenm
Copy link
Contributor

Today I observed something unusual:

julia> Float16(4.0)
Float16(0.0)

julia> Float16(4.0f0)
Float16(4.0)

julia> versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 7 PRO 5850U with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, znver3)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 

This might be related:
#45433
#44829

@oscardssmith
Copy link
Member

How did you download Julia?

@oscardssmith
Copy link
Member

wait, I'm pretty sure this is just a dup of #45433

@zsoerenm
Copy link
Contributor Author

Well, that's embarrassing. I used https://aur.archlinux.org/packages/julia-bin from arch linux AUR.
I now downloaded Julia from the website and it does seem to work fine.

@oscardssmith
Copy link
Member

For some reason, most linux distros don't listen to us when we say that they shouldn't link against system LLVM, which leads to a lot of people ending up with broken versions of Julia.

@zsoerenm
Copy link
Contributor Author

zsoerenm commented May 31, 2022

I'm sorry, it was not an error from the AUR package.
I had to LD_PRELOAD=/usr/lib64/libstdc++.so.6 /bin/julia because of this issue:
JuliaGL/GLFW.jl#198
With this pre load Float16 returns wrong results even with the downloaded julia binary.

@zsoerenm zsoerenm reopened this May 31, 2022
@oscardssmith
Copy link
Member

It looks like that issue has been resolved since Julia 1.6. You shouldn't need the LD_PRELOAD anymore.

@zsoerenm
Copy link
Contributor Author

Unfortunately this was not the case.
It looks like it is necessary each time Julias version and System version are out of sync: JuliaGL/GLFW.jl#198 (comment)

@zsoerenm
Copy link
Contributor Author

I upgraded to Julia v1.8.0beta3 and the error is gone even with LD_PRELOAD of libstdc++.so.6.

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

No branches or pull requests

2 participants