MultiThreading | R Documentation |
Check whether session supports multi-core and/or GPU evaluation and utilities about their activation
handleMultiCore(cores)
canUseTorch(optimizeForSpeed, deviceStr)
cores |
the number of cores asked for |
optimizeForSpeed |
A Boolean to indicate whether to try to use the faster torch library |
deviceStr |
The name of the device to be used by torch |
handleMultiCore()
uses parallelly::supportsMulticore()
and
parallelly::availableCores()
to actually check whether the session
supports multi-core evaluation. Provides an effective upper bound to the
number of cores.
canUseTorch()
is an internal function to handle the torch library:
it returns whether torch is ready to be used. It obeys the opt-out
flag set via the COTAN.UseTorch
option
handleMultiCore()
returns the maximum sensible number of cores to
use
canUseTorch()
returns a list with 2 elements:
"useTorch"
: a Boolean indicating whether the torch library can be used
"deviceStr"
: the updated name of the device to be used: if no cuda
GPU
is available it will fallback to CPU calculations
the help page of parallelly::supportsMulticore()
about the flags
influencing the multi-core support; e.g. the usage of R
option
parallelly.fork.enable
.
torch::install_torch()
and torch::torch_is_installed()
for
installation. Note the torch::torch_set_num_threads()
has effect also on
the Rfast package methods
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.