@@ -459,16 +459,17 @@ def runSelected(opt):
459
459
opt = parser .parse_args ()
460
460
opt .selected_gpus = None
461
461
462
- if opt .gpu != 'forbidden' :
462
+ if not opt . wmcontrol and opt .gpu != 'forbidden' :
463
463
464
464
print (">> Running with --gpu option. Checking the available and supported GPUs." )
465
465
gpus = cleanComputeCapabilities ("cuda" )
466
466
gpus = gpus + cleanComputeCapabilities ("rocm" , len (gpus ))
467
467
available_gpus = gpus
468
468
469
469
if len (available_gpus ) == 0 :
470
+ if opt .gpu == 'required' :
471
+ raise Exception ('Launched with --gpu required and no GPU available!' )
470
472
print (">> No GPU available!" )
471
- opt .gpu = 'forbidden'
472
473
else :
473
474
print (">> GPUs available:" )
474
475
[print (f ) for f in available_gpus ]
@@ -485,14 +486,18 @@ def runSelected(opt):
485
486
print (">> GPUs selected:" )
486
487
[print (f ) for f in gpus ]
487
488
else :
489
+ if opt .gpu == 'required' :
490
+ raise Exception ('Launched with --gpu required and no GPU selected (among those available)!' )
488
491
print (">> No GPU selected!" )
489
492
else :
490
493
print (">> All selected!" )
491
494
492
495
if len (gpus ) > 0 :
493
496
opt .selected_gpus = cycle (gpus )
494
497
else :
495
- opt .gpu = 'forbidden'
498
+ error_str = 'No GPU selected'
499
+ if opt .gpu == 'required' :
500
+ raise Exception ('Launched with --gpu required and no GPU available (among those available)!' )
496
501
497
502
if opt .command : opt .command = ' ' .join (opt .command )
498
503
os .environ ["CMSSW_DAS_QUERY_SITES" ]= opt .dasSites
0 commit comments