Skip to content

Commit da2632d

Browse files
committed
Safeguard in case of --gpu and no GPU available
1 parent 94b121a commit da2632d

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

Configuration/PyReleaseValidation/python/relval_data_highstats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
wf_number = wf_number + offset_pd * p_n
6060
wf_number = wf_number + offset_events * evs
6161
wf_number = round(wf_number,6)
62-
step_name = "Run" + pd + era.split("Run")[1] + "_10k"
62+
step_name = "Run" + pd + era.split("Run")[1] + e_key
6363
y = str(int(base_wf))
6464
suff = "ZB_" if "ZeroBias" in step_name else ""
6565
workflows[wf_number] = ['',[step_name,'HLTDR3_' + y,'RECONANORUN3_' + suff + 'reHLT_'+y,'HARVESTRUN3_' + suff + y]]

Configuration/PyReleaseValidation/scripts/runTheMatrix.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -450,32 +450,42 @@ def runSelected(opt):
450450
default='')
451451

452452
opt = parser.parse_args()
453-
454453
opt.selected_gpus = None
455-
if opt.gpu:
454+
455+
if opt.gpu != 'forbidden':
456456

457457
print(">> Running with --gpu option. Checking the available and supported GPUs.")
458458
gpus = cleanComputeCapabilities("cuda")
459459
gpus = gpus + cleanComputeCapabilities("rocm", len(gpus))
460460
available_gpus = gpus
461461

462-
print("> GPUs Available:")
463-
[print(f) for f in available_gpus]
462+
if len(available_gpus) == 0:
463+
print(">> No GPU available!")
464+
opt.gpu = 'forbidden'
465+
else:
466+
print(">> GPUs available:")
467+
[print(f) for f in available_gpus]
464468

465-
# Filtering ONLY CUDA GPUs on capability
466-
gpus = [g for g in gpus if not g.isCUDA() or (g.isCUDA() and g.capability in opt.CUDACapabilities)]
469+
# Filtering ONLY CUDA GPUs on capability
470+
gpus = [g for g in gpus if not g.isCUDA() or (g.isCUDA() and g.capability in opt.CUDACapabilities)]
467471

468-
# Filtering by name (if parsed)
469-
if len(opt.GPUName) > 0:
470-
gpus = [g for g in gpus if g.name == opt.GPUName]
472+
# Filtering by name (if parsed)
473+
if len(opt.GPUName) > 0:
474+
gpus = [g for g in gpus if g.name == opt.GPUName]
471475

472-
if available_gpus != gpus:
473-
print(">> Selected:")
474-
[print(f) for f in gpus]
475-
else:
476-
print(">> All selected!")
477-
478-
opt.selected_gpus = cycle(gpus)
476+
if available_gpus != gpus:
477+
if len(gpus) > 0:
478+
print(">> GPUs selected:")
479+
[print(f) for f in gpus]
480+
else:
481+
print(">> No GPU selected!")
482+
else:
483+
print(">> All selected!")
484+
485+
if len(gpus) > 0:
486+
opt.selected_gpus = cycle(gpus)
487+
else:
488+
opt.gpu = 'forbidden'
479489

480490
if opt.command: opt.command = ' '.join(opt.command)
481491
os.environ["CMSSW_DAS_QUERY_SITES"]=opt.dasSites

0 commit comments

Comments
 (0)