提交 badfab33 编写于 作者: M MRXLT

add check

上级 1e9af5e8
...@@ -69,11 +69,12 @@ def start_multi_card(args): # pylint: disable=doc-string-missing ...@@ -69,11 +69,12 @@ def start_multi_card(args): # pylint: disable=doc-string-missing
gpus = args.gpu_ids.split(",") gpus = args.gpu_ids.split(",")
if "CUDA_VISIBLE_DEVICES" in os.environ: if "CUDA_VISIBLE_DEVICES" in os.environ:
env_gpus = os.environ["CUDA_VISIBLE_DEVICES"].split(",") env_gpus = os.environ["CUDA_VISIBLE_DEVICES"].split(",")
if int(gpus[-1]) >= len(env_gpus): for ids in gpus:
print( if int(ids) >= len(env_gpus):
" Max index of gpu_ids out of range, the number of CUDA_VISIBLE_DEVICES is {}.". print(
format(len(env_gpus))) " Max index of gpu_ids out of range, the number of CUDA_VISIBLE_DEVICES is {}.".
exit(-1) format(len(env_gpus)))
exit(-1)
else: else:
env_gpus = [] env_gpus = []
if len(gpus) <= 0: if len(gpus) <= 0:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册