'Reduce the instance for serialization.
Pre-compiled PTX code string is serialized inside the `ptx` (CachedPTX).
Loaded CUfunctions are discarded. They are recreated when unserialized.'

def __reduce__(self):

    if self.linking:
        msg = 'cannot    pickle    CUDA    kernel    function    with    additional    libraries    to    link    against'
        raise RuntimeError(msg)
    args = (self.__class__, self.entry_name, self.ptx, self.linking)
    return (serialize._rebuild_reduction, args)
