bfgn.utils package

Submodules

bfgn.utils.compute_access module

bfgn.utils.compute_access.assert_gpu_available()[source]

Asserts that a GPU is available for model training or application.

Return type

None

Returns

None

bfgn.utils.compute_access.get_count_available_gpus()[source]

Gets a count of GPUs available for model training or application.

Return type

int

Returns

Number of GPUs available for model training or application.

bfgn.utils.compute_access.get_count_available_cpus()[source]

Gets a count of CPUs available for model training or application.

Return type

int

Returns

Number of CPUs available for model training or application.

bfgn.utils.logging module

bfgn.utils.logging.get_root_logger(log_outfile=None)[source]

Get a root logger configured to log to stdout and optionally to a log file. Note that bfgn log messages will also appear in the log files, so this is probably useful even if you don’t write your own logging messages.

Parameters

log_outfile (Optional[str]) – File to which logs should be written.

Return type

Logger

Returns

Logger configured for logging.

Example

>>> logger = get_root_logger('logfile.out')
>>> logger.setLevel('INFO')
>>> logger.info('This log message will be in logfile.out')
>>> logger.debug('This log message will not appear because the log level is set to info.')

Module contents