CMS 3D CMS Logo

Functions
functions Namespace Reference

Functions

def makeSerialClone (module, kwargs)
 

Function Documentation

◆ makeSerialClone()

def functions.makeSerialClone (   module,
  kwargs 
)

Definition at line 1 of file functions.py.

References str.

1 def makeSerialClone(module, **kwargs):
2  type = module._TypedParameterizable__type
3  if type.endswith('@alpaka'):
4  # alpaka module with automatic backend selection
5  base = type.removesuffix('@alpaka')
6  elif type.startswith('alpaka_serial_sync::'):
7  # alpaka module with explicit serial_sync backend
8  base = type.removeprefix('alpaka_serial_sync::')
9  elif type.startswith('alpaka_cuda_async::'):
10  # alpaka module with explicit cuda_async backend
11  base = type.removeprefix('alpaka_cuda_async::')
12  elif type.startswith('alpaka_rocm_async::'):
13  # alpaka module with explicit rocm_async backend
14  base = type.removeprefix('alpaka_rocm_async::')
15  else:
16  # non-alpaka module
17  raise TypeError('%s is not an alpaka-based module, and cannot be used with makeSerialClone()' % str(module))
18 
19  copy = module.clone(**kwargs)
20  copy._TypedParameterizable__type = 'alpaka_serial_sync::' + base
21  if 'alpaka' in copy.parameterNames_():
22  del copy.alpaka
23  return copy
24 
def makeSerialClone(module, kwargs)
Definition: functions.py:1
#define str(s)