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:

  1. cdt.SETTINGS.NJOBS

  2. cdt.SETTINGS.GPU

  3. cdt.SETTINGS.default_device

  4. cdt.SETTINGS.autoset_config

  5. cdt.SETTINGS.verbose

  6. 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 the cdt.SETTINGS ‘s attributes.

It has two modes of processing:

  1. **kwargs for retrieving a single argument: get_default(argument_name=value).

  2. *args through a list of tuples of the shape ('argument_name', value) to retrieve multiple values at once.

cdt.utils.Settings.autoset_settings(set_var)[source]

Autoset GPU parameters using CUDA_VISIBLE_DEVICES variables.

Return default config if variable not set. :param set_var: Variable to set. Must be of type ConfigSettings