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


def set_visible_cuda(config: Dict):
    """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