megafish.config module

set_resource(gpu=True, scheduler=None)[source]

Sets the resource configuration for GPU usage and concurrent future scheduling.

Parameters:
  • gpu (bool, optional) – Whether to use the GPU. This option is only effective in a CUDA environment. Defaults to True.

  • scheduler (str or None, optional) – The type of scheduler to use as a string. If None, uses the current scheduler. Defaults to None.

Returns:

None

Raises:

ValueError – If an invalid scheduler type is provided.

use_gpu(usage)[source]

Configures the usage of GPU for processing. This function reloads the modules to reflect the changes in the resource configuration.

Parameters:

usage (bool) – A flag indicating whether to enable GPU usage.

Returns:

None

set_scheduler(scheduler)[source]

Sets the scheduler for Dask.

Parameters:

scheduler (str) – The type of scheduler to use (e.g., ‘threads’, ‘processes’, etc.).

Returns:

None

Raises:

ValueError – If the provided scheduler type is invalid.

show_resource()[source]

Shows the current resource configuration.

This function is inserted in the processing functions to show the current resource configuration.

Returns:

A string representation of the current resource configuration.

Return type:

str