Toolbox Settings
The cdt.utils.Settings
module defines the settings used in the toolbox,
such as the default hardware parameters; and the tools to autodetect the
hardware. All parameters are overridable by accessing the cdt.SETTINGS
object, a unique instance of the cdt.utils.ConfigSettings
class.
The various attributes of the cdt.SETTINGS
configuration object are:
cdt.SETTINGS.NJOBS
cdt.SETTINGS.GPU
cdt.SETTINGS.default_device
cdt.SETTINGS.autoset_config
cdt.SETTINGS.verbose
cdt.SETTINGS.rpath
The hardware detection revolves around the presence of GPUs. If GPUs are
present, cdt.SETTINGS.GPU
is set to True
and the number of jobs
is set to the number of GPUs. Else the number of jobs is set to the number
of CPUs. Another test performed at startup is to check if an R framework
is available, unlocking additional features of the toolbox.
cdt.SETTINGS.rpath
allows the user to set a custom path for the Rscript
executable. It should be overriden with the full path as a string.
- class cdt.utils.Settings.ConfigSettings[source]
Defining the class for the hardware/high level settings of the CDT.
- Variables
~ConfigSettings.NB_JOBS (int) – Number of parallel jobs that can be executed on current hardware.
~ConfigSettings.GPU (int) – The number of available GPUs ; defaults to 0.
~ConfigSettings.default_device (str) – Default device used for pytorch jobs.
~ConfigSettings.verbose (bool) – Sets the verbosity of the toolbox algorithms.
~ConfigSettings.rpath (str) – Path of the Rscript executable.
- get_default(*args, **kwargs)[source]
Get the default parameters as defined in the Settings instance.
This function proceeds to seamlessly retrieve the argument to pass through, depending on either it was overidden or not: If no argument was overridden in a function of the toolbox, the default argument will be set to
None
, and this function will retrieve the default parameters as defined by thecdt.SETTINGS
‘s attributes.It has two modes of processing:
**kwargs for retrieving a single argument:
get_default(argument_name=value)
.*args through a list of tuples of the shape
('argument_name', value)
to retrieve multiple values at once.