File size: 411 Bytes
e794567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# -*- coding: utf-8 -*-
import os

import torch


def is_master_node():
    if "RANK" not in os.environ or int(os.environ["RANK"]) == 0:
        return True
    else:
        return False


def support_flash_attntion():
    # check the GPU is A100 or H100
    device_name = torch.cuda.get_device_name(0)
    for name in ["A100", "H100"]:
        if name in device_name:
            return True
    return False