-
Notifications
You must be signed in to change notification settings - Fork 22
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
Bitround in python or julia #25
Comments
For comparison, BitInformation.jl on my MacBook reaches julia> using BitInformation,BenchmarkTools
julia> A = rand(Float32,10000,10000); # 400MB array, only fits into RAM not in caches
julia> B = rand(Float64,10000,10000); # 800MB array
julia> @btime round!($A,7);
24.991 ms (0 allocations: 0 bytes)
julia> @btime round!($B,7);
50.709 ms (0 allocations: 0 bytes)
julia> sizeof(A)/1000^2/25e-3
16000.0
julia> sizeof(A)/1000^2/50e-3
16000.0 so about 16GB/s for Float32/Float64 with in-place rounding without any memory allocation and all data has to be pulled from RAM and does not fit into low level caches (which would allow much higher speeds actually). With memory allocations ( julia> @btime round($A,7);
215.357 ms (2 allocations: 381.47 MiB)
julia> @btime round($B,7);
458.840 ms (2 allocations: 762.94 MiB)
julia> sizeof(A)/1000^2/215e-3
1860.46511627907
julia> sizeof(B)/1000^2/459e-3
1742.9193899782135 |
how does the julia version handle lazy or out-of-memory data? Imagine I'd want to bitround 1 TB, which is larger than memory often, that should work with xarray and dask |
can confirm that bitround.round is faster than xr_bitround despite the julia-python wrapping |
At the moment the round function is written for |
Could you provide some timings, I'm curious. |
Also note that the zarr bitround @rabernat's PR zarr-developers/numcodecs#299 only contains float32 at the moment. |
we should definitely use |
I plan to add support for the other dtypes, but just have not had time to work on the numcodecs PR recently. @aaronspring - if you want to help out, I would welcome your help on the PR. What is xr_bitround? |
|
for chunked data with |
is
xr_bitround
the bitround from xarray as discussed here? For performance I'd suggest to useround
from BitInformation. I've never actually compared the speed, but recalculation of constants is avoided reaching 16GB/s at which point it's memory-bound (and therefore likely an upper bound). Also gives us more flexibility in case we want to change something on the rounding front.Originally posted by @milankl in #21 (comment)
The text was updated successfully, but these errors were encountered: