summaryrefslogtreecommitdiff
path: root/utils/misc.py
blob: b8508304e4e1af0817372c50229412fa711f4148 (plain)
1
2
3
4
5
6
7
8
9
10
import os

from utils.configuration import SystemConfiguration


def set_visible_cuda(config: SystemConfiguration):
    """Set environment variable CUDA device(s)"""
    CUDA_VISIBLE_DEVICES = config.get('CUDA_VISIBLE_DEVICES', None)
    if CUDA_VISIBLE_DEVICES:
        os.environ['CUDA_VISIBLE_DEVICES'] = CUDA_VISIBLE_DEVICES