def _initialize(self, dispatcher, identity): identity = ufuncbuilder.parse_identity(identity) super(DUFunc, self).__init__(dispatcher, identity=identity) # Loop over a copy of the keys instead of the keys themselves, # since we're changing the dictionary while looping. self._install_type() self._lower_me = DUFuncLowerer(self) self._install_cg() self.__name__ = dispatcher.py_func.__name__ self.__doc__ = dispatcher.py_func.__doc__
def __init__(self, func, identity=None, cache=False, targetoptions={}): if cache: raise TypeError("caching is not supported") for opt in targetoptions: if opt == 'nopython': warnings.warn("nopython kwarg for cuda target is redundant", RuntimeWarning) else: fmt = "cuda vectorize target does not support option: '%s'" raise KeyError(fmt % opt) self.py_func = func self.identity = parse_identity(identity) # { arg_dtype: (return_dtype), cudakernel } self.kernelmap = OrderedDict()
def __init__(self, func, sig, identity=None, cache=False, targetoptions={}): if cache: raise TypeError("caching is not supported") # Allow nopython flag to be set. if not targetoptions.pop('nopython', True): raise TypeError("nopython flag must be True") # Are there any more target options? if targetoptions: opts = ', '.join([repr(k) for k in targetoptions.keys()]) fmt = "The following target options are not supported: {0}" raise TypeError(fmt.format(opts)) self.py_func = func self.identity = parse_identity(identity) self.signature = sig self.inputsig, self.outputsig = parse_signature(self.signature) assert len(self.outputsig) == 1, "only support 1 output" # { arg_dtype: (return_dtype), cudakernel } self.kernelmap = OrderedDict()