1 import FWCore.ParameterSet.Config
as cms
3 _cuda_enabled_cached =
None
6 global _cuda_enabled_cached
7 if _cuda_enabled_cached
is None:
9 _cuda_enabled_cached = (os.system(
"cudaIsEnabled") == 0)
10 return (_cuda_enabled_cached, 2)
14 super(SwitchProducerCUDA,self).
__init__(
15 dict(cpu = cms.SwitchProducer.getCpu(),
19 cms.specialImportRegistry.registerSpecialImportForType(SwitchProducerCUDA,
"from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA")
21 if __name__ ==
"__main__":
28 pkl = pickle.dumps(sp)
29 unpkl = pickle.loads(pkl)
30 self.assertEqual(unpkl.cpu.type_(),
"Foo")
31 self.assertEqual(unpkl.cuda.type_(),
"Bar")