'Perform the entire ufunc call mechanism.'

@classmethod
def call(cls, typemap, args, kws):

    stream = kws.pop('stream', cls.DEFAULT_STREAM)
    out = kws.pop('out', None)
    if kws:
        warnings.warn(('unrecognized    keywords:    %s' % ',    '.join(kws)))
    cr = cls(typemap, args)
    args = cr.get_arguments()
    (resty, func) = cr.get_function()
    outshape = args[0].shape
    def attempt_ravel(a):
        if cr.SUPPORT_DEVICE_SLICING:
            raise NotImplementedError
        try:
            return a.ravel()
        except NotImplementedError:
            if (not cr.is_device_array(a)):
                raise
            else:
                hostary = cr.to_host(a, stream).ravel()
                return cr.to_device(hostary, stream)
    if (args[0].ndim > 1):
        args = [attempt_ravel(a) for a in args]
    devarys = []
    any_device = False
    for a in args:
        if cr.is_device_array(a):
            devarys.append(a)
            any_device = True
        else:
            dev_a = cr.to_device(a, stream=stream)
            devarys.append(dev_a)
    shape = args[0].shape
    if (out is None):
        devout = cr.device_array(shape, resty, stream=stream)
        devarys.extend([devout])
        cr.launch(func, shape[0], stream, devarys)
        if any_device:
            return devout.reshape(outshape)
        else:
            return devout.copy_to_host().reshape(outshape)
    elif cr.is_device_array(out):
        if (out.ndim > 1):
            out = attempt_ravel(out)
        devout = out
        devarys.extend([devout])
        cr.launch(func, shape[0], stream, devarys)
        return devout.reshape(outshape)
    else:
        assert (out.shape == shape)
        assert (out.dtype == resty)
        devout = cr.device_array(shape, resty, stream=stream)
        devarys.extend([devout])
        cr.launch(func, shape[0], stream, devarys)
        return devout.copy_to_host(out, stream=stream).reshape(outshape)
