Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:39

0001 def makeSerialClone(module, **kwargs):
0002     type = module._TypedParameterizable__type
0003     if type.endswith('@alpaka'):
0004         # alpaka module with automatic backend selection
0005         base = type.removesuffix('@alpaka')
0006     elif type.startswith('alpaka_serial_sync::'):
0007         # alpaka module with explicit serial_sync backend
0008         base = type.removeprefix('alpaka_serial_sync::')
0009     elif type.startswith('alpaka_cuda_async::'):
0010         # alpaka module with explicit cuda_async backend
0011         base = type.removeprefix('alpaka_cuda_async::')
0012     elif type.startswith('alpaka_rocm_async::'):
0013         # alpaka module with explicit rocm_async backend
0014         base = type.removeprefix('alpaka_rocm_async::')
0015     else:
0016         # non-alpaka module
0017         raise TypeError('%s is not an alpaka-based module, and cannot be used with makeSerialClone()' % str(module))
0018 
0019     copy = module.clone(**kwargs)
0020     copy._TypedParameterizable__type = 'alpaka_serial_sync::' + base
0021     if 'alpaka' in copy.parameterNames_():
0022         del copy.alpaka
0023     return copy