mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-08-11 21:01:54 +00:00
[Fix] Fix compile error (#4357)
This commit is contained in:
parent
eb952ea88d
commit
cfa607080f
@ -197,11 +197,12 @@ def get_cuda_cc_flag() -> List[str]:
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
cc_flag = []
|
cc_flag = []
|
||||||
|
max_arch = ''.join(str(i) for i in torch.cuda.get_device_capability())
|
||||||
for arch in torch.cuda.get_arch_list():
|
for arch in torch.cuda.get_arch_list():
|
||||||
res = re.search(r'sm_(\d+)', arch)
|
res = re.search(r'sm_(\d+)', arch)
|
||||||
if res:
|
if res:
|
||||||
arch_cap = res[1]
|
arch_cap = res[1]
|
||||||
if int(arch_cap) >= 60:
|
if int(arch_cap) >= 60 and int(arch_cap) <= int(max_arch):
|
||||||
cc_flag.extend(['-gencode', f'arch=compute_{arch_cap},code={arch}'])
|
cc_flag.extend(['-gencode', f'arch=compute_{arch_cap},code={arch}'])
|
||||||
return cc_flag
|
return cc_flag
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user