| h5_threads | R Documentation |
Sets how many threads h5lite uses for the work it can do in parallel.
Currently that is the Blosc and Blosc2 codecs ("blosc1-..." and
"blosc2-..."), which compress and decompress the blocks of each chunk in
parallel. Everything uses one thread unless you ask for more.
h5_threads(n = NULL)
n |
The number of threads, from |
More threads help most when compression is slow, as with high Zstandard
levels, or when chunks are large. The setting applies to h5lite for the
rest of the R session.
The default is one thread, or the value of the H5LITE_NTHREADS
environment variable if it is set. Calling h5_threads() overrides it.
Threads need hdf5lib 2.2.0.1 or later. When h5lite is built with
hdf5lib 2.2.0.0, Blosc always uses one thread, whatever the setting.
CRAN allows packages to use at most two threads in their examples, tests, and vignettes.
With n = NULL, the number of threads h5lite will use.
Otherwise, the previous setting, invisibly (0 if none had been made).
h5_compression(), vignette('compression')
h5_threads() # 1
old <- h5_threads(2)
file <- tempfile(fileext = ".h5")
h5_write(rnorm(1e5), file, "x", compress = "blosc2-zstd-5")
h5_threads(old) # Restore the previous setting
unlink(file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.