Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to place loading of CUDAService? #28575

Open
makortel opened this issue Dec 6, 2019 · 12 comments
Open

Where to place loading of CUDAService? #28575

makortel opened this issue Dec 6, 2019 · 12 comments

Comments

@makortel
Copy link
Contributor

makortel commented Dec 6, 2019

PR #28537 introduces CUDAService that needs to be loaded in any configuration that may include CUDA EDModules. The service works also on machines without GPUs, and is used to communicate that fact to elsewhere in CMSSW.

The question is then where exactly the process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") should be placed? In the patatrack fork we modified ConfigBuilder to always include it in the cmsDriver.py-generated configuration files.

An alternative could be to import CUDAService into all cfi/cff files that define CUDA EDModules. On the other hand, we don't tend to do that with other services (like DQMStore or RandomNumberGeneratorService).

Requiring the framework to always load CUDAService internally does not sound a good solution either (at this stage at least).

Are there any better ideas?

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 6, 2019

A new Issue was created by @makortel Matti Kortelainen.

@davidlange6, @Dr15Jones, @smuzaffar, @fabiocos, @kpedro88 can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@fabiocos
Copy link
Contributor

fabiocos commented Dec 9, 2019

assign operations,core

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 9, 2019

New categories assigned: operations,core

@Dr15Jones,@smuzaffar,@fabiocos,@franzoni,@davidlange6,@kpedro88 you have been requested to review this Pull request/Issue and eventually sign? Thanks

@fabiocos
Copy link
Contributor

fabiocos commented Dec 9, 2019

@makortel so practically what you did was to update https://github.com/cms-sw/cmssw/blob/master/Configuration/StandardSequences/python/Services_cff.py ? This sounds as a natural entry point, unless you want to have it conditional to some specific flag

@makortel
Copy link
Contributor Author

makortel commented Dec 9, 2019

@fabiocos I put a process.load() in ConfigBuilder

def define_Configs(self):
if len(self.stepMap):
self.loadAndRemember('Configuration/StandardSequences/Services_cff')
if self._options.particleTable not in defaultOptions.particleTableList:
print('Invalid particle table provided. Options are:')
print(defaultOptions.particleTable)
sys.exit(-1)
else:
if len(self.stepMap):
self.loadAndRemember('SimGeneral.HepPDTESSource.'+self._options.particleTable+'_cfi')
self.loadAndRemember('FWCore/MessageService/MessageLogger_cfi')
# Eventually replace with some more generic file to load
self.loadAndRemember('HeterogeneousCore/CUDAServices/CUDAService_cfi')

Thanks for pointing out the Configuration.StandardSequences.Services_cff, it indeed looks a better placement. The intention indeed is that CUDAService could be loaded by any job, and the service internally handles the case of no GPUs.

@makortel
Copy link
Contributor Author

Based on the discussion yesterday in the core meeting (given #28576), probably it would make sense (as an interim solution) to load CUDAService_cfi only if the gpu modifier (#28522) is given to the cmsDriver.py. Therefore the loadAndRemember() call would stay in the ConfigBuilder, protected with an "if gpu". @fabiocos, @fwyzard, what do you think?

@fwyzard
Copy link
Contributor

fwyzard commented Dec 11, 2019

I understood that if gpu is deprecated... apart from that, I'm fine with this approach :-)

@makortel
Copy link
Contributor Author

The actual line would not be if gpu.isChosen(), but along "if gpu in --processModifiers".

@makortel
Copy link
Contributor Author

I agree it is not pretty, but would limit the set of broken workflows in ppc64le only to the ones really using CUDA.

@makortel
Copy link
Contributor Author

Thinking further

def loadCUDAService(process):
    process.load("HeterogeneousCore.CUDAServices.CUDAService_cff")
modifyConfigurationStandardSequencesServicesCUDAService = gpu.makeProcessModifier(loadCUDAService)

in Configuration/StandardSequences/Services_cff should work as well and wouldn't require touching ConfigBuilder.

@fwyzard
Copy link
Contributor

fwyzard commented Dec 11, 2019

Look clean enough to me ...

@fabiocos
Copy link
Contributor

@makortel from a quick test I did

from Configuration.ProcessModifiers.gpu_cff import *
def loadCUDAService(process):
    process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi")
modifyConfigurationStandardSequencesServicesCUDAService_ = gpu.makeProcessModifier(loadCUDAService)

is correctly uploaded in case the process modifier gpu is part of the Era

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants