Skip to content

Commit

Permalink
update RequiresGPU to string
Browse files Browse the repository at this point in the history
  • Loading branch information
Norraphat committed Apr 27, 2021
1 parent 8b13bf4 commit 13545c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
25 changes: 16 additions & 9 deletions Configuration/PyReleaseValidation/python/MatrixInjector.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ def __init__(self,opt,mode='init',options=''):
####################################
# require
self.RequiresGPU = opt.RequiresGPU
if self.RequiresGPU not in (0,1,2):
print('RequiresGPU should be 0,1,2. Now, reset to 0.')
self.RequiresGPU = 0 #reset if number is not 0,1,2
if self.RequiresGPU not in ('forbidden','optional','required'):
print('RequiresGPU must be forbidden, optional, required. Now, set to forbidden.')
self.RequiresGPU = 'forbidden'
if self.RequiresGPU == 'optional':
print('Optional GPU is turned off for RelVals. Now, changing it to forbidden')
self.RequiresGPU = 'forbidden'
self.GPUMemory = opt.GPUMemory
self.CUDACapabilities = opt.CUDACapabilities.split(',')
self.CUDARuntime = opt.CUDARuntime
Expand Down Expand Up @@ -171,7 +174,8 @@ def __init__(self,opt,mode='init',options=''):
"nowmIO": {},
"Multicore" : opt.nThreads, # this is the per-taskchain Multicore; it's the default assigned to a task if it has no value specified
"EventStreams": self.numberOfStreams,
"KeepOutput" : False
"KeepOutput" : False,
"GPUParams": None
}
self.defaultInput={
"TaskName" : "DigiHLT", #Task Name
Expand All @@ -183,7 +187,8 @@ def __init__(self,opt,mode='init',options=''):
"nowmIO": {},
"Multicore" : opt.nThreads, # this is the per-taskchain Multicore; it's the default assigned to a task if it has no value specified
"EventStreams": self.numberOfStreams,
"KeepOutput" : False
"KeepOutput" : False,
"GPUParams": None
}
self.defaultTask={
"TaskName" : None, #Task Name
Expand All @@ -197,8 +202,8 @@ def __init__(self,opt,mode='init',options=''):
"Multicore" : opt.nThreads, # this is the per-taskchain Multicore; it's the default assigned to a task if it has no value specified
"EventStreams": self.numberOfStreams,
"KeepOutput" : False,
"RequiresGPU" : 0,
"GPUParams": {None}
"RequiresGPU" : None,
"GPUParams": None
}
self.defaultGPUParams={
"GPUMemory": self.GPUMemory,
Expand Down Expand Up @@ -404,7 +409,6 @@ def prepare(self, mReader, directories, mode='init'):
thisLabel+='_FastSim'
if 'lhe' in s[2][index] in s[2][index]:
chainDict['nowmTasklist'][-1]['LheInputFiles'] =True

elif nextHasDSInput:
chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultInput))
try:
Expand Down Expand Up @@ -434,6 +438,9 @@ def prepare(self, mReader, directories, mode='init'):
if setPrimaryDs:
chainDict['nowmTasklist'][-1]['PrimaryDataset']=setPrimaryDs
nextHasDSInput=None
if 'GPU' in step and self.RequiresGPU == 'required':
chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU
chainDict['nowmTasklist'][-1]['GPUParams']=self.defaultGPUParams
else:
#not first step and no inputDS
chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultTask))
Expand All @@ -446,7 +453,7 @@ def prepare(self, mReader, directories, mode='init'):
chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf
if step in wmsplit:
chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step]
if 'GPU' in step and (self.RequiresGPU == 1 or self.RequiresGPU == 2):
if 'GPU' in step and self.RequiresGPU == 'required':
chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU
chainDict['nowmTasklist'][-1]['GPUParams']=self.defaultGPUParams

Expand Down
9 changes: 4 additions & 5 deletions Configuration/PyReleaseValidation/scripts/runTheMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,22 +333,22 @@ def runSelected(opt):
action='store')

parser.add_option('--RequiresGPU',
help='if GPU is reuired or not: 0 = Not (default), 1 = can use if available, 2 = must use. Default = 0.',
help='if GPU is reuired or not: forbidden (default, CPU-only), optional, required',
dest='RequiresGPU',
default=0)

parser.add_option('--GPUMemory',
help='to specify GPU memory. Default = 8000 MB (for RequiresGPU=2).',
help='to specify GPU memory. Default = 8000 MB (for RequiresGPU = required).',
dest='GPUMemory',
default='8000')

parser.add_option('--CUDACapabilities',
help='to specify CUDA capabilities. Default = 7.5 (for RequiresGPU=2).',
help='to specify CUDA capabilities. Default = 7.5 (for RequiresGPU = required).',
dest='CUDACapabilities',
default='7.5')

parser.add_option('--CUDARuntime',
help='to specify CUDA runtime. Default = 11.2 (for RequiresGPU=2).',
help='to specify CUDA runtime. Default = 11.2 (for RequiresGPU= required).',
dest='CUDARuntime',
default='11.2')

Expand Down Expand Up @@ -436,7 +436,6 @@ def stepOrIndex(s):
if opt.numberEventsInLuminosityBlock: opt.numberEventsInLuminosityBlock=int(opt.numberEventsInLuminosityBlock)
if opt.memoryOffset: opt.memoryOffset=int(opt.memoryOffset)
if opt.memPerCore: opt.memPerCore=int(opt.memPerCore)
if opt.RequiresGPU: opt.RequiresGPU=int(opt.RequiresGPU)

if opt.wmcontrol:
performInjectionOptionTest(opt)
Expand Down

0 comments on commit 13545c7

Please sign in to comment.